|
1 /* |
|
2 * Copyright (c) 2007 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: Contains CNcdSubscriptionDataCompleterDataCompleter class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_SUBSCRIPTION_DATA_COMPLETER_H |
|
20 #define NCD_SUBSCRIPTION_DATA_COMPLETER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bamdesca.h> |
|
24 |
|
25 class CNcdSubscriptionManager; |
|
26 class CNcdNodeIdentifier; |
|
27 class MNcdSubscriptionManagerObserver; |
|
28 class CNcdNodeManager; |
|
29 class CNcdSubscription; |
|
30 class CNcdNodeMetaData; |
|
31 class CNcdOperationManager; |
|
32 class MCatalogsContext; |
|
33 |
|
34 /** |
|
35 * This server side class contains the functionality to complete |
|
36 * the data of subscriptions whose data is incomplete. |
|
37 * |
|
38 * |
|
39 * @lib ?library |
|
40 * @since S60 ?S60_version *** for example, S60 v3.0 |
|
41 */ |
|
42 class CNcdSubscriptionDataCompleter : public CBase |
|
43 { |
|
44 |
|
45 public: |
|
46 /** |
|
47 * NewL |
|
48 * |
|
49 * @param aManager Reference to subscription manager which started |
|
50 * this completer. |
|
51 * @param aNodeManager Reference to node manager. |
|
52 * @param aOperationManager Reference to operation manager. |
|
53 * @return CNcdSubscriptionDataCompleter* Pointer to the |
|
54 * created object of this class. |
|
55 */ |
|
56 static CNcdSubscriptionDataCompleter* NewL( |
|
57 CNcdSubscriptionManager& aSubscriptionManager, |
|
58 CNcdNodeManager& aNodeManager, |
|
59 CNcdOperationManager& aOperationManager ); |
|
60 |
|
61 /** |
|
62 * NewLC |
|
63 * |
|
64 * @param aManager Reference to subscription manager which started |
|
65 * this completer. |
|
66 * @param aNodeManager Reference to node manager. |
|
67 * @param aOperationManager Reference to operation manager. |
|
68 * @return CNcdSubscriptionDataCompleter* Pointer to the |
|
69 * created object of this class. |
|
70 */ |
|
71 static CNcdSubscriptionDataCompleter* NewLC( |
|
72 CNcdSubscriptionManager& aSubscriptionManager, |
|
73 CNcdNodeManager& aNodeManager, |
|
74 CNcdOperationManager& aOperationManager ); |
|
75 |
|
76 /** |
|
77 * Destructor |
|
78 * |
|
79 */ |
|
80 virtual ~CNcdSubscriptionDataCompleter(); |
|
81 |
|
82 /** |
|
83 * Function for checking that subscriptions of given goups have |
|
84 * all needed data and if not get the data from the corresponding |
|
85 * nodes. Does also the needed callback of observer and notifying |
|
86 * of subscription manager's listeners |
|
87 * |
|
88 * @note Given groups are thought to be obtained from one server |
|
89 * |
|
90 * @param aClientUid Id of the client that should be notified |
|
91 * of subscription manager content change. |
|
92 * @param aNodeIds Identifiers of nodes which were used to buy |
|
93 * the subscriptions. |
|
94 * @param aPurchaseOptionIDs Purchase option ids which were |
|
95 * used to buy the subscriptions. |
|
96 * @param aContext Not used. |
|
97 * @param aObserver Observer that is informed of internalisation |
|
98 * completion. |
|
99 * @return Symbian error code. |
|
100 */ |
|
101 TInt CompleteSubscriptions( TUid aClientUid, |
|
102 RPointerArray<CNcdNodeIdentifier> aNodeIds, |
|
103 MDesCArray* aPurchaseOptionIDs, |
|
104 MCatalogsContext* aContext, |
|
105 MNcdSubscriptionManagerObserver* aObserver ); |
|
106 |
|
107 protected: |
|
108 |
|
109 /** |
|
110 * Constructor |
|
111 * Is set in the NewLC function. |
|
112 * @param aSubscriptionManager Reference to subscription manager |
|
113 * which started this completer. |
|
114 * @param aNodeManager Reference to node manager. |
|
115 * @param aOperationManager Reference to operation manager. |
|
116 */ |
|
117 CNcdSubscriptionDataCompleter( |
|
118 CNcdSubscriptionManager& aSubscriptionManager, |
|
119 CNcdNodeManager& aNodeManager, |
|
120 CNcdOperationManager& aOperationManager ); |
|
121 |
|
122 /** |
|
123 * ConstructL |
|
124 */ |
|
125 virtual void ConstructL(); |
|
126 |
|
127 |
|
128 |
|
129 private: |
|
130 |
|
131 // Prevent these two if they are not implemented |
|
132 CNcdSubscriptionDataCompleter( |
|
133 const CNcdSubscriptionDataCompleter& aObject ); |
|
134 CNcdSubscriptionDataCompleter& |
|
135 operator=( const CNcdSubscriptionDataCompleter& aObject ); |
|
136 |
|
137 void ProceedCompletion(); |
|
138 |
|
139 /** |
|
140 * Function for completing given subscription from the given node. |
|
141 * Also saves updated node to database. |
|
142 * |
|
143 * @param aCurrentSubscription Subscription to update. |
|
144 * @param aCurrentNode Node which should be used in the completion. |
|
145 * @param aPurchaseOptionId Purchase option id which was |
|
146 * used to buy the subscription. |
|
147 * @param aClientUid Uid of the client whose subscription we |
|
148 * are updating. |
|
149 */ |
|
150 void CompleteSubscriptionL( CNcdSubscription& aCurrentSubscription, |
|
151 const CNcdNodeMetaData& aCurrentNodeMetaData, |
|
152 const TDesC& aPurchaseOptionId, |
|
153 TUid aClientUid ) const; |
|
154 |
|
155 /** |
|
156 * Returns identified subscription if found. |
|
157 * |
|
158 * @param aNodeIdentifier Identifier of the node which was used |
|
159 * to buy the subscription. |
|
160 * @param aPurchaseOptionId Purchase option id which was |
|
161 * used to buy the subscription. |
|
162 */ |
|
163 CNcdSubscription& SubscriptionL( |
|
164 const CNcdNodeIdentifier& aNodeIdentifier, |
|
165 const TDesC& aPurchaseOptionId ) const; |
|
166 |
|
167 /** |
|
168 * Function for checking whether given subscription is incomplete |
|
169 * or not. |
|
170 * |
|
171 * @param aSubscription Subscription to check. |
|
172 */ |
|
173 TBool SubscriptionIncomplete( |
|
174 const CNcdSubscription& aSubscription ) const; |
|
175 |
|
176 /** |
|
177 * Function for setting name of the given subscription from |
|
178 * the purchase option of given metadata identified by the |
|
179 * purchase option id. |
|
180 * |
|
181 * @param aSubscription Subscription whose name has to be set. |
|
182 * @param aMetaData Meta data which contains purchase option |
|
183 * whose name is used as the name of the |
|
184 * subscription. |
|
185 * @param aPurchaseOptionId Purchase option whose name is |
|
186 * set to be the name of the subscription. |
|
187 */ |
|
188 void CompleteSubscriptionNameL( |
|
189 CNcdSubscription& aSubscription, |
|
190 const CNcdNodeMetaData& aMetaData, |
|
191 const TDesC& aPurchaseOptionId ) const; |
|
192 |
|
193 /** |
|
194 * Function for setting icon of the given subscription from |
|
195 * the given metadata. |
|
196 * |
|
197 * @param aSubscription Subscription whose icon has to be set. |
|
198 * @param aMetaData Meta data which contains the icon for the |
|
199 * subscription. |
|
200 */ |
|
201 void CompleteSubscriptionIconL( |
|
202 CNcdSubscription& aSubscription, |
|
203 const CNcdNodeMetaData& aMetaData ) const; |
|
204 |
|
205 private: // data |
|
206 |
|
207 /** |
|
208 * Reference to subscription manager which started this completer. |
|
209 */ |
|
210 CNcdSubscriptionManager& iSubscriptionManager; |
|
211 |
|
212 /** |
|
213 * Reference to node manager for node creation/retrieval purposes. |
|
214 */ |
|
215 CNcdNodeManager& iNodeManager; |
|
216 |
|
217 /** |
|
218 * Reference to operation manager for operation creation purposes. |
|
219 */ |
|
220 CNcdOperationManager& iOperationManager; |
|
221 |
|
222 /** |
|
223 * Client uid of the client that should be notified of |
|
224 * subscription manager state change after the internalization. |
|
225 */ |
|
226 TUid iClientUid; |
|
227 |
|
228 /** |
|
229 * Indexer to index subscriptions which are being completed. |
|
230 * Member variable to enable possible asynchronous operations. |
|
231 * (although such operations are not needed at the moment) |
|
232 */ |
|
233 TInt iIndexer; |
|
234 |
|
235 /** |
|
236 * Array of node ids identifying the nodes which contained |
|
237 * the purchase options which were used to buy the |
|
238 * subscriptions whose data should be completed. |
|
239 */ |
|
240 RPointerArray<CNcdNodeIdentifier> iNodeIds; |
|
241 |
|
242 /** |
|
243 * Array of purchase option ids which were used to buy the |
|
244 * subscriptions whose data should be completed. |
|
245 * Own. |
|
246 */ |
|
247 MDesCArray* iPurchaseOptionIds; |
|
248 |
|
249 /** |
|
250 * Not used at the moment. |
|
251 * Context to identify client if node loads would ever be |
|
252 * implemented here. |
|
253 * Not own. |
|
254 */ |
|
255 MCatalogsContext* iContext; |
|
256 |
|
257 /** |
|
258 * Observer that should be notified when internalization of |
|
259 * subscriptions has ended. |
|
260 * Not own. |
|
261 */ |
|
262 MNcdSubscriptionManagerObserver* iInternalizationObserver; |
|
263 |
|
264 |
|
265 }; |
|
266 |
|
267 #endif // NCD_SUBSCRIPTION_DATA_COMPLETER_H |