javaextensions/pim/common/inc.s60/mpimeventlistadapter.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Access interface to native Event database.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPIMEVENTLISTADAPTER_H
       
    20 #define MPIMEVENTLISTADAPTER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "pimcommon.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MPIMListAdapter;
       
    27 class MPIMEventItem;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32  *  To-do list adapter creates, reads, writes and removes event items
       
    33  *  in a native database. See also \ref MPIMListAdapter class description.
       
    34  */
       
    35 class MPIMEventListAdapter
       
    36 {
       
    37 public:
       
    38     // Destructor
       
    39 
       
    40     /**
       
    41      * Destructor.
       
    42      */
       
    43     virtual ~MPIMEventListAdapter()
       
    44     {
       
    45     }
       
    46 
       
    47 public:
       
    48     // New functions
       
    49 
       
    50     /**
       
    51      * Provides access to the \ref MPIMListAdapter representation of this
       
    52      * MPIMContactListAdapter object.
       
    53      *
       
    54      * @return The \ref MPIMListAdapter representation of the specialized
       
    55      *         list adapter.
       
    56      */
       
    57     virtual MPIMListAdapter* GetPimListAdapter() = 0;
       
    58 
       
    59     /**
       
    60      * Creates a new event item in the native database.
       
    61      * The adapter creates a new native database entry, sets its data
       
    62      * according to the data in \a aEventItem, adds it to the database
       
    63      * and sets the Item ID of \a aEventItem. \a aEventItem must
       
    64      * contain valid data and have Item ID \ref KPIMNullItemID.
       
    65      *
       
    66      * @param aEventItem The event item to add to the database.
       
    67      *
       
    68      * @par Leaving:
       
    69      * @li KErrAbort - The item lacks some vital data that
       
    70      *     cannot be replaced with a default value.
       
    71      * @li Other - The list adapter is non-functional.
       
    72      */
       
    73     virtual void CreateEventItemL(MPIMEventItem& aEventItem) = 0;
       
    74 
       
    75     /**
       
    76      * Reads an existing event item from the native database.
       
    77      * The adapter maps the Item ID in \a aEventItem to a native database
       
    78      * entry identifier, reads the entry and sets the data of
       
    79      * \a aEventItem according to the data in the native entry.
       
    80      * \a aEventItem must have valid Item ID that corresponds to an
       
    81      * existing native database entry.
       
    82      *
       
    83      * @param aEventItem The event item to be read from the database.
       
    84      *
       
    85      * @par Leaving:
       
    86      * The method leaves on error. Error codes should be interpreted as
       
    87      * follows:
       
    88      * @li \c KErrArgument - The Item ID of \a aEventItem is
       
    89      *        \ref KPIMNullItemID and thus invalid.
       
    90      * @li \c KErrNotFound - No corresponding native database entry could
       
    91      *        be retrieved, although the Item ID of \a aEventItem is not
       
    92      *        \ref KPIMNullItemID. The entry is probably removed from the
       
    93      *        native database.
       
    94      * @li Other - The list adapter is non-functional.
       
    95      */
       
    96     virtual void ReadEventItemL(MPIMEventItem& aEventItem) = 0;
       
    97 
       
    98     /**
       
    99      * Writes an existing event item to the native database.
       
   100      * The adapter maps the Item ID in \a aEventItem to a native database
       
   101      * entry identifier, reads the entry and sets the data of the entry
       
   102      * according to the data in \a aEventItem. \a aEventItem must have
       
   103      * valid Item ID that corresponds to an existing native database entry.
       
   104      *
       
   105      * @param aEventItem The event item to write to the database.
       
   106      *
       
   107      * @par Leaving:
       
   108      * The method leaves on error. Error codes should be interpreted as
       
   109      * follows:
       
   110      * @li \c KErrArgument - The Item ID of \a aEventItem is
       
   111      *        \ref KPIMNullItemID and thus invalid.
       
   112      * @li \c KErrNotFound - No corresponding native database entry could
       
   113      *        be retrieved, although the Item ID of \a aEventItem is not
       
   114      *        \ref KPIMNullItemID. The entry is probably removed from the
       
   115      *        native database.
       
   116      * @li \c KErrInUse - The entry is currently in use by some other
       
   117      *        client. The operation may succeed later.
       
   118      * @li KErrAbort - The item lacks some vital data that
       
   119      *     cannot be replaced with a default value.
       
   120      * @li Other - The list adapter is non-functional.
       
   121      */
       
   122     virtual void WriteEventItemL(MPIMEventItem& aEventItem) = 0;
       
   123 
       
   124     /**
       
   125      * Removes an existing event from the native database.
       
   126      * The adapter maps \a aItemID to a native database entry and removes
       
   127      * it.
       
   128      *
       
   129      * @param aItemID Item ID of the item to be removed.
       
   130      *
       
   131      * @par Leaving:
       
   132      * @li \c KErrArgument - \a aItemID is \ref KPIMNullItemID and thus
       
   133      *        invalid.
       
   134      * @li \c KErrNotFound - No native Agenda Model entry could be retrieved
       
   135      *        by \a aItemID. The entry is probably already removed.
       
   136      * @li \c KErrInUse - The entry is currently in use by some other
       
   137      *        client. The operation may succeed later.
       
   138      * @li Other - The list adapter is non-functional.
       
   139      */
       
   140     virtual void RemoveEventItemL(TPIMItemID aItemID) = 0;
       
   141 
       
   142 protected:
       
   143     // Non-public operations
       
   144 
       
   145     // Allow derivation with protected default constructor.
       
   146     MPIMEventListAdapter()
       
   147     {
       
   148     }
       
   149 
       
   150 private:
       
   151     // Prohibited operations
       
   152 
       
   153     // Prohibit copy constructor.
       
   154     MPIMEventListAdapter(const MPIMEventListAdapter&)
       
   155     {
       
   156     }
       
   157 
       
   158     // Prohibit assigment operator.
       
   159     MPIMEventListAdapter& operator=(const MPIMEventListAdapter&)
       
   160     {
       
   161         return *this;
       
   162     }
       
   163 
       
   164 };
       
   165 
       
   166 #endif // MPIMEVENTLISTADAPTER_H
       
   167 // End of File
       
   168