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