00001 /* 00002 * Copyright (C) 2003-2007 Funambol 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 #ifndef INCL_ITEMREPORT 00020 #define INCL_ITEMREPORT 00021 00023 #include "base/fscapi.h" 00024 #include "base/Log.h" 00025 #include "base/util/utils.h" 00026 00027 00028 /* 00029 * ----------------- ItemReport Class ------------------------ 00030 * temReport class rapresents the result information on a 00031 * single item synchronized, such as the luid of the item 00032 * and its status code (200/201/500...) 00033 */ 00034 class ItemReport : public ArrayElement { 00035 00036 private: 00037 00038 // The status code of the operation executed. 00039 int status; 00040 00041 // The LUID of item. 00042 WCHAR* id; 00043 00044 // The message associated to the status. It can be referred to the whole sync process if the error 00045 // is on the sync header (for example a 506 status code in the sync header) or to a single item as a 00046 // 500 status code on an inserting item. 00047 // in the first case the last error message and code must be set. In the other cases only the status 00048 // 00049 WCHAR* statusMessage; 00050 00051 00052 /* 00053 * Assign this object with the given ItemReport 00054 * @param ir: the ItemReport object 00055 */ 00056 void assign(const ItemReport& ir); 00057 00058 00059 public: 00060 00061 ItemReport(); 00062 ItemReport(ItemReport& ir); 00063 ItemReport(const WCHAR* luid, const int statusCode, const WCHAR* statusMess); 00064 virtual ~ItemReport(); 00065 00066 const WCHAR* getId() const; 00067 void setId(const WCHAR* v); 00068 00069 const int getStatus() const; 00070 void setStatus(const int v); 00071 00072 const WCHAR* getStatusMessage() const; 00073 void setStatusMessage(const WCHAR* v); 00074 00075 ArrayElement* clone(); 00076 00077 /* 00078 * Assign operator 00079 */ 00080 ItemReport& operator = (const ItemReport& ir) { 00081 assign(ir); 00082 return *this; 00083 } 00084 }; 00085 00087 #endif 00088