|
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: Interface for CA database implementations |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CASTORAGEPROXY_H |
|
19 #define CASTORAGEPROXY_H |
|
20 |
|
21 #include "caoperationparams.h" |
|
22 |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class CCaStorage; |
|
26 class CCaInnerQuery; |
|
27 class CCaInnerEntry; |
|
28 class CCaLocalizationEntry; |
|
29 class MCaSessionNorifier; |
|
30 |
|
31 /** |
|
32 * Interface for CA database implementations. |
|
33 * |
|
34 */ |
|
35 class CCaStorageProxy: public CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 */ |
|
42 static CCaStorageProxy* NewL(); |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CCaStorageProxy* NewLC(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CCaStorageProxy(); |
|
53 |
|
54 /** |
|
55 * Localizes one entry attribute |
|
56 * |
|
57 * @param aLocalization information about one localization row. |
|
58 */ |
|
59 IMPORT_C void LocalizeEntryL( CCaLocalizationEntry& aLocalization ); |
|
60 |
|
61 /** |
|
62 * Fetches localization data from database |
|
63 * |
|
64 * @param aResultContainer Target for results. |
|
65 */ |
|
66 IMPORT_C void GetLocalizationsL( |
|
67 RPointerArray<CCaLocalizationEntry>& aResultContainer ); |
|
68 |
|
69 /** |
|
70 * Fetches data from storage. |
|
71 * @param aQuery Query filter for entries to be fetched. |
|
72 * @param aResult Result entry container. |
|
73 */ |
|
74 IMPORT_C void GetEntriesL( const CCaInnerQuery* aQuery, |
|
75 RPointerArray<CCaInnerEntry>& aResultContainer ); |
|
76 |
|
77 /** |
|
78 * Fetches entry ids from storage. |
|
79 * @param aQuery Query filter for entries' ids to be fetched. |
|
80 * @param aResultIdArray Result entry id array. |
|
81 */ |
|
82 IMPORT_C void GetEntriesIdsL( const CCaInnerQuery* aQuery, |
|
83 RArray<TInt>& aResultIdArray ); |
|
84 |
|
85 /** |
|
86 * Adds or Updates data to storage. |
|
87 * In case when data is added the input aEntry serves |
|
88 * also as an output entry. |
|
89 * @param aEntry Entry data. |
|
90 * @param aUpdate is entry updated by a client |
|
91 */ |
|
92 IMPORT_C void AddL( CCaInnerEntry* aEntry, TBool aUpdate = EFalse ); |
|
93 |
|
94 /** |
|
95 * Removes entries from storage. |
|
96 * @param aEntryIds Ids of entries to be removed. |
|
97 */ |
|
98 IMPORT_C void RemoveL( const RArray<TInt>& aEntryIds ); |
|
99 |
|
100 /** |
|
101 * Organizes entries in storage. |
|
102 * @param aEntryIds Entry ids to be organized |
|
103 * (insert, remove, append, prepend are possible). |
|
104 * @param aParams Organize parameters. |
|
105 */ |
|
106 IMPORT_C void OrganizeL( const RArray<TInt>& aEntryIds, |
|
107 TCaOperationParams aParams ); |
|
108 |
|
109 /** |
|
110 * Executes touch specific actions on storage. |
|
111 * Should be called when e.g. entry is clicked. |
|
112 * @param aEntry entry to be touched |
|
113 */ |
|
114 IMPORT_C void TouchL( CCaInnerEntry* aEntry ); |
|
115 |
|
116 /** |
|
117 * Get database property on storage. |
|
118 * |
|
119 * @param aProperty The property to get. |
|
120 * @param aPropertyValue The value of property. |
|
121 */ |
|
122 IMPORT_C void DbPropertyL( const TDesC& aProperty, TDes& aPropertyValue ); |
|
123 |
|
124 /** |
|
125 * Set property action on storage. |
|
126 * |
|
127 * @param aProperty The property to set. |
|
128 * @param aPropertyValue The value of property. |
|
129 */ |
|
130 IMPORT_C void SetDBPropertyL( const TDesC& aProperty, |
|
131 const TDesC& aPropertyValue ); |
|
132 |
|
133 /** |
|
134 * Organizes data within a group in custom order in storage. |
|
135 * |
|
136 * @param aEntryIds Ids of entries in custom order. |
|
137 * @param aGroupId Group to sort. |
|
138 */ |
|
139 IMPORT_C void CustomSortL( const RArray<TInt>& aEntryIds, |
|
140 const TInt aGroupId ); |
|
141 |
|
142 /** |
|
143 * Loads data base from rom. |
|
144 */ |
|
145 IMPORT_C void LoadDataBaseFromRomL(); |
|
146 |
|
147 /** |
|
148 * Add a session. Ownership not taken, this object only keeps a list of |
|
149 * sessions that are dependent on its engine. |
|
150 * @param aSession Session. |
|
151 */ |
|
152 void AddSessionL( MCaSessionNorifier* aHandlerNotifier ); |
|
153 |
|
154 /** |
|
155 * Remove a session. Safe to call if not added. |
|
156 * When no more sessions remain dependent on this object, timed |
|
157 * self-deletion is scheduled. |
|
158 */ |
|
159 void RemoveSession( MCaSessionNorifier* aHandlerNotifier ); |
|
160 |
|
161 private: |
|
162 |
|
163 /** |
|
164 * Perform the second phase construction of a CCpStorageEngine object. |
|
165 */ |
|
166 void ConstructL(); |
|
167 |
|
168 /** |
|
169 * C++ default constructor. |
|
170 */ |
|
171 CCaStorageProxy(); |
|
172 |
|
173 private: |
|
174 //Data |
|
175 |
|
176 /** |
|
177 * Data storage. Own. |
|
178 */ |
|
179 CCaStorage* iStorage; |
|
180 |
|
181 /** |
|
182 * Sessions using this engine. Own. |
|
183 */ |
|
184 RPointerArray<MCaSessionNorifier> iHandlerNotifier; |
|
185 }; |
|
186 |
|
187 #endif //CASTORAGEPROXY_H |