|
1 /* |
|
2 * Copyright (c) 2005-2009 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: Metadata engine client session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDESESSION_H__ |
|
20 #define __MDESESSION_H__ |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 |
|
26 #include <mdccommon.h> |
|
27 |
|
28 |
|
29 /* Forward declarations. */ |
|
30 class CMdESession; |
|
31 class CMdEObjectDef; |
|
32 class CMdERelationDef; |
|
33 class CMdEEventDef; |
|
34 class CMdEObject; |
|
35 class TMdEObject; |
|
36 class CMdERelation; |
|
37 class TMdERelation; |
|
38 class CMdEEvent; |
|
39 class CMdEObjectQuery; |
|
40 class CMdERelationQuery; |
|
41 class CMdEEventQuery; |
|
42 class CMdELogicCondition; |
|
43 class CMdEInstanceItem; |
|
44 class MMdEQueryObserver; |
|
45 class CMdENamespaceDef; |
|
46 class RMdEDataBuffer; |
|
47 class CMdECondition; |
|
48 |
|
49 |
|
50 |
|
51 /** |
|
52 * Observer interface for a metadata engine session. |
|
53 * |
|
54 * |
|
55 * |
|
56 * Examples of MdE session usage: |
|
57 * |
|
58 * The class that needs a MdE session needs to implement MMdESessionObserver interface to get |
|
59 * a notification of completed session opening or an error that has occurred. |
|
60 * |
|
61 * class CMdESessionExample : public MMdESessionObserver |
|
62 * { |
|
63 * void HandleSessionOpened(CMdESession& aSession, TInt aError); |
|
64 * void HandleSessionError(CMdESession& aSession, TInt aError); |
|
65 * ... |
|
66 * |
|
67 * CMdESession* iMdeSession; |
|
68 * }; |
|
69 * |
|
70 * The session is opened simply by creating an instance of CMdESession. |
|
71 * |
|
72 * void CMdESessionExample::OpenSession() |
|
73 * { |
|
74 * iMdeSession = CMdESession::NewL( *this ); |
|
75 * } |
|
76 * |
|
77 * void CMdESessionExample::HandleSessionOpened(CMdESession& aSession, TInt aError) |
|
78 * { |
|
79 * if ( KErrNone != aError ) { |
|
80 * // Error occurred when opening session. iMdeSession must be deleted and new |
|
81 * // session opened if we wish to use MdE. |
|
82 * |
|
83 * delete iMdeSession; iMdeSession = NULL; |
|
84 * return; |
|
85 * } |
|
86 * |
|
87 * // The session was opened successfully. |
|
88 * ... |
|
89 * } |
|
90 * |
|
91 * void CMdESessionError::HandleSessionError(CMdESession& aSession, TInt aError) |
|
92 * { |
|
93 * // This function is called when an error has occurred in the session by some |
|
94 * // external source (e.g. other clients). It’s important to notice, that |
|
95 * // this method is called when the session has already been opened, not when |
|
96 * // error happens during opening. Session can't be used anymore and it must be deleted. |
|
97 * |
|
98 * delete iMdeSession; iMdeSession = NULL; |
|
99 * } |
|
100 */ |
|
101 class MMdESessionObserver |
|
102 { |
|
103 public: |
|
104 |
|
105 /** |
|
106 * Called to notify the observer that opening the session has been |
|
107 * completed and, if the opening succeeded, the session is ready for use. |
|
108 * |
|
109 * @param aSession session |
|
110 * @param aError <code>KErrNone</code>, if opening the session succeeded; |
|
111 * or one of the system-wide error codes, if opening the |
|
112 * session failed |
|
113 */ |
|
114 virtual void HandleSessionOpened(CMdESession& aSession, TInt aError) = 0; |
|
115 |
|
116 /** |
|
117 * Called to notify the observer about errors, which are not a direct |
|
118 * consequence of the operations initiated by the client but caused by |
|
119 * some external source (e.g., other clients). The error cannot be |
|
120 * recovered and all on-going operations initiated by the client have been |
|
121 * aborted. Any attempts to continue using the session will cause a panic. |
|
122 * The client should close the session immediately and try to open a new |
|
123 * session, if it needs to continue using the metadata engine. |
|
124 * |
|
125 * @param aSession session |
|
126 * @param aError one of the system-wide error codes |
|
127 */ |
|
128 virtual void HandleSessionError(CMdESession& aSession, TInt aError) = 0; |
|
129 }; |
|
130 |
|
131 |
|
132 /** |
|
133 * Observer interface for modifications of the metadata engine schema. |
|
134 */ |
|
135 class MMdESchemaObserver |
|
136 { |
|
137 public: |
|
138 |
|
139 /** |
|
140 * Called to notify the observer that the schema has been modified. |
|
141 * |
|
142 * @param none |
|
143 */ |
|
144 virtual void HandleSchemaModified() = 0; |
|
145 }; |
|
146 |
|
147 /** |
|
148 * Observer interface for modifications of the objects in the metadata engine |
|
149 * database. |
|
150 * |
|
151 * Examples of observers. |
|
152 * A class that is interested in observing events in the DB must implement observer interfaces |
|
153 * and register as observer. Following examples show how this is done for objects but observing |
|
154 * relations and events works the same way. |
|
155 * |
|
156 * class CMdeObserverExample : public MMdEObjectObserver, public MMdEObjectPresentObserver |
|
157 * { |
|
158 * void HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, |
|
159 * const RArray<TItemId>& aObjectIdArray); |
|
160 * void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, |
|
161 * const RArray<TItemId>& aObjectIdArray); |
|
162 * ... |
|
163 * CMdESession* iMdeSession; |
|
164 * }; |
|
165 * |
|
166 * void CMdeObserverExample::ConstructL() |
|
167 * { |
|
168 * // Register this class as observer and start listening to object remove events. |
|
169 * // The logic condition can be as complicated as is necessary. In this example |
|
170 * // the condition as simple as possible. |
|
171 * CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); |
|
172 * iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, |
|
173 * &iMdeSession->GetDefaultNamespaceDefL() ); |
|
174 * |
|
175 * // Start listening to changes in object present status. |
|
176 * iMdeSession->AddObjectPresentObserverL( *this ); |
|
177 * } |
|
178 * |
|
179 * @see MMdEObjectObserver::HandleObjectNotification |
|
180 * void CMdeObserverExample::HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, |
|
181 * const RArray<TItemId>& aObjectIdArray) |
|
182 * { |
|
183 * if ( aType == ENotifyAdd ) |
|
184 * { |
|
185 * // object was added to DB |
|
186 * } else if ( aType == ENotifyModify ) |
|
187 * { |
|
188 * // object was modified |
|
189 * } else if ( aType == ENotifyRemove ) |
|
190 * { |
|
191 * // object was removed from DB |
|
192 * } |
|
193 * |
|
194 * // aObjectIdArray contains ids for all objects that were added/modified/removed |
|
195 * } |
|
196 * |
|
197 * void CMdeObserverExample::HandleObjectPresentNotification(CMdESession& aSession, |
|
198 * TBool aPresent, const RArray<TItemId>& aObjectIdArray) |
|
199 * { |
|
200 * if ( aPresent ) |
|
201 * { |
|
202 * // objects in aObjectIdArray were set as present |
|
203 * } |
|
204 * } |
|
205 */ |
|
206 class MMdEObjectObserver |
|
207 { |
|
208 public: |
|
209 |
|
210 /** |
|
211 * Called to notify the observer that new objects has been |
|
212 * added/modified/removed in the metadata engine database. |
|
213 * |
|
214 * @param aSession session |
|
215 * @param aType defines if object was added/modified/remove |
|
216 * @param aObjectIdArray IDs of added object |
|
217 * @see CMdESession::AddObjectObserverL |
|
218 * @see CMdELogicCondition |
|
219 */ |
|
220 virtual void HandleObjectNotification(CMdESession& aSession, |
|
221 TObserverNotificationType aType, |
|
222 const RArray<TItemId>& aObjectIdArray) = 0; |
|
223 }; |
|
224 |
|
225 class MMdEObjectObserverWithUri |
|
226 { |
|
227 public: |
|
228 |
|
229 /** |
|
230 * Called to notify the observer that new objects has been |
|
231 * added/modified/removed in the metadata engine database. |
|
232 * |
|
233 * @param aSession session |
|
234 * @param aType defines if object was added/modified/remove |
|
235 * @param aObjectIdArray IDs of added object |
|
236 * @param aUriArray Uris of added object |
|
237 * @see CMdESession::AddObjectObserverL |
|
238 * @see CMdELogicCondition |
|
239 */ |
|
240 virtual void HandleUriObjectNotification(CMdESession& aSession, |
|
241 TObserverNotificationType aType, |
|
242 const RArray<TItemId>& aObjectIdArray, |
|
243 const RPointerArray<HBufC>& aObjectUriArray) = 0; |
|
244 }; |
|
245 |
|
246 /** |
|
247 * Observer interface for modifications of the objects in the metadata engine |
|
248 * database. |
|
249 */ |
|
250 class MMdEObjectPresentObserver |
|
251 { |
|
252 public: |
|
253 |
|
254 /** |
|
255 * Called to notify the observer that objects has been set |
|
256 * to present or not present state in the metadata engine database. |
|
257 * |
|
258 * @param aSession session |
|
259 * @param aPresent state: ETrue - present or EFales - not present |
|
260 * @param aObjectIdArray object IDs which are set to present state |
|
261 */ |
|
262 virtual void HandleObjectPresentNotification(CMdESession& aSession, |
|
263 TBool aPresent, const RArray<TItemId>& aObjectIdArray) = 0; |
|
264 }; |
|
265 |
|
266 /** |
|
267 * Observer interface for modifications of the relations in the metadata |
|
268 * engine database. |
|
269 */ |
|
270 class MMdERelationPresentObserver |
|
271 { |
|
272 public: |
|
273 |
|
274 /** |
|
275 * Called to notify the observer that objects has been set |
|
276 * to present or not present state in the metadata engine database. |
|
277 * |
|
278 * @param aSession session |
|
279 * @param aPresent state: ETrue - present or EFales - not present |
|
280 * @param aObjectIdArray object IDs which are set to present state |
|
281 */ |
|
282 virtual void HandleRelationPresentNotification(CMdESession& aSession, |
|
283 TBool aPresent, const RArray<TItemId>& aRelationIdArray) = 0; |
|
284 }; |
|
285 |
|
286 |
|
287 /** |
|
288 * Observer interface for modifications of relations in the metadata engine |
|
289 * database. This observer returns only relations IDs. |
|
290 */ |
|
291 class MMdERelationObserver |
|
292 { |
|
293 public: |
|
294 |
|
295 /** |
|
296 * Called to notify the observer that new relations has been |
|
297 * added/modified/removed in the metadata engine database. |
|
298 * |
|
299 * @param aSession session |
|
300 * @param aType defines if relation was added/modified/remove |
|
301 * @param aRelationIdArray IDs of relations |
|
302 */ |
|
303 virtual void HandleRelationNotification(CMdESession& aSession, |
|
304 TObserverNotificationType aType, |
|
305 const RArray<TItemId>& aRelationIdArray) = 0; |
|
306 }; |
|
307 |
|
308 /** |
|
309 * Observer interface for modifications of relations in the metadata engine |
|
310 * database. This observer returns relations (not only IDs). |
|
311 */ |
|
312 class MMdERelationItemObserver |
|
313 { |
|
314 public: |
|
315 |
|
316 /** |
|
317 * Called to notify the observer that new relations has been |
|
318 * added/modified/removed in the metadata engine database. |
|
319 * |
|
320 * @param aSession session |
|
321 * @param aType if relation was added/modified/remove |
|
322 * @param aRelationArray relations |
|
323 */ |
|
324 virtual void HandleRelationItemNotification(CMdESession& aSession, |
|
325 TObserverNotificationType aType, |
|
326 const RArray<TMdERelation>& aRelationArray) = 0; |
|
327 }; |
|
328 |
|
329 /** |
|
330 * Observer interface for additions or removes of new events to the metadata |
|
331 * engine database. |
|
332 */ |
|
333 class MMdEEventObserver |
|
334 { |
|
335 public: |
|
336 |
|
337 /** |
|
338 * Called to notify the observer that new events has been |
|
339 * added or removed in the metadata engine database. |
|
340 * |
|
341 * @param aSession session |
|
342 * @param aType if event was added or removed |
|
343 * @param aEventIdArray IDs of added events |
|
344 */ |
|
345 virtual void HandleEventNotification(CMdESession& aSession, |
|
346 TObserverNotificationType aType, |
|
347 const RArray<TItemId>& aEventIdArray) = 0; |
|
348 |
|
349 }; |
|
350 |
|
351 /** |
|
352 * Metadata engine session. |
|
353 */ |
|
354 NONSHARABLE_CLASS(CMdESession) : public CBase |
|
355 { |
|
356 public: |
|
357 |
|
358 /* Constructors and destructor. */ |
|
359 |
|
360 /** |
|
361 * Opens a new metadata engine session. |
|
362 * |
|
363 * @param aObserver observer to notify when opening the session has been |
|
364 * completed |
|
365 * |
|
366 * @return metadata engine session |
|
367 */ |
|
368 IMPORT_C static CMdESession* NewL(MMdESessionObserver& aObserver); |
|
369 |
|
370 /** |
|
371 * Opens a new metadata engine session and leaves the session in the |
|
372 * cleanup stack. |
|
373 * |
|
374 * @param aObserver observer to notify when opening the session has been |
|
375 * completed |
|
376 * |
|
377 * @return metadata engine session |
|
378 */ |
|
379 IMPORT_C static CMdESession* NewLC(MMdESessionObserver& aObserver); |
|
380 |
|
381 /** |
|
382 * Destructor. |
|
383 */ |
|
384 virtual ~CMdESession(); |
|
385 |
|
386 /* Methods for managing namespace definitions. */ |
|
387 |
|
388 /** |
|
389 * Returns the number of namespace definitions. |
|
390 * |
|
391 * @return number of namespace definitions |
|
392 */ |
|
393 virtual TInt NamespaceDefCount() const = 0; |
|
394 |
|
395 /** |
|
396 * Returns the namespace definition at the specified index. |
|
397 * |
|
398 * @param aIndex index |
|
399 * |
|
400 * @return namespace definition |
|
401 */ |
|
402 virtual CMdENamespaceDef& NamespaceDefL(TInt aIndex) = 0; |
|
403 |
|
404 /** |
|
405 * Returns the namespace definition with the specified name. |
|
406 * |
|
407 * @param aName name |
|
408 * |
|
409 * @return namespace definition; or 0, if there is no object definition |
|
410 * with the specified name |
|
411 */ |
|
412 virtual CMdENamespaceDef& GetNamespaceDefL(const TDesC& aName) = 0; |
|
413 |
|
414 /* Returns the default namespace definition. |
|
415 * |
|
416 * @return the default namespace definition. |
|
417 */ |
|
418 virtual CMdENamespaceDef& GetDefaultNamespaceDefL() = 0; |
|
419 |
|
420 /** |
|
421 * Adds a new relation definition to namespace, |
|
422 * |
|
423 * Example: |
|
424 * void AddRelationL() |
|
425 * { |
|
426 * _LIT( TestRelation, "TestRelation" ); |
|
427 * TBuf <15> relname( TestRelation ); |
|
428 * iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, relname ); |
|
429 * } |
|
430 * |
|
431 * @param aNamespaceDef namespace definition to which relation belongs |
|
432 * @param aName relation definitions name |
|
433 */ |
|
434 virtual void AddRelationDefL(const CMdENamespaceDef &aNamespaceDef, |
|
435 const TDesC &aName) = 0; |
|
436 |
|
437 /** |
|
438 * Adds a new event definition to namespace. |
|
439 * |
|
440 * Example: |
|
441 * void AddEventDefL() |
|
442 * { |
|
443 * _LIT( TestEvent, "TestEvent" ); |
|
444 * TBuf <10> eventName( TestEvent ); |
|
445 * iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, eventName ); |
|
446 * } |
|
447 * |
|
448 * @param aNamespaceDef namespace definition to which event belongs |
|
449 * @param aName event definitions name |
|
450 */ |
|
451 virtual void AddEventDefL(const CMdENamespaceDef &aNamespaceDef, |
|
452 const TDesC &aName) = 0; |
|
453 |
|
454 /* Methods for managing objects. */ |
|
455 |
|
456 /** |
|
457 * Adds multiple instance items to metadata database. |
|
458 * The array contains the items, any other type than object, relation or |
|
459 * event causes a leave. |
|
460 * |
|
461 * @param aItems list of items to add |
|
462 * @return first item error |
|
463 */ |
|
464 virtual TInt AddItemsL( RPointerArray<CMdEInstanceItem>& aItems ) = 0; |
|
465 |
|
466 /** |
|
467 * Commits multiple instance items to metadata database. |
|
468 * The array contains the items, any other type than object, relation or |
|
469 * event causes a leave. |
|
470 * |
|
471 * @param aItems list of items to add |
|
472 * @return first item error |
|
473 */ |
|
474 virtual TInt UpdateItemsL( RPointerArray<CMdEInstanceItem>& aItems ) = 0; |
|
475 |
|
476 /** |
|
477 * Adds multiple instance items asynchronously to metadata database. |
|
478 * The array contains the items, any other type than object, relation or |
|
479 * event causes a leave. Returned serialized list of item IDs must be |
|
480 * deserialized with DeserializeItemsL method. |
|
481 * |
|
482 * Example: |
|
483 * class CExampleActiveObject : public CActive |
|
484 * { |
|
485 * void CActiveObject::AddItemsL(); |
|
486 * ... |
|
487 * RPointerArray<CMdEInstanceItem> iItems; |
|
488 * RMdEDataBuffer iResultBuffer; |
|
489 * }; |
|
490 * |
|
491 * void CExampleActiveObject::AddItemsL() |
|
492 * { |
|
493 * iMdeSession->AddItemsAsyncL( iItems, iStatus, iResultBuffer ); |
|
494 * SetActive(); |
|
495 * } |
|
496 * |
|
497 * When adding items is finished, RunL() will be called. |
|
498 * |
|
499 * @param aItems List of item to add. |
|
500 * @param aStatus Returns the result code after the asynchronous call |
|
501 * completes. |
|
502 * @param aSerializedItemIds Returned serialized list of item IDs. |
|
503 */ |
|
504 virtual void AddItemsAsyncL( |
|
505 RPointerArray<CMdEInstanceItem>& aItems, |
|
506 TRequestStatus& aStatus, |
|
507 RMdEDataBuffer& aSerializedItemIds) = 0; |
|
508 |
|
509 /** |
|
510 * Commits multiple instance items asynchronously to metadata database. |
|
511 * The array contains the items, any other type than object, relation or |
|
512 * event causes a leave. Returned serialized list of item IDs must be |
|
513 * deserialized with DeserializeItemsL method. |
|
514 * |
|
515 * Example: |
|
516 * class CExampleActiveObject : public CActive |
|
517 * { |
|
518 * void CActiveObject::UpdateItemsL(); |
|
519 * ... |
|
520 * RPointerArray<CMdEInstanceItem> iItems; |
|
521 * RMdEDataBuffer iResultBuffer; |
|
522 * }; |
|
523 * |
|
524 * void CExampleActiveObject::UpdateItemsL() |
|
525 * { |
|
526 * iMdeSession->UpdateItemsAsyncL( iItems, iStatus, iResultBuffer ); |
|
527 * SetActive(); |
|
528 * } |
|
529 * |
|
530 * @param aItems List of item to add. |
|
531 * @param aStatus Returns the result code after the asynchronous call |
|
532 * completes. |
|
533 * @param aSerializedItemIds Returned serialized list of item IDs. |
|
534 */ |
|
535 virtual void UpdateItemsAsyncL( |
|
536 RPointerArray<CMdEInstanceItem>& aItems, |
|
537 TRequestStatus& aStatus, |
|
538 RMdEDataBuffer& aSerializedItemIds ) = 0; |
|
539 |
|
540 /** |
|
541 * Constructs a new empty object. Note that the object is not inserted in |
|
542 * the database. The ownership of the new object is passed to the caller |
|
543 * (that is, the caller is responsible for deleting the object). |
|
544 * |
|
545 * Example: |
|
546 * _LIT( KObjectDef, "ObjectDefName" ); |
|
547 * TBuf<13> objDefStr( KObjectDef ); |
|
548 * CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); |
|
549 * CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr ); |
|
550 * CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, aUri ); |
|
551 * |
|
552 * @param aDef definition of the new object |
|
553 * @param aUri URI of the new object |
|
554 * @param aMediaId media ID of the new object (default 0) |
|
555 * |
|
556 * @return new object |
|
557 */ |
|
558 virtual CMdEObject* NewObjectL( CMdEObjectDef& aDef, const TDesC& aUri, |
|
559 TUint32 aMediaId = 0 ) = 0; |
|
560 |
|
561 /** |
|
562 * Constructs a new empty object and leaves it in the cleanup stack. |
|
563 * Note that the object is not inserted in the database. The ownership of |
|
564 * the new object is passed to the caller (that is, the caller is |
|
565 * responsible for deleting the object). |
|
566 * |
|
567 * Example: |
|
568 * _LIT( KObjectDef, "ObjectDefName" ); |
|
569 * TBuf<13> objDefStr( KObjectDef ); |
|
570 * CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); |
|
571 * CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr ); |
|
572 * CMdEObject* mdeObject = iMdESession->NewObjectLC( mdeObjectDef, aUri ); |
|
573 * |
|
574 * @param aDef definition of the new object |
|
575 * @param aUri URI of the new object |
|
576 * @param aMediaId media ID of the new object (default 0) |
|
577 * |
|
578 * @return new object |
|
579 */ |
|
580 virtual CMdEObject* NewObjectLC( CMdEObjectDef& aDef, const TDesC& aUri, |
|
581 TUint32 aMediaId = 0 ) = 0; |
|
582 |
|
583 /** |
|
584 * Adds the specified new object to metadata database. |
|
585 * aObject is modified so that it has the new item ID. |
|
586 * If object adding fails object's ID is KNoId, |
|
587 * otherwise object adding is successful. |
|
588 * |
|
589 * @param aObject object to be added |
|
590 * |
|
591 * @return item ID of the added object |
|
592 */ |
|
593 virtual TItemId AddObjectL(CMdEObject& aObject) = 0; |
|
594 |
|
595 /** |
|
596 * Adds multiple object items to the metadata engine database. |
|
597 * The array contains the object items. aObjects are modified |
|
598 * so that those has the new item IDs. If object adding fails |
|
599 * object's ID is KNoId, otherwise object adding is successful. |
|
600 * |
|
601 * @param aObjects list of objects to be added |
|
602 * @return first object error |
|
603 */ |
|
604 virtual TInt AddObjectsL(RPointerArray<CMdEObject>& aObjects) = 0; |
|
605 |
|
606 /** |
|
607 * Deserialize serialized list of item IDs |
|
608 * |
|
609 * @param aSerializedItemIds serialized list of item IDs |
|
610 * @param aResultObjects if not NULL object IDs are deserialized from |
|
611 * buffer to this ID array |
|
612 * @param aResultEvents if not NULL event IDs are deserialized from |
|
613 * buffer to this ID array |
|
614 * @param aResultRelations if not NULL relation IDs are deserialized |
|
615 * from buffer to this ID array |
|
616 * |
|
617 * @return error code of first failed item, if no errors KErrNone |
|
618 */ |
|
619 virtual TInt DeserializeIdsL( RMdEDataBuffer& aSerializedItemIds, |
|
620 RArray<TItemId>* aResultObjects = NULL, |
|
621 RArray<TItemId>* aResultEvents = NULL, |
|
622 RArray<TItemId>* aResultRelations = NULL ) = 0; |
|
623 |
|
624 /** |
|
625 * Deserialize serialized list of items |
|
626 * |
|
627 * @param aSerializedItems serialized list of items |
|
628 * @param aItems items are deserialized from buffer to this item array |
|
629 * |
|
630 * @return first item error |
|
631 */ |
|
632 virtual TInt DeserializeItemsL( RMdEDataBuffer& aSerializedItems, |
|
633 RPointerArray<CMdEInstanceItem>& aItems ) = 0; |
|
634 |
|
635 /** |
|
636 * Removes the object with the specified identifier from metadata database. |
|
637 * |
|
638 * @param aId identifier |
|
639 * @param aNamespaceDef namespace where object is removed, if NULL default |
|
640 * namespace is used |
|
641 * @return KNoId if removing has failed, otherwise removed object's ID |
|
642 */ |
|
643 virtual TItemId RemoveObjectL( TItemId aId, |
|
644 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
645 |
|
646 /** |
|
647 * Removes the object with the specified URI from metadata database. |
|
648 * |
|
649 * @param aUri URI |
|
650 * @param aNamespaceDef namespace from remove object, if NULL default |
|
651 * namespace is used |
|
652 * @return KNoId if removing has failed, otherwise removed object's ID |
|
653 */ |
|
654 virtual TItemId RemoveObjectL( const TDesC& aUri, |
|
655 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
656 |
|
657 /** |
|
658 * Removes the array of objects with the specified identifier from |
|
659 * metadata database. |
|
660 * |
|
661 * @param aId object IDs to be removed |
|
662 * @param aResult result array where succefully removed object IDs are |
|
663 * added (KNoId is added from those objects which removing |
|
664 * has failed) |
|
665 * @param aNamespaceDef namespace where object is removed, if NULL default |
|
666 * namespace is used |
|
667 * @return first item error |
|
668 */ |
|
669 virtual TInt RemoveObjectsL( |
|
670 const RArray<TItemId>& aId, RArray<TItemId>& aResult, |
|
671 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
672 |
|
673 /** |
|
674 * Removes the array of objects with the specified URI from metadata |
|
675 * database. |
|
676 * |
|
677 * @param aUri object URIs to be removed |
|
678 * @param aResult result array where succefully removed object IDs are |
|
679 * added (KNoId is added from those objects which removing |
|
680 * has failed) |
|
681 * @param aNamespaceDef namespace where object is removed, if NULL default |
|
682 * namespace is used |
|
683 * @return first item error |
|
684 */ |
|
685 virtual TInt RemoveObjectsL( |
|
686 const RPointerArray<TDesC>& aUri, RArray<TItemId>& aResult, |
|
687 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
688 |
|
689 /** |
|
690 * Asynchronously removes the array of objects with the specified |
|
691 * object IDs from metadata database. Returned serialized list of item IDs |
|
692 * must be deserialized with DeserializeIdsL method. |
|
693 * |
|
694 * @param aId object IDs to be removed |
|
695 * @param aStatus returns the result code after the asynchronous call |
|
696 * completes. |
|
697 * @param aSerializedObjectIds returned serialized list of object IDs |
|
698 * @param aNamespaceDef namespace where object is removed, if NULL default |
|
699 * namespace is used |
|
700 */ |
|
701 virtual void RemoveObjectsAsyncL( |
|
702 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
703 RMdEDataBuffer& aSerializedObjectIds, |
|
704 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
705 |
|
706 /** |
|
707 * Asynchronously removes the array of objects with the specified URI from |
|
708 * metadata database. Returned serialized list of item IDs must be |
|
709 * deserialized with DeserializeIdsL method. |
|
710 * |
|
711 * @param aUri object URIs to be removed |
|
712 * @param aStatus returns the result code after the asynchronous call |
|
713 * completes. |
|
714 * @param aSerializedObjectIds returned serialized list of object IDs |
|
715 * @param aNamespaceDef namespace where object is removed, if NULL default |
|
716 * namespace is used |
|
717 */ |
|
718 virtual void RemoveObjectsAsyncL( |
|
719 const RPointerArray<TDesC>& aUri, TRequestStatus& aStatus, |
|
720 RMdEDataBuffer& aSerializedObjectIds, |
|
721 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
722 |
|
723 /** |
|
724 * Returns the object with the specified ID and specified object |
|
725 * definition. |
|
726 * |
|
727 * Example: |
|
728 * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); |
|
729 * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
730 * CMdEObject* object = iSession->GetObjectL( aObjectId, imageObjDef ); |
|
731 * |
|
732 * @param aId object ID |
|
733 * @param aObjectDef object definition |
|
734 * |
|
735 * @return object or NULL, if there is no object with the specified |
|
736 * identifier in the metadata engine database |
|
737 */ |
|
738 virtual CMdEObject* GetObjectL( const TItemId aId, |
|
739 CMdEObjectDef& aObjectDef ) = 0; |
|
740 |
|
741 /** |
|
742 * Returns the object (object may contain only properties defined in |
|
743 * "Object") with the specified ID and specified namespace (if namespace |
|
744 * is NULL, the default namespace is used). |
|
745 * |
|
746 * @param aId object ID |
|
747 * @param aNamespaceDef namespace |
|
748 * |
|
749 * @return object or NULL, if there is no object with the specified |
|
750 * identifier in the metadata engine database |
|
751 */ |
|
752 virtual CMdEObject* GetObjectL( const TItemId aId, |
|
753 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
754 |
|
755 /** |
|
756 * Returns the object (object will contain all it's properties) |
|
757 * with the specified ID and specified namespace |
|
758 * (if namespace is NULL, the default namespace is used). |
|
759 * |
|
760 * @param aId object ID |
|
761 * @param aNamespaceDef namespace |
|
762 * |
|
763 * @return object or NULL, if there is no object with the specified |
|
764 * identifier in the metadata engine database |
|
765 */ |
|
766 virtual CMdEObject* GetFullObjectL( const TItemId aId, |
|
767 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
768 |
|
769 /** |
|
770 * Returns the object with the specified GUID and specified object |
|
771 * definition. |
|
772 * |
|
773 * Example: |
|
774 * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); |
|
775 * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
776 * CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890, imageObjDef ); |
|
777 * |
|
778 * @param aGuidHigh GUID high |
|
779 * @param aGuidLow GUID low |
|
780 * @param aObjectDef object definition |
|
781 * |
|
782 * @return object or NULL, if there is no object with the specified |
|
783 * identifier in the metadata engine database |
|
784 */ |
|
785 virtual CMdEObject* GetObjectL( |
|
786 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
787 CMdEObjectDef& aObjectDef ) = 0; |
|
788 |
|
789 /** |
|
790 * Returns the object (object may contain only properties definied in |
|
791 * "Object") with the specified GUID and specified namespace (if namespace |
|
792 * is NULL, the default namespace is used). |
|
793 * |
|
794 * Example: |
|
795 * CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890 ); |
|
796 * |
|
797 * @param aGuidHigh GUID high |
|
798 * @param aGuidLow GUID low |
|
799 * @param aNamespaceDef namespace |
|
800 * |
|
801 * @return object or NULL, if there is no object with the specified |
|
802 * identifier in the metadata engine database |
|
803 */ |
|
804 virtual CMdEObject* GetObjectL( |
|
805 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
806 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
807 |
|
808 /** |
|
809 * Returns the object (object will contain all it's properties) |
|
810 * with the specified GUID and specified namespace |
|
811 * (if namespace is NULL, the default namespace is used). |
|
812 * |
|
813 * Example: |
|
814 * CMdEObject* object = iMdeSession->GetFullObjectL( 12345, 67890 ); |
|
815 * |
|
816 * @param aGuidHigh GUID high |
|
817 * @param aGuidLow GUID low |
|
818 * @param aNamespaceDef namespace |
|
819 * |
|
820 * @return object or NULL, if there is no object with the specified |
|
821 * identifier in the metadata engine database |
|
822 */ |
|
823 virtual CMdEObject* GetFullObjectL( |
|
824 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
825 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
826 |
|
827 /** |
|
828 * Returns the object with the specified URI and specified object |
|
829 * definition. |
|
830 * |
|
831 * Example: |
|
832 * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); |
|
833 * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
834 * CMdEObject* object = iMdeSession->GetObjectL( aUri, imageObjDef ); |
|
835 * |
|
836 * @param aUri object URI |
|
837 * @param aObjectDef object definition |
|
838 * |
|
839 * @return object or NULL, if there is no object with the specified |
|
840 * identifier in the metadata engine database |
|
841 */ |
|
842 virtual CMdEObject* GetObjectL( const TDesC& aUri, |
|
843 CMdEObjectDef& aObjectDef ) = 0; |
|
844 |
|
845 /** |
|
846 * Returns the object (object may contain only properties definied in |
|
847 * "Object") with the specified URI specified namespace (if namespace is |
|
848 * NULL, the default namespace is used). |
|
849 * |
|
850 * @param aUri object URI |
|
851 * @param aNamespaceDef namespace |
|
852 * |
|
853 * @return object or NULL, if there is no object with the specified |
|
854 * identifier in the metadata engine database |
|
855 */ |
|
856 virtual CMdEObject* GetObjectL( const TDesC& aUri, |
|
857 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
858 |
|
859 /** |
|
860 * Returns the object (object will contain all it's properties) with the |
|
861 * specified URI specified namespace (if namespace is NULL, the default |
|
862 * namespace is used). |
|
863 * |
|
864 * @param aUri object URI |
|
865 * @param aNamespaceDef namespace |
|
866 * |
|
867 * @return object or NULL, if there is no object with the specified |
|
868 * identifier in the metadata engine database |
|
869 */ |
|
870 virtual CMdEObject* GetFullObjectL( const TDesC& aUri, |
|
871 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
872 |
|
873 /** |
|
874 * Opens the object with the specified ID and specified object |
|
875 * definition for modifications. The object is locked so that nobody else |
|
876 * can open it for modifications. The modifications are committed by |
|
877 * calling the <code>CommitObject()</code> method, which releases the lock. |
|
878 * The modifications can be canceled by calling the |
|
879 * <code>CancelObject()</code> method, which also releases the lock. |
|
880 * |
|
881 * Example: |
|
882 * CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); |
|
883 * CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); |
|
884 * CMdEObject* image = iMdESession->OpenObjectL( 17, imageDef ); |
|
885 * |
|
886 * CMdEPropertyDef& lastModDatePropDef = imageDef.GetPropertyDefL( |
|
887 * Object::KLastModifiedDateProperty ); |
|
888 * |
|
889 * CMdEProperty* lastModDateProp = NULL; |
|
890 * image->Property( lastModDatePropDef, lastModDateProp, 0 ); |
|
891 * |
|
892 * TTime currenttime( 0 ); |
|
893 * currenttime.UniversalTime(); |
|
894 * |
|
895 * if ( lastModDateProp ) |
|
896 * { |
|
897 * lastModDateProp->SetTimeValueL( currenttime ); |
|
898 * } |
|
899 * else |
|
900 * { |
|
901 * image->AddTimePropertyL( lastModDatePropDef, currenttime ); |
|
902 * } |
|
903 * } |
|
904 * iMdeSession->CommitObjectL( *image ); |
|
905 * |
|
906 * |
|
907 * @param aId object ID |
|
908 * @param aObjectDef object definition |
|
909 * |
|
910 * @return Object or NULL, if there is no object with the specified |
|
911 * identifier in the metadata engine database. |
|
912 */ |
|
913 virtual CMdEObject* OpenObjectL( const TItemId aId, |
|
914 CMdEObjectDef& aObjectDef ) = 0; |
|
915 |
|
916 /** |
|
917 * Opens the object (object may contain only properties definied in "Object") |
|
918 * with the specified ID and specified namespace |
|
919 * (if namespace is NULL, the default namespace is used) for modifications. |
|
920 * The object is locked so that nobody else can open it for modifications. |
|
921 * The modifications are committed by calling the <code>CommitObject()</code> |
|
922 * method, which releases the lock. The modifications can be canceled by |
|
923 * calling the <code>CancelObject()</code> method, which also releases the |
|
924 * lock. |
|
925 * |
|
926 * @param aId object ID. |
|
927 * @param aNamespaceDef namespace |
|
928 * |
|
929 * @return Object or NULL, if there is no object with the specified |
|
930 * identifier in the metadata engine database. |
|
931 */ |
|
932 virtual CMdEObject* OpenObjectL( const TItemId aId, |
|
933 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
934 |
|
935 /** |
|
936 * Opens the object (object will contain all it's properties) |
|
937 * with the specified ID and specified namespace |
|
938 * (if namespace is NULL, the default namespace is used) for modifications. |
|
939 * The object is locked so that nobody else can open it for modifications. |
|
940 * The modifications are committed by calling the <code>CommitObject()</code> |
|
941 * method, which releases the lock. The modifications can be canceled by |
|
942 * calling the <code>CancelObject()</code> method, which also releases the |
|
943 * lock. |
|
944 * |
|
945 * @param aId object ID. |
|
946 * @param aNamespaceDef namespace |
|
947 * |
|
948 * @return Object or NULL, if there is no object with the specified |
|
949 * identifier in the metadata engine database. |
|
950 */ |
|
951 virtual CMdEObject* OpenFullObjectL( const TItemId aId, |
|
952 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
953 |
|
954 |
|
955 /** |
|
956 * Opens the object with the specified GUID and specified object |
|
957 * definition for modifications. The object is locked so that nobody else |
|
958 * can open it for modifications. The modifications are committed by |
|
959 * calling the <code>CommitObject()</code> method, which releases the lock. |
|
960 * The modifications can be canceled by calling the |
|
961 * <code>CancelObject()</code> method, which also releases the lock. |
|
962 * |
|
963 * @param aGuidHigh GUID high |
|
964 * @param aGuidLow GUID low |
|
965 * @param aObjectDef object definition |
|
966 * |
|
967 * @return Object or NULL, if there is no object with the specified |
|
968 * identifier in the metadata engine database. |
|
969 */ |
|
970 virtual CMdEObject* OpenObjectL( |
|
971 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
972 CMdEObjectDef& aObjectDef ) = 0; |
|
973 |
|
974 /** |
|
975 * Opens the object (object may contain only properties definied in "Object") |
|
976 * with the specified GUID and specified namespace |
|
977 * (if namespace is NULL, the default namespace is used) for modifications. |
|
978 * The object is locked so that nobody else can open it for modifications. |
|
979 * The modifications are committed by calling the <code>CommitObject()</code> |
|
980 * method, which releases the lock. The modifications can be canceled by |
|
981 * calling the <code>CancelObject()</code> method, which also releases the |
|
982 * lock. |
|
983 * |
|
984 * @param aGuidHigh GUID high |
|
985 * @param aGuidLow GUID low |
|
986 * @param aNamespaceDef namespace |
|
987 * |
|
988 * @return Object or NULL, if there is no object with the specified |
|
989 * identifier in the metadata engine database. |
|
990 */ |
|
991 virtual CMdEObject* OpenObjectL( |
|
992 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
993 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
994 |
|
995 /** |
|
996 * Opens the object (object will contain all it's properties) |
|
997 * with the specified GUID and specified namespace |
|
998 * (if namespace is NULL, the default namespace is used) for modifications. |
|
999 * The object is locked so that nobody else can open it for modifications. |
|
1000 * The modifications are committed by calling the <code>CommitObject()</code> |
|
1001 * method, which releases the lock. The modifications can be canceled by |
|
1002 * calling the <code>CancelObject()</code> method, which also releases the |
|
1003 * lock. |
|
1004 * |
|
1005 * @param aGuidHigh GUID high |
|
1006 * @param aGuidLow GUID low |
|
1007 * @param aNamespaceDef namespace |
|
1008 * |
|
1009 * @return Object or NULL, if there is no object with the specified |
|
1010 * identifier in the metadata engine database. |
|
1011 */ |
|
1012 virtual CMdEObject* OpenFullObjectL( |
|
1013 const TInt64 aGuidHigh, const TInt64 aGuidLow, |
|
1014 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1015 |
|
1016 |
|
1017 /** |
|
1018 * Opens the object with the specified URI for modifications and specified |
|
1019 * object definition. The object is locked so that nobody else can open it |
|
1020 * for modifications. The modifications are committed by calling the |
|
1021 * <code>CommitObject()</code> method, which releases the lock. The |
|
1022 * modifications can be canceled by calling the <code>CancelObject()</code> |
|
1023 * method, which also releases the lock. |
|
1024 * |
|
1025 * @param aUri object URI |
|
1026 * @param aObjectDef object definition |
|
1027 * |
|
1028 * @return Object or NULL, if there is no object with the specified |
|
1029 * identifier in the metadata engine database. |
|
1030 */ |
|
1031 virtual CMdEObject* OpenObjectL( const TDesC& aUri, |
|
1032 CMdEObjectDef& aObjectDef ) = 0; |
|
1033 |
|
1034 /** |
|
1035 * Opens the object (object may contain only properties definied in "Object") |
|
1036 * with the specified ID and specified namespace |
|
1037 * (if namespace is NULL, the default namespace is used) for modifications. |
|
1038 * The object is locked so that nobody else can open it for modifications. |
|
1039 * The modifications are committed by calling the <code>CommitObject()</code> |
|
1040 * method, which releases the lock. The modifications can be canceled by |
|
1041 * calling the <code>CancelObject()</code> method, which also releases the |
|
1042 * lock. |
|
1043 * |
|
1044 * @param aUri Object URI. |
|
1045 * @param aNamespaceDef namespace |
|
1046 * |
|
1047 * @return Object or NULL, if there is no object with the specified |
|
1048 * identifier in the metadata engine database. |
|
1049 */ |
|
1050 virtual CMdEObject* OpenObjectL( const TDesC& aUri, |
|
1051 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1052 |
|
1053 /** |
|
1054 * Opens the object (object will contain all it's properties) |
|
1055 * with the specified ID and specified namespace |
|
1056 * (if namespace is NULL, the default namespace is used) for modifications. |
|
1057 * The object is locked so that nobody else can open it for modifications. |
|
1058 * The modifications are committed by calling the <code>CommitObject()</code> |
|
1059 * method, which releases the lock. The modifications can be canceled by |
|
1060 * calling the <code>CancelObject()</code> method, which also releases the |
|
1061 * lock. |
|
1062 * |
|
1063 * @param aUri Object URI. |
|
1064 * @param aNamespaceDef namespace |
|
1065 * |
|
1066 * @return Object or NULL, if there is no object with the specified |
|
1067 * identifier in the metadata engine database. |
|
1068 */ |
|
1069 virtual CMdEObject* OpenFullObjectL( const TDesC& aUri, |
|
1070 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1071 |
|
1072 /** |
|
1073 * Gets metadata object id, definition and some flags by URI. Does not return the whole object. |
|
1074 * |
|
1075 * @param aObject on return contains information about the metadata object |
|
1076 * @param aUri metadata object URI |
|
1077 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. |
|
1078 */ |
|
1079 virtual void CheckObjectL( TMdEObject& aObject, const TDesC& aUri, |
|
1080 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1081 |
|
1082 /** |
|
1083 * Gets metadata object id, definition and some flags by id. Does not return the whole object. |
|
1084 * |
|
1085 * @param aObject on return contains information about the metadata object |
|
1086 * @param aId metadata object id |
|
1087 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. |
|
1088 */ |
|
1089 virtual void CheckObjectL( TMdEObject& aObject, TItemId aId, |
|
1090 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1091 |
|
1092 /** |
|
1093 * Gets an array of TMdEObject objects that contain metadata object ids, definitions and |
|
1094 * some flags by object ids. Does not return whole objects. |
|
1095 * |
|
1096 * @param aObjects on return contains an array of objects containing information about metadata objects |
|
1097 * @param aIds array of metadata object ids |
|
1098 * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. |
|
1099 */ |
|
1100 virtual void CheckObjectL( RArray<TMdEObject>& aObjects, |
|
1101 const RArray<TItemId>& aIds, |
|
1102 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1103 |
|
1104 /** |
|
1105 * Commits the modifications made to the object to the database |
|
1106 * and releases the modification lock. |
|
1107 * |
|
1108 * @param aObject Object. |
|
1109 */ |
|
1110 virtual void CommitObjectL(CMdEObject& aObject) = 0; |
|
1111 |
|
1112 /** |
|
1113 * Commits the modifications made to objects to the database |
|
1114 * and releases the modification locks. |
|
1115 * |
|
1116 * @param aObject Object. |
|
1117 */ |
|
1118 virtual void CommitObjectsL(RPointerArray<CMdEObject>& aObjects) = 0; |
|
1119 |
|
1120 /** |
|
1121 * Cancels the modifications made to the object and releases the |
|
1122 * modification lock. |
|
1123 * |
|
1124 * @param aObject Object. |
|
1125 */ |
|
1126 virtual TItemId CancelObjectL(CMdEObject& aObject) = 0; |
|
1127 |
|
1128 |
|
1129 /* Methods for managing relations. */ |
|
1130 |
|
1131 /** |
|
1132 * Returns the relation with the specified ID and specified namespace |
|
1133 * (if namespace is NULL, the default namespace is used). |
|
1134 * |
|
1135 * Note that the ownership of the returned relation is passed to the |
|
1136 * caller of the method (that is, the caller is responsible for deleting |
|
1137 * the relation). |
|
1138 * |
|
1139 * @param aId relation ID |
|
1140 * @param aNamespaceDef namespace |
|
1141 * |
|
1142 * @return relation or NULL, if there is no relation with the specified ID |
|
1143 * in the metadata engine database |
|
1144 */ |
|
1145 virtual CMdERelation* GetRelationL(TItemId aId, |
|
1146 CMdENamespaceDef* aNamespacedef = NULL) = 0; |
|
1147 |
|
1148 /** |
|
1149 * Constructs a new empty relation. Note that the relation is not inserted |
|
1150 * in the database. The ownership of the new relation is passed to the |
|
1151 * caller (that is, the caller is responsible for deleting the relation). |
|
1152 * |
|
1153 * Example: |
|
1154 * CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains ); |
|
1155 * |
|
1156 * CMdERelation* relation = iMdeSession->NewRelationLC( relationDef, albumObject->Id(), audioObject->Id() ); |
|
1157 * iMdeSession->AddRelationL( *relation ); |
|
1158 * |
|
1159 * @param aDef definition of the new relation |
|
1160 * @param aLeftObjectId id of the left side of the relation |
|
1161 * @param aRightObjectId id of the right side of the relation |
|
1162 * @param aParameter the relation parameter |
|
1163 * |
|
1164 * @return new relation |
|
1165 */ |
|
1166 virtual CMdERelation* NewRelationLC(CMdERelationDef& aDef, |
|
1167 TItemId aLeftObjectId, TItemId aRightObjectId, |
|
1168 TInt32 aParameter = 0) = 0; |
|
1169 |
|
1170 /** |
|
1171 * Constructs a new empty relation. Note that the relation is not inserted |
|
1172 * in the database. The ownership of the new relation is passed to the |
|
1173 * caller (that is, the caller is responsible for deleting the relation). |
|
1174 * |
|
1175 * Example: |
|
1176 * CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains ); |
|
1177 * |
|
1178 * CMdERelation* relation = iMdeSession->NewRelationL( relationDef, albumObject->Id(), audioObject->Id() ); |
|
1179 * iMdeSession->AddRelationL( *relation ); |
|
1180 * |
|
1181 * @param aDef definition of the new relation |
|
1182 * @param aLeftObjectId id of the left side of the relation |
|
1183 * @param aRightObjectId id of the right side of the relation |
|
1184 * @param aParameter the relation parameter |
|
1185 * |
|
1186 * @return new relation |
|
1187 */ |
|
1188 virtual CMdERelation* NewRelationL(CMdERelationDef& aDef, |
|
1189 TItemId aLeftObjectId, TItemId aRightObjectId, |
|
1190 TInt32 aParameter = 0) = 0; |
|
1191 |
|
1192 /** |
|
1193 * Adds a new relation to the metadata engine database. |
|
1194 * |
|
1195 * @param relation |
|
1196 * |
|
1197 * @return identifier of the new relation |
|
1198 */ |
|
1199 virtual TItemId AddRelationL( CMdERelation& aRelation ) = 0; |
|
1200 |
|
1201 /** |
|
1202 * Commits changes made to the relation to the metadata engine database. |
|
1203 * |
|
1204 * @param relation |
|
1205 * |
|
1206 * @return identifier of the new relation |
|
1207 */ |
|
1208 virtual TItemId UpdateRelationL( CMdERelation& aRelation ) = 0; |
|
1209 |
|
1210 /** |
|
1211 * Removes the relation with the specified identifier and specified |
|
1212 * namespace (if namespace is NULL, the default namespace is used) |
|
1213 * from the metadata engine database. |
|
1214 * |
|
1215 * @param aId ID of the relation to remove. |
|
1216 * @param aNamespaceDef namespace |
|
1217 * |
|
1218 * @return relation ID or KNoId, if there is no relation with the |
|
1219 * specified ID in the metadata engine database |
|
1220 */ |
|
1221 virtual TItemId RemoveRelationL( TItemId aId, |
|
1222 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1223 |
|
1224 /** |
|
1225 * Removes multiple relations with the specified IDs and specified |
|
1226 * namespace (if namespace is NULL, the default namespace is used) |
|
1227 * from the metadata engine database. |
|
1228 * |
|
1229 * @param aId IDs of relations to remove. |
|
1230 * @param aSuccessful Successfully removed IDs of relations (if removing |
|
1231 * has failed KNoId is added). |
|
1232 * @param aNamespaceDef namespace |
|
1233 */ |
|
1234 virtual TInt RemoveRelationsL( |
|
1235 const RArray<TItemId>& aId, RArray<TItemId>& aSuccessful, |
|
1236 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1237 |
|
1238 /** |
|
1239 * Removes multiple relations asynchronous with the specified IDs and |
|
1240 * specified namespace (if namespace is NULL, the default namespace is |
|
1241 * used) from the metadata engine database. Returned serialized list of |
|
1242 * item IDs must be deserialized with DeserializeIdsL method. |
|
1243 * |
|
1244 * @param aId IDs of relations to remove. |
|
1245 * @param aStatus returns the result code after the asynchronous call |
|
1246 * completes. |
|
1247 * @param aSerializedRelationIds returned serialized list of relation IDs |
|
1248 * @param aNamespaceDef namespace |
|
1249 */ |
|
1250 virtual void RemoveRelationsAsyncL( |
|
1251 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
1252 RMdEDataBuffer& aSerializedRelationIds, |
|
1253 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1254 |
|
1255 /* Methods for managing events. */ |
|
1256 |
|
1257 /** |
|
1258 * Constructs a new empty event. Note that the event is not inserted in the |
|
1259 * database. The ownership of the new event is passed to the caller (that |
|
1260 * is, the caller is responsible for deleting the event). |
|
1261 * |
|
1262 * Example: |
|
1263 * CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated ); |
|
1264 * CMdEEvent* event = iMdeSession->NewEventLC( *eventDef, objectId, time ); |
|
1265 * |
|
1266 * @param aDef definition of the new event |
|
1267 * @param aObjectId the target object id |
|
1268 * @param aTime time of the event |
|
1269 * @param aSource source of the event |
|
1270 * @param aParticipant participant of the event |
|
1271 * |
|
1272 * @return new event |
|
1273 */ |
|
1274 virtual CMdEEvent* NewEventLC(CMdEEventDef& aDef, |
|
1275 TItemId aObjectId, TTime aTime, |
|
1276 const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0; |
|
1277 |
|
1278 /** |
|
1279 * Constructs a new empty event. Note that the event is not inserted in the |
|
1280 * database. The ownership of the new event is passed to the caller (that |
|
1281 * is, the caller is responsible for deleting the event). |
|
1282 * |
|
1283 * Example: |
|
1284 * CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated ); |
|
1285 * CMdEEvent* event = iMdeSession->NewEventL( *eventDef, objectId, time ); |
|
1286 * |
|
1287 * @param aDef definition of the new event |
|
1288 * @param aObjectId the target object id |
|
1289 * @param aTime time of the event |
|
1290 * @param aSource source of the event |
|
1291 * @param aParticipant participant of the event |
|
1292 * |
|
1293 * @return new event |
|
1294 */ |
|
1295 virtual CMdEEvent* NewEventL(CMdEEventDef& aDef, |
|
1296 TItemId aObjectId, TTime aTime, |
|
1297 const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0; |
|
1298 |
|
1299 /** |
|
1300 * Returns the event with the specified identifier and specified namespace |
|
1301 * (if namespace is NULL, the default namespace is used). |
|
1302 * Note that the ownership of the returned event is passed to the caller of |
|
1303 * the method (that is, the caller is responsible for deleting the event). |
|
1304 * |
|
1305 * @param aId Identifier. |
|
1306 * @param aNamespaceDef namespace |
|
1307 * |
|
1308 * @return Event or NULL, if there is no event with the specified |
|
1309 * identifier in the metadata engine database. |
|
1310 */ |
|
1311 virtual CMdEEvent* GetEventL(TItemId aId, |
|
1312 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1313 |
|
1314 /** |
|
1315 * Adds a new event to the metadata engine database. |
|
1316 * |
|
1317 * @param event |
|
1318 * |
|
1319 * @return Identifier of the new event. |
|
1320 */ |
|
1321 virtual TItemId AddEventL( CMdEEvent& aEvent ) = 0; |
|
1322 |
|
1323 /** |
|
1324 * Removes the event with the specified identifier and specified namespace |
|
1325 * (if namespace is NULL, the default namespace is used) from the metadata |
|
1326 * engine database. |
|
1327 * |
|
1328 * @param aId ID of the event to remove. |
|
1329 * @param aNamespaceDef namespace |
|
1330 * |
|
1331 * @return event ID or KNoId, if there is no event with the specified ID |
|
1332 * in the metadata engine database |
|
1333 */ |
|
1334 virtual TItemId RemoveEventL( TItemId aId, |
|
1335 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1336 |
|
1337 /** |
|
1338 * Removes multiple events with the specified IDs and specified |
|
1339 * namespace (if namespace is NULL, the default namespace is used) |
|
1340 * from the metadata engine database. |
|
1341 * |
|
1342 * @param aId IDs of events to remove. |
|
1343 * @param aSuccessful Successfully removed IDs of events (if removing has |
|
1344 * failed KNoId is added). |
|
1345 * @param aNamespaceDef namespace |
|
1346 */ |
|
1347 virtual TInt RemoveEventsL( |
|
1348 const RArray<TItemId>& aId, RArray<TItemId>& aSuccessful, |
|
1349 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1350 |
|
1351 /** |
|
1352 * Removes multiple events asynchronous with the specified IDs and |
|
1353 * specified namespace (if namespace is NULL, the default namespace is |
|
1354 * used) from the metadata engine database. Returned serialized list of |
|
1355 * item IDs must be deserialized with DeserializeIdsL method. |
|
1356 * |
|
1357 * @param aId IDs of events to remove. |
|
1358 * @param aStatus returns the result code after the asynchronous call |
|
1359 * completes. |
|
1360 * @param aSerializedEventIds returned serialized list of event IDs |
|
1361 * @param aNamespaceDef namespace |
|
1362 */ |
|
1363 virtual void RemoveEventsAsyncL( |
|
1364 const RArray<TItemId>& aId, TRequestStatus& aStatus, |
|
1365 RMdEDataBuffer& aSerializedEventIds, |
|
1366 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1367 |
|
1368 |
|
1369 /* Methods for searching objects, relations, and events. */ |
|
1370 |
|
1371 /** |
|
1372 * Creates a new object query. |
|
1373 * |
|
1374 * Note that the ownership of the returned query is passed to the caller of |
|
1375 * the method (that is, the caller is responsible for deleting the query). |
|
1376 * |
|
1377 * @param aNamespaceDef namespace where query will be run |
|
1378 * @param aObjectDef object definition which defines objects which will be |
|
1379 * queried |
|
1380 * @param aObserver observer which callback methods will be called |
|
1381 * |
|
1382 * @return New object query. |
|
1383 */ |
|
1384 virtual CMdEObjectQuery* NewObjectQueryL(CMdENamespaceDef& aNamespaceDef, |
|
1385 CMdEObjectDef& aObjectDef, MMdEQueryObserver* aObserver = 0) = 0; |
|
1386 |
|
1387 /** |
|
1388 * Creates a new object query. |
|
1389 * |
|
1390 * Note that the ownership of the returned query is passed to the caller of |
|
1391 * the method (that is, the caller is responsible for deleting the query). |
|
1392 * |
|
1393 * @param aObjectDef Object definition which defines the parent object. |
|
1394 * @param aObjectDefs Object definitions which defines objects which will |
|
1395 * be queried. Ownership of aObjectDefs will change to |
|
1396 * query. |
|
1397 * @param aObserver Observer which callback methods will be called. |
|
1398 * |
|
1399 * @return New object query. |
|
1400 */ |
|
1401 virtual CMdEObjectQuery* NewObjectQueryL( |
|
1402 CMdEObjectDef& aObjectDef, |
|
1403 RPointerArray<CMdEObjectDef>* aObjectDefs, |
|
1404 MMdEQueryObserver* aObserver = 0) = 0; |
|
1405 |
|
1406 /** |
|
1407 * Creates a new relation query. |
|
1408 * |
|
1409 * Note that the ownership of the returned query is passed to the caller of |
|
1410 * the method (that is, the caller is responsible for deleting the query). |
|
1411 * |
|
1412 * @param aNamespaceDef namespace where query will be run |
|
1413 * @param aObserver observer which callback methods will be called |
|
1414 * |
|
1415 * @return New relation query. |
|
1416 */ |
|
1417 virtual CMdERelationQuery* NewRelationQueryL( |
|
1418 CMdENamespaceDef& aNamespaceDef, |
|
1419 MMdEQueryObserver* aObserver = 0) = 0; |
|
1420 |
|
1421 /** |
|
1422 * Creates a new event query. |
|
1423 * |
|
1424 * Note that the ownership of the returned query is passed to the caller of |
|
1425 * the method (that is, the caller is responsible for deleting the query). |
|
1426 * |
|
1427 * @param aNamespaceDef namespace where query will be run |
|
1428 * @param aObserver observer which callback methods will be called |
|
1429 * |
|
1430 * @return New event query. |
|
1431 */ |
|
1432 virtual CMdEEventQuery* NewEventQueryL(CMdENamespaceDef& aNamespaceDef, |
|
1433 MMdEQueryObserver* aObserver = 0) = 0; |
|
1434 |
|
1435 |
|
1436 /* Methods for managing observers. */ |
|
1437 |
|
1438 /** |
|
1439 * Adds a new schema observer to the session. No duplicate |
|
1440 * observers are allowed. |
|
1441 * |
|
1442 * @param aObserver observer |
|
1443 */ |
|
1444 virtual void AddSchemaObserverL(MMdESchemaObserver& aObserver) = 0; |
|
1445 |
|
1446 /** |
|
1447 * Removes the specified schema observer from the session. |
|
1448 * |
|
1449 * @param aObserver observer |
|
1450 */ |
|
1451 virtual void RemoveSchemaObserverL(MMdESchemaObserver& aObserver) = 0; |
|
1452 |
|
1453 /** |
|
1454 * Adds a new object observer to the session. No duplicate observers are |
|
1455 * allowed. |
|
1456 * |
|
1457 * The following restrictions are placed on the condition nodes: |
|
1458 * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be |
|
1459 * used. CMdERangePropertyConditions are not allowed. |
|
1460 * - No nested logic conditions are allowed. |
|
1461 * |
|
1462 * @param aObserver Observer. |
|
1463 * @param aCondition Condition that the objects, about which the observer |
|
1464 * wants to receive notifications, must fulfill or NULL, |
|
1465 * to receive notifications of all objects. |
|
1466 * Ownership of the condition is transferred to the |
|
1467 * session. |
|
1468 * @param aNotificationType what event type (add, modify, remove) should |
|
1469 * be notified to client |
|
1470 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1471 * default namespace is used) |
|
1472 * |
|
1473 * @leave KErrAlreadyExists if the same observer has already been added |
|
1474 */ |
|
1475 virtual void AddObjectObserverL(MMdEObjectObserver& aObserver, |
|
1476 CMdELogicCondition* aCondition = NULL, |
|
1477 TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, |
|
1478 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1479 |
|
1480 /** |
|
1481 * Removes the specified object observer from the session. |
|
1482 * |
|
1483 * @param aObserver observer |
|
1484 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1485 * default namespace is used) |
|
1486 */ |
|
1487 virtual void RemoveObjectObserverL(MMdEObjectObserver& aObserver, |
|
1488 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1489 |
|
1490 /** |
|
1491 * Adds a new object present observer to the session. No duplicate |
|
1492 * observers are allowed. |
|
1493 * |
|
1494 * @param aObserver Observer |
|
1495 * |
|
1496 * @leave KErrAlreadyExists if the same observer has already been added |
|
1497 */ |
|
1498 virtual void AddObjectPresentObserverL( |
|
1499 MMdEObjectPresentObserver& aObserver) = 0; |
|
1500 |
|
1501 /** |
|
1502 * Removes the specified object present observer from the session. |
|
1503 * |
|
1504 * @param aObserver observer |
|
1505 */ |
|
1506 virtual void RemoveObjectPresentObserverL( |
|
1507 MMdEObjectPresentObserver& aObserver)= 0; |
|
1508 |
|
1509 /** |
|
1510 * Adds a new relation observer to the session. No duplicate observers |
|
1511 * are allowed. |
|
1512 * |
|
1513 * The following restrictions are placed on the condition nodes: |
|
1514 * - Only CMdERelationCondition nodes are allowed. |
|
1515 * - No nested logic conditions are allowed. |
|
1516 * |
|
1517 * @param aObserver Observer. |
|
1518 * @param aCondition Condition that the relations, about which the observer |
|
1519 * wants to receive notifications, must fulfill |
|
1520 * or NULL, to receive notifications of all relations. |
|
1521 * Ownership of the condition is transferred to the |
|
1522 * session. |
|
1523 * @param aNotificationType what event type (add, modify, remove) should |
|
1524 * be notified to client |
|
1525 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1526 * default namespace is used) |
|
1527 * |
|
1528 * @leave KErrAlreadyExists if the same observer has already been added |
|
1529 */ |
|
1530 virtual void AddRelationObserverL(MMdERelationObserver& aObserver, |
|
1531 CMdECondition* aCondition = NULL, |
|
1532 TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, |
|
1533 CMdENamespaceDef* aNamespaceDef = NULL)= 0; |
|
1534 /** |
|
1535 * Removes the specified relation observer from the session. |
|
1536 * |
|
1537 * @param aObserver Observer. |
|
1538 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1539 * default namespace is used) |
|
1540 */ |
|
1541 virtual void RemoveRelationObserverL(MMdERelationObserver& aObserver, |
|
1542 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1543 |
|
1544 /** |
|
1545 * Adds a new relation item observer to the session. |
|
1546 * No duplicate observers are allowed. |
|
1547 * |
|
1548 * The following restrictions are placed on the condition nodes: |
|
1549 * - Only CMdERelationCondition nodes are allowed. |
|
1550 * - No nested logic conditions are allowed. |
|
1551 * |
|
1552 * @param aObserver Observer. |
|
1553 * @param aCondition Condition that the relations, about which the observer |
|
1554 * wants to receive notifications, must fulfill |
|
1555 * or NULL, to receive notifications of all relations. |
|
1556 * Ownership of the condition is transferred to the |
|
1557 * session. |
|
1558 * @param aNotificationType what event type (add, modify, remove) should |
|
1559 * be notified to client |
|
1560 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1561 * default namespace is used) |
|
1562 * |
|
1563 * @leave KErrAlreadyExists if the same observer has already been added |
|
1564 */ |
|
1565 virtual void AddRelationItemObserverL(MMdERelationItemObserver& aObserver, |
|
1566 CMdECondition* aCondition = NULL, |
|
1567 TUint32 aNotificationType = /*ENotifyAdd | ENotifyModify |*/ ENotifyRemove, |
|
1568 CMdENamespaceDef* aNamespaceDef = NULL)= 0; |
|
1569 /** |
|
1570 * Removes the specified relation observer from the session. |
|
1571 * |
|
1572 * @param aObserver Observer. |
|
1573 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1574 * default namespace is used) |
|
1575 */ |
|
1576 virtual void RemoveRelationItemObserverL(MMdERelationItemObserver& aObserver, |
|
1577 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1578 |
|
1579 /** |
|
1580 * Adds a new realation present observer to the session. No duplicate observers are |
|
1581 * allowed. |
|
1582 * |
|
1583 * @param aObserver Observer. |
|
1584 * |
|
1585 * @leave KErrAlreadyExists if the same observer has already been added |
|
1586 */ |
|
1587 virtual void AddRelationPresentObserverL( |
|
1588 MMdERelationPresentObserver& aObserver) = 0; |
|
1589 |
|
1590 /** |
|
1591 * Removes the specified relation present observer from the session. |
|
1592 * |
|
1593 * @param aObserver observer |
|
1594 */ |
|
1595 virtual void RemoveRelationPresentObserverL( |
|
1596 MMdERelationPresentObserver& aObserver)= 0; |
|
1597 |
|
1598 /** |
|
1599 * Adds a new event observer to the session. No duplicate observers |
|
1600 * are allowed. |
|
1601 * |
|
1602 * The following restrictions are placed on the condition nodes: |
|
1603 * - Only CMdEEventCondition nodes are allowed. |
|
1604 * - No nested logic conditions are allowed. |
|
1605 * |
|
1606 * @param aObserver Observer. |
|
1607 * @param aCondition Condition that the events, about which the observer |
|
1608 * wants to receive notifications, must fulfill |
|
1609 * or NULL, to receive notifications of all events. |
|
1610 * @param aNotificationType what event type (add or remove) should |
|
1611 * be notified to client |
|
1612 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1613 * default namespace is used) |
|
1614 * |
|
1615 * @leave KErrAlreadyExists if the same observer has already been added |
|
1616 */ |
|
1617 virtual void AddEventObserverL(MMdEEventObserver& aObserver, |
|
1618 CMdECondition* aCondition = NULL, |
|
1619 TUint32 aNotificationType = ENotifyAdd | ENotifyRemove, |
|
1620 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1621 |
|
1622 /** |
|
1623 * Removes the specified event observer from the session. |
|
1624 * |
|
1625 * @param aObserver Observer. |
|
1626 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1627 * default namespace is used) |
|
1628 */ |
|
1629 virtual void RemoveEventObserverL(MMdEEventObserver& aObserver, |
|
1630 CMdENamespaceDef* aNamespaceDef = NULL) = 0; |
|
1631 |
|
1632 |
|
1633 /* Methods for import/export */ |
|
1634 |
|
1635 /** |
|
1636 * Imports schemadata from file to default database. |
|
1637 * |
|
1638 * @param aFileName filename where the schemadata to import is. |
|
1639 */ |
|
1640 virtual void ImportSchemaL( const TDesC& aFileName ) = 0; |
|
1641 |
|
1642 /** |
|
1643 * Imports metadata from file to default database. |
|
1644 * |
|
1645 * @param aFileName filename where the metadata to import is. |
|
1646 * @return The number of failed imports |
|
1647 */ |
|
1648 virtual TInt ImportMetadataL( const TDesC& aFileName ) = 0; |
|
1649 |
|
1650 /** |
|
1651 * Imports metadata asynchronously from file to default database. |
|
1652 * |
|
1653 * @param aFileName Filename where the metadata to import is. |
|
1654 * @param aResult The number of failed imports and possible error code. |
|
1655 * @param aStatus Returned status of method call. |
|
1656 */ |
|
1657 virtual void ImportMetadata( const TDesC& aFileName, |
|
1658 TPckgBuf<TInt>& aResult, TRequestStatus& aStatus ) = 0; |
|
1659 |
|
1660 /** |
|
1661 * Exports metadata to file. |
|
1662 * |
|
1663 * @param aFileName filename where the metadata is to be exported. |
|
1664 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1665 * default namespace is used), ownership doesn't |
|
1666 * change |
|
1667 * @param aObjectDefs object types to export (if NULL all objects are |
|
1668 * exported), ownership doesn't change |
|
1669 * @param aRelationDefs relation types to export (if NULL all relations |
|
1670 * are exported), ownership doesn't change |
|
1671 * @param aEventDefs event types to export (if NULL all events are |
|
1672 * exported), ownership doesn't change |
|
1673 */ |
|
1674 virtual void ExportMetadataL( const TDesC& aFileName, |
|
1675 const CMdENamespaceDef* aNamespaceDef = NULL, |
|
1676 const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, |
|
1677 const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, |
|
1678 const RPointerArray<CMdEEventDef>* aEventDefs = NULL ) = 0; |
|
1679 |
|
1680 /** |
|
1681 * Exports metadata asynchronously to file. |
|
1682 * |
|
1683 * @param aFileName Filename where the metadata is to be exported. |
|
1684 * @param aStatus Returns the result code after the asynchronous call |
|
1685 * completes. |
|
1686 * @param aBuffer Serialized buffer of export types, must be valid until |
|
1687 * aStatus is completed and can be closed after that. |
|
1688 * @param aNamespaceDef Specified namespace (if namespace is NULL, the |
|
1689 * default namespace is used), ownership doesn't |
|
1690 * change. |
|
1691 * @param aObjectDefs Object types to export (if NULL all objects are |
|
1692 * exported), ownership doesn't change. |
|
1693 * @param aRelationDefs Relation types to export (if NULL all relations |
|
1694 * are exported), ownership doesn't change. |
|
1695 * @param aEventDefs Event types to export (if NULL all events are |
|
1696 * exported), ownership doesn't change. |
|
1697 */ |
|
1698 virtual void ExportMetadataL( const TDesC& aFileName, |
|
1699 TRequestStatus& aStatus, RMdEDataBuffer& aBuffer, |
|
1700 const CMdENamespaceDef* aNamespaceDef = NULL, |
|
1701 const RPointerArray<CMdEObjectDef>* aObjectDefs = NULL, |
|
1702 const RPointerArray<CMdERelationDef>* aRelationDefs = NULL, |
|
1703 const RPointerArray<CMdEEventDef>* aEventDefs = NULL ) = 0; |
|
1704 /** |
|
1705 * Load whole schema from server side. |
|
1706 */ |
|
1707 virtual void LoadSchemaL() = 0; |
|
1708 |
|
1709 /** |
|
1710 * Get schema version's major and minor version. |
|
1711 * |
|
1712 * @param aMajorVersion returned major version |
|
1713 * @param aMinorVersion returned minor version |
|
1714 */ |
|
1715 virtual void GetSchemaVersionL( |
|
1716 TInt& aMajorVersion, TInt& aMinorVersion) = 0; |
|
1717 |
|
1718 /** |
|
1719 * Set object to "present" state by GUID. |
|
1720 * |
|
1721 * @param aGuidHigh Guid's high part |
|
1722 * @param aGuidLow Guid's low part |
|
1723 * |
|
1724 * @leave KErrNotFound MdE can't find object in "not present" state |
|
1725 * with matching GUID |
|
1726 */ |
|
1727 virtual void SetObjectToPresentByGuidL( |
|
1728 const TInt64& aGuidHigh, const TInt64& aGuidLow ) = 0; |
|
1729 |
|
1730 /** |
|
1731 * Adds a new object observer to the session. No duplicate observers are |
|
1732 * allowed. |
|
1733 * |
|
1734 * The following restrictions are placed on the condition nodes: |
|
1735 * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be |
|
1736 * used. CMdERangePropertyConditions are not allowed. |
|
1737 * - No nested logic conditions are allowed. |
|
1738 * |
|
1739 * Be adviced, this version with the URI in the callback is much less |
|
1740 * efficient than using version without the URI |
|
1741 * |
|
1742 * @param aObserver Observer. |
|
1743 * @param aCondition Condition that the objects, about which the observer |
|
1744 * wants to receive notifications, must fulfill or NULL, |
|
1745 * to receive notifications of all objects. |
|
1746 * Ownership of the condition is transferred to the |
|
1747 * session. |
|
1748 * @param aNotificationType what event type (add, modify, remove) should |
|
1749 * be notified to client |
|
1750 * @param aNamespaceDef specified namespace (if namespace is NULL, the |
|
1751 * default namespace is used) |
|
1752 * @param aUriRequired determines if uri is required in the callback |
|
1753 * |
|
1754 * @leave KErrAlreadyExists if the same observer has already been added |
|
1755 */ |
|
1756 virtual void AddObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver, |
|
1757 CMdELogicCondition* aCondition = NULL, |
|
1758 TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, |
|
1759 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1760 |
|
1761 /** |
|
1762 * Removes the specified object observer from the session. |
|
1763 * |
|
1764 * @param aObserver observer |
|
1765 */ |
|
1766 virtual void RemoveObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver, |
|
1767 CMdENamespaceDef* aNamespaceDef = NULL ) = 0; |
|
1768 |
|
1769 protected: |
|
1770 |
|
1771 /* Constructors. */ |
|
1772 |
|
1773 /** |
|
1774 * Constructor. |
|
1775 */ |
|
1776 CMdESession(); |
|
1777 |
|
1778 /** |
|
1779 * Second-phase constructor. |
|
1780 */ |
|
1781 void SessionConstruct(); |
|
1782 }; |
|
1783 |
|
1784 // includes only for client more convinient usage |
|
1785 #include <mdeitem.h> |
|
1786 #include <mdenamespacedef.h> |
|
1787 #include <mdepropertydef.h> |
|
1788 #include <mdeobjectdef.h> |
|
1789 #include <mderelationdef.h> |
|
1790 #include <mdeeventdef.h> |
|
1791 #include <mdeproperty.h> |
|
1792 #include <mdeobject.h> |
|
1793 #include <mderelation.h> |
|
1794 #include <mdeevent.h> |
|
1795 #include <mdedatabuffer.h> |
|
1796 |
|
1797 #endif // __MDESESSION_H__ |