00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INCL_SYNCSOURCEREPORT
00037 #define INCL_SYNCSOURCEREPORT
00038
00042 #include "base/fscapi.h"
00043 #include "base/Log.h"
00044 #include "base/util/utils.h"
00045 #include "spds/constants.h"
00046 #include "event/constants.h"
00047 #include "spds/ItemReport.h"
00048 #include "base/globalsdef.h"
00049
00050 BEGIN_NAMESPACE
00051
00052
00054 typedef enum SourceState{
00055 SOURCE_ACTIVE = 0,
00056 SOURCE_INACTIVE = 1,
00057 SOURCE_ERROR = 2,
00058 } SourceState;
00059
00060
00067 class SyncSourceReport {
00068
00069 private:
00070
00071
00072 int lastErrorCode;
00073
00074
00075 char* lastErrorMsg;
00076
00077
00078 char* sourceName;
00079
00080
00081
00082
00083
00084 SourceState state;
00085
00086
00087 ArrayList* clientAddItems;
00088 ArrayList* clientModItems;
00089 ArrayList* clientDelItems;
00090
00091
00092 ArrayList* serverAddItems;
00093 ArrayList* serverModItems;
00094 ArrayList* serverDelItems;
00095
00096
00097
00098
00099 bool isSuccessful(const int status);
00100
00101
00102 void initialize();
00103
00104
00105
00106
00107
00108 void assign(const SyncSourceReport& ssr);
00109
00110
00111 public:
00112
00113 SyncSourceReport(const char* name = NULL);
00114 SyncSourceReport(SyncSourceReport& ssr);
00115 virtual ~SyncSourceReport();
00116
00118 const int getLastErrorCode() const;
00119
00121 const SourceState getState() const;
00122
00124 const char* getLastErrorMsg() const;
00125
00127 const char* getSourceName() const;
00128
00129 void setLastErrorCode(const int code);
00130 void setState (const SourceState s);
00131 void setLastErrorMsg (const char* msg);
00132 void setSourceName (const char* name);
00133
00138 bool checkState();
00139
00140
00149 ItemReport* getItemReport(const char* target, const char* command, int index);
00150
00151
00159 int getItemReportCount (const char* target, const char* command);
00160
00161 int getItemReportSuccessfulCount (const char* target, const char* command);
00162
00163 int getItemReportFailedCount (const char* target, const char* command);
00164
00165 int getItemReportAlreadyExistCount(const char* target, const char* command);
00166
00170 int getTotalSuccessfulCount();
00171
00184 void addItem(const char* target, const char* command, const WCHAR* ID, const int status, const WCHAR* statusMessage);
00185
00194 ArrayList* getList(const char* target, const char* command) const;
00195
00199 static const char* const targets[];
00200
00204 static const char* const commands[];
00205
00209 SyncSourceReport& operator = (const SyncSourceReport& ssr) {
00210 assign(ssr);
00211 return *this;
00212 }
00213 };
00214
00215
00216 END_NAMESPACE
00217
00220 #endif
00221