contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/ccontentmap.h
changeset 93 82b66994846c
parent 92 782e3408c2ab
child 94 dbb8300717f7
equal deleted inserted replaced
92:782e3408c2ab 93:82b66994846c
     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:  CContentMap - class used in Content Publisher
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef C_CONTENTMAP_H
       
    19 #define C_CONTENTMAP_H
       
    20 
       
    21 #include "cpliwmap.h"
       
    22 
       
    23 // CLASS DECLARATION
       
    24 /**
       
    25  *  Map which contains ids and serialized data stored by 
       
    26  * 	Content Publisher
       
    27  *
       
    28  *  @lib cputils.dll
       
    29  *  @since S60 v5.0
       
    30  */
       
    31 NONSHARABLE_CLASS( CContentMap ): public CCPLiwMap
       
    32     {
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Two-phased constructor.
       
    37      */
       
    38     IMPORT_C static CContentMap* NewL( );
       
    39 
       
    40     /**
       
    41      * Two-phased constructor.
       
    42      */
       
    43     IMPORT_C static CContentMap* NewLC( );
       
    44 
       
    45     /**
       
    46      * Destructor.
       
    47      */
       
    48     virtual ~CContentMap();
       
    49 
       
    50         
       
    51 private:
       
    52 
       
    53     /**
       
    54      * Adds to database current content
       
    55      *  
       
    56      * @param aSqlDb handle to database
       
    57      * @param aNotificationList list of notifications to fill in when 
       
    58      *        something was actually changed in dataabse
       
    59      *
       
    60      * @return id of added entry
       
    61      */
       
    62 	TInt32 AddL( RSqlDatabase aSqlDb,
       
    63             CLiwDefaultList* aNotificationList = NULL ) const;
       
    64 
       
    65     /**
       
    66      * Fetches entries from database
       
    67      *  
       
    68      * @param aSqlDb handle to database
       
    69      * @param aList target list for enntries
       
    70      * @param aItemsToDelete ids of entries for removal - 
       
    71      *        they were found to be expired
       
    72      *
       
    73      * @return number of fetched entries
       
    74      */
       
    75     TUint GetListL( RSqlDatabase aSqlDb,
       
    76             CLiwGenericParamList* aList,
       
    77             RArray<TInt32>& aItemsToDelete ) const;
       
    78 
       
    79     /**
       
    80      * Removes entries from database
       
    81      *  
       
    82      * @param aSqlDb handle to database
       
    83      * @param aNotificationList list of notifications to fill in when 
       
    84      *        something was actually changed in dataabse
       
    85      */
       
    86     void RemoveL( RSqlDatabase aSqlDb ,
       
    87             CLiwDefaultList* aNotificationList = 0 ) const;
       
    88     
       
    89     /**
       
    90      * Saves results from query to SQLite Server
       
    91      *  
       
    92      * @param aStmt handle to SQL statement
       
    93      * @param aList target list for enntries
       
    94      * @param aItemsToDelete ids of entries for removal - 
       
    95      *        they were found to be expired
       
    96      */
       
    97     void SaveQueryResultsL( RSqlStatement& aStmt ,
       
    98             CLiwGenericParamList& aList,
       
    99             RArray<TInt32>& aItemsToDelete ) const;
       
   100     
       
   101     /**
       
   102      * Prepares SQL query for Add operation
       
   103      *
       
   104      * @param aSqlDb handle to database  
       
   105      * @param aStmt handle to SQL statement
       
   106      * @param aQuery SQL query
       
   107      *
       
   108      */
       
   109     void PrepareStmtforAddL(RSqlDatabase aSqlDb,
       
   110             RSqlStatement& aStmt ,
       
   111             const TDesC& aQuery ) const;
       
   112 
       
   113     /**
       
   114      * Prepares SQL query for Update operation
       
   115      *
       
   116      * @param aSqlDb handle to database  
       
   117      * @param aStmt handle to SQL statement
       
   118      * @param aId id of entry to update
       
   119      *
       
   120      */
       
   121     void PrepareStmtforUpdateL( RSqlDatabase aSqlDb,
       
   122             RSqlStatement& aStmt,
       
   123             TInt32 aId ) const;
       
   124     
       
   125     /**
       
   126      * Updates entry in database
       
   127      *  
       
   128      * @param aSqlDb handle to database
       
   129      * @param aId id entry to update
       
   130      * @param aNotificationList list of notifications to fill in when 
       
   131      *        something was actually changed in dataabse
       
   132      */
       
   133     void UpdateL( RSqlDatabase aSqlDb, TInt32 aId,
       
   134             CLiwDefaultList* aNotificationList ) const;
       
   135 
       
   136     /**
       
   137      * Performs actuall add operation
       
   138      *  
       
   139      * @param aSqlDb handle to database
       
   140      * @param aNotificationList list of notifications to fill in when 
       
   141      *        something was actually changed in dataabse
       
   142      *
       
   143      * @return id of added entry
       
   144      */
       
   145     TInt32 AddToDbL( RSqlDatabase aSqlDb,
       
   146             CLiwDefaultList* aNotificationList ) const;
       
   147 
       
   148     /**
       
   149      * Appends sorting criteria as strings to SQL query according to aSort
       
   150      *
       
   151      * @param aQuery SQL query
       
   152      * @param aSort sort filter as TInt
       
   153      */
       
   154     void AppendSortL( RBuf& aQuery, const TCPSortOrder& aSort ) const;
       
   155 
       
   156     /**
       
   157      * Checks expiration time
       
   158      * @param aExpirationTime time to checking with current time
       
   159      * @return true if aExpirationTime is correct
       
   160      */
       
   161     TBool IsOutdated( const TTime aExpirationTime ) const;
       
   162 
       
   163     /**
       
   164      * Check if data map is set
       
   165      *
       
   166      * @return ETrue if ContentType was set, EFalse if not
       
   167      */
       
   168     void IsDataMapL() const;
       
   169     
       
   170     /**
       
   171      * Gets expiration time from own data
       
   172      * @param aResult expiration date
       
   173      * @return ETrue if expiration date is find, EFalse if not 
       
   174      */
       
   175     TBool GetExpirationDateL( TTime& aResult ) const;
       
   176 
       
   177     /**
       
   178      * Check if IDs are valid for Delete operation
       
   179      *
       
   180      */
       
   181     void IsValidForDeleteL() const;
       
   182     
       
   183     /**
       
   184      * Check if IDs are valid for GetList operation
       
   185      */
       
   186     void IsValidForGetListL() const ;    
       
   187 
       
   188     /**
       
   189      *
       
   190      * @return ETrue if supported, EFalse if not
       
   191      */
       
   192     TBool ActivateActionSupport( ) const;      
       
   193     
       
   194 	/**
       
   195      *
       
   196      * @return ETrue if activate flag is set, EFalse if not
       
   197      */
       
   198 	TBool GetActivateInfo( ) const;
       
   199 	
       
   200 	                                              
       
   201 private:
       
   202 
       
   203     /**
       
   204      * C++ default constructor.
       
   205      */    
       
   206     CContentMap();
       
   207 
       
   208     /**
       
   209      * Perform the second phase construction of a CContentMap object.
       
   210      */        
       
   211     void ConstructL();
       
   212     
       
   213     };
       
   214 
       
   215 #endif // C_CONTENTMAP_H