OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Storage.hpp
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  */
10 #ifndef PIM_STORAGE_HPP_
11 #define PIM_STORAGE_HPP_
12 
13 #include <map>
14 #include <string>
15 #include <vector>
16 #include <plugin/Plugin.hpp>
17 #include <helpers/SmartPtr.hpp>
19 #include <plugin/source/Source.hpp>
20 #include "StorageItem.hpp"
21 
22 
26 namespace OpenAB_Storage {
27 
98 
107 {
108  public:
114  : OpenAB_Source::Source(t)
115  {};
116 
120  virtual ~Storage(){};
121 
126  enum eAddItem{
129  };
130 
141  virtual enum eAddItem addItem(const OpenAB::SmartPtr<OpenAB::PIMItem>& item,
142  OpenAB::PIMItem::ID & newId,
143  OpenAB::PIMItem::Revision & revision) = 0;
144 
155  virtual enum eAddItem addItems(const std::vector<OpenAB::SmartPtr<OpenAB::PIMItem> > & items,
156  OpenAB::PIMItem::IDs & newIds,
157  OpenAB::PIMItem::Revisions & revisions) = 0;
158 
159 
167  };
168 
180  const OpenAB::PIMItem::ID & id,
181  OpenAB::PIMItem::Revision & revision) = 0;
182 
193  virtual enum eModifyItem modifyItems(const std::vector<OpenAB::SmartPtr<OpenAB::PIMItem> > & items,
194  const OpenAB::PIMItem::IDs & ids,
195  OpenAB::PIMItem::Revisions &revisions) = 0;
196 
204  };
205 
212  virtual enum eRemoveItem removeItem(const OpenAB::PIMItem::ID & id) = 0;
213 
220  virtual enum eRemoveItem removeItems(const OpenAB::PIMItem::IDs & ids) = 0;
221 
226  enum eGetItem{
229  };
230 
231  virtual enum eGetItemRet getItem(OpenAB::SmartPtr<OpenAB::PIMItem> &item) = 0;
232 
240  virtual enum eGetItem getItem(const OpenAB::PIMItem::ID & id, OpenAB::SmartPtr<OpenAB::PIMItem>& item) = 0;
241 
249  virtual enum eGetItem getItems(const OpenAB::PIMItem::IDs & ids, std::vector<OpenAB::SmartPtr<OpenAB::PIMItem> > & items) = 0;
250 
254  };
255 
263  virtual OpenAB_Storage::Storage::eGetSyncToken getLatestSyncToken(std::string& token) = 0;
264 
268  };
269 
276  virtual OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map<std::string, std::string>& revisions) = 0;
277 
286  virtual OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string& token,
287  std::map<std::string, std::string>& revisions,
288  std::vector<OpenAB::PIMItem::ID>& removed) = 0;
289 
290 
297 
298 
299  private:
303  Storage(Storage const &other);
304 
308  Storage& operator=(Storage const &other);
309 };
310 
311 } // namespace OpenAB_Storage
312 
313 DECLARE_PLUGIN_INTERFACE(OpenAB_Storage, Storage, Parameters);
314 
315 #endif // PIM_STORAGE_HPP_
std::string Revision
Definition: PIMItem.hpp:89
Failure during the operation.
Definition: Storage.hpp:267
virtual OpenAB_Storage::Storage::eGetRevisions getChangedRevisions(const std::string &token, std::map< std::string, std::string > &revisions, std::vector< OpenAB::PIMItem::ID > &removed)=0
Gets revisions of items changed since Storage was in state identified by token.
Failure during the operation.
Definition: Storage.hpp:128
Item was correctly modified.
Definition: Storage.hpp:165
eModifyItem
Definition: Storage.hpp:164
virtual enum eRemoveItem removeItems(const OpenAB::PIMItem::IDs &ids)=0
Removes items from the Storage.
std::vector< OpenAB::PIMItem::Revision > Revisions
Definition: PIMItem.hpp:111
eAddItem
Definition: Storage.hpp:126
virtual enum eModifyItem modifyItems(const std::vector< OpenAB::SmartPtr< OpenAB::PIMItem > > &items, const OpenAB::PIMItem::IDs &ids, OpenAB::PIMItem::Revisions &revisions)=0
Modifies items (OpenAB::PIMItem) in the Storage.
Documentation for Storage plugin interface. Generic interface is modeled over Sync Plugin specific re...
Definition: Storage.hpp:106
virtual OpenAB_Storage::Storage::eGetRevisions getRevisions(std::map< std::string, std::string > &revisions)=0
Gets revision of the items from the Storage.
Item was correctly removed.
Definition: Storage.hpp:202
Item was correctly found.
Definition: Storage.hpp:227
virtual StorageItemIterator * newStorageItemIterator()=0
Retrieve an new Iterator to quickly parse the list of items.
The StorageItemIterator is mainly used to quickly browse the Storage contents.
Definition: StorageItem.hpp:97
Failure during the operation, or tokens are not supported.
Definition: Storage.hpp:253
std::vector< OpenAB::PIMItem::ID > IDs
Definition: PIMItem.hpp:110
virtual enum eModifyItem modifyItem(const OpenAB::SmartPtr< OpenAB::PIMItem > &item, const OpenAB::PIMItem::ID &id, OpenAB::PIMItem::Revision &revision)=0
Modifies item (OpenAB::PIMItem) in the Storage.
Documentation for Source plugin interface.
Definition: Source.hpp:76
Failure during the operation.
Definition: Storage.hpp:228
eGetItemRet
Definition: Source.hpp:155
Storage(OpenAB::PIMItemType t)
Constructor.
Definition: Storage.hpp:113
virtual enum eRemoveItem removeItem(const OpenAB::PIMItem::ID &id)=0
Removes item from the Storage.
PIMItemType
Definition: PIMItemIndex.hpp:24
eGetItem
Definition: Storage.hpp:226
eGetRevisions
Definition: Storage.hpp:265
virtual enum eAddItem addItems(const std::vector< OpenAB::SmartPtr< OpenAB::PIMItem > > &items, OpenAB::PIMItem::IDs &newIds, OpenAB::PIMItem::Revisions &revisions)=0
Adds new items (OpenAB::PIMItem) to the Storage.
Failure during the operation.
Definition: Storage.hpp:203
Token was correctly retrieved.
Definition: Storage.hpp:252
virtual ~Storage()
Destructor, virtual by default.
Definition: Storage.hpp:120
virtual enum eAddItem addItem(const OpenAB::SmartPtr< OpenAB::PIMItem > &item, OpenAB::PIMItem::ID &newId, OpenAB::PIMItem::Revision &revision)=0
Adds a new item (OpenAB::PIMItem) to the Storage.
Item/Items correctly added.
Definition: Storage.hpp:127
Source(OpenAB::PIMItemType t)
Constructor.
Definition: Source.hpp:83
DECLARE_PLUGIN_INTERFACE(OpenAB_Storage, Storage, Parameters)
Revisions was correctly retrieved.
Definition: Storage.hpp:266
eGetSyncToken
Definition: Storage.hpp:251
OpenAB_Plugin::GenericParameters Parameters
Use generic parameters.
Definition: Storage.hpp:97
virtual enum eGetItem getItems(const OpenAB::PIMItem::IDs &ids, std::vector< OpenAB::SmartPtr< OpenAB::PIMItem > > &items)=0
Get the items from the Storage.
std::string ID
Definition: PIMItem.hpp:64
Failure during the operation.
Definition: Storage.hpp:166
virtual OpenAB_Storage::Storage::eGetSyncToken getLatestSyncToken(std::string &token)=0
If storage supports tracking of items changes, it returns latest status identifier of the storage...
Generic storage for plugin parameters. Allows to store map of parameters with different types (OpenAB...
Definition: GenericParameters.hpp:25
eRemoveItem
Definition: Storage.hpp:201
virtual enum eGetItemRet getItem(OpenAB::SmartPtr< OpenAB::PIMItem > &item)=0
Gets PIM Item from Source. If Source is suspended getItem() should block until Source will be resumed...