Organizer Synchronous APIIntroductionThe Organizer Items Synchronous API enables a client to synchronously fetch, update, or remove item data from an item manager. A synchronous API is of most use to clients who wish to perform simple requests where user interface responsiveness is not critical. Synchronous calls to an item manager will block until they are completed, and therefore should not be performed in the GUI thread (especially if the manager is a frontend to an online service or long-latency datastore). The main advantage of the synchronous API is its simplicity and convenience. Most operations which may be performed using the synchronous API may also be performed using the asynchronous API. It is recommended for most applications that the asynchronous API be used where possible. Using The APIThe synchronous API offered by the Organizer Items module is available through the QOrganizerManager class. It consists of two major categories:
Organizer Item ManipulationThe most common type of operation that clients will perform involves retrieval or modification of organizer items. For in-depth information about item manipulation, please refer to the main C++ Organizer API page. The QOrganizerManager class provides API for accessing the IDs of items which are stored in the manager: The synchronous, singular item manipulation functions offered by the QOrganizerManager class are: The synchronous, batch item manipulation functions offered by the QOrganizerManager class are:
Item Collection ManipulationEvery item is saved in a collection in a manager. Each collection has various properties which, if the manager supports such operations, may be modified by clients. For in-depth information about collections, please refer to the main C++ Organizer API page. The synchronous API offers the following functions to manipulate collections:
It also offers a convenience function which returns a collection with a given collection id. Error ReportingWhen a synchronous operation fails, clients need to be able to retrieve error information associated with that synchronous operation. You can call the QOrganizerManager::error() function directly after a failing synchronous operation to determine why it failed. For some synchronous operations (for example, batch save or remove operations) it is possible that multiple errors may occur during the operation. In those cases, clients can call QOrganizerManager::errorMap() to retrieve a map of input index to error, which will be filled by the function as required. The QOrganizerManager::error() function will report the overall operation error. |