/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/



/*!

\page organizersync.html

\title Organizer Synchronous API

\tableofcontents


\section1 Introduction

The 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.


\section1 Using The API

The synchronous API offered by the Organizer Items module is available through the QOrganizerManager
class.  It consists of three major categories:
\list
  \o Organizer Item Manipulation
  \o Item Collection Manipulation
  \o Schema Manipulation
\endlist



\section2 Organizer Item Manipulation

The 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 \l{Organizer} API page.

The QOrganizerManager class provides API for accessing the IDs of items which are stored in the manager:
\list
  \o QOrganizerManager::itemIds()
\endlist

The synchronous, singular item manipulation functions offered by the QOrganizerManager class are:
\list
  \o QOrganizerManager::item()
  \o QOrganizerManager::saveItem()
  \o QOrganizerManager::removeItem()
\endlist

The synchronous, batch item manipulation functions offered by the QOrganizerManager class are:
\list
  \o QOrganizerManager::items() which returns persistent and generated items within a given time period
  \o QOrganizerManager::itemsForExport() which returns only persistent items
  \o QOrganizerManager::itemOccurrences() which returns the occurrences of a specific recurring item
  \o QOrganizerManager::saveItems() which may be used to update a recurring item, or save an exceptional occurrence
  \o QOrganizerManager::removeItems() which may be used to remove a recurring item or exceptional occurrence
\endlist


\section2 Item Collection Manipulation

Every 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 \l{Organizer} API page.

The synchronous API offers the following functions to manipulate collections:
\list
  \o QOrganizerManager::defaultCollection() returns the default collection of the manager
  \o QOrganizerManager::collections() returns all collections in the manager
  \o QOrganizerManager::saveCollection() updates an existing collection or adds a new collection
  \o QOrganizerManager::removeCollection() removes an existing collection (and deletes any items it contains)
\endlist

It also offers a convenience function which returns a collection with a given collection id.

\section2 Schema Manipulation

The schema supported by a engine is the list of detail definitions which are
supported by the engine.  For in-depth information about the schema, please
refer to the main \l{Qt Organizer Schema} page.

The synchronous API offers several functions to retrieve or modify the schema
supported by an engine.  Engines which support these types of operations must
report to clients that they support the QOrganizerManager::MutableDefinitions
feature.
\list
  \o QOrganizerManager::detailDefinitions() returns all definitions in the schema for a particular item type
  \o QOrganizerManager::detailDefinition() returns the definition of a particular name from the schema for a particular item type
  \o QOrganizerManager::saveDetailDefinition() which updates or adds a definition to the schema for a particular item type
  \o QOrganizerManager::removeDetailDefinition() which removes a definition from the schema for a particular item type
\endlist


\section2 Error Reporting

When 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.

*/

