|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @internalComponent |
|
24 @released |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef __CLPLGENERICPROXY_H__ |
|
29 #define __CLPLGENERICPROXY_H__ |
|
30 |
|
31 #include <e32base.h> |
|
32 #include "persistencelayer.h" |
|
33 |
|
34 |
|
35 /** |
|
36 This CLplGenericProxy class provides the default behavior for proxy classes. |
|
37 |
|
38 The default behaviour is to pass the calls on without any action to the |
|
39 Persistence Broker or Transaction Manager. |
|
40 |
|
41 The proxy controls all the basic operations on the database (such as Create, |
|
42 Read, Update and Delete) and transaction management operations. |
|
43 |
|
44 Future implementations of the proxy classes could extend the business rules of |
|
45 the contacts model or even plugin alternative data sources. All these |
|
46 implementations should derive from this base class. |
|
47 */ |
|
48 class NONSHARED CLplGenericProxy : public CBase, public MLplPersistenceBroker, public MLplTransactionManager |
|
49 { |
|
50 public: |
|
51 // |
|
52 // CRUD methods. |
|
53 // |
|
54 /** Store a new Contact. */ |
|
55 virtual TContactItemId CreateL(CContactItem& aItem, TUint aSessionId); |
|
56 /** Read an existing Contact (or parts of it as specified by the view |
|
57 definition). */ |
|
58 virtual CContactItem* ReadLC(TContactItemId aItemId, const CContactItemViewDef& aView, TInt aInfoToRead, TUint aSessionId, TBool aIccOpenCheck = EFalse) const; |
|
59 /** Update an existing Contact (or parts of it as specified by the view |
|
60 definition). */ |
|
61 virtual void UpdateL(CContactItem& aItem, TUint aSessionId); |
|
62 /** Delete a Contact. */ |
|
63 virtual CContactItem* DeleteLC(TContactItemId aItemId, TUint aSessionId, TCntSendEventAction aEventType); |
|
64 /** Change the type of an existing contact. */ |
|
65 virtual void ChangeTypeL(TContactItemId aItemId, TUid aNewType); |
|
66 /** Set connection ID for the notification mechanism. */ |
|
67 virtual void SetConnectionId(TInt aConnectionId); |
|
68 |
|
69 // |
|
70 // Transaction methods. |
|
71 // |
|
72 /** Start a new transaction. */ |
|
73 virtual void StartTransactionL(); |
|
74 /** Commit the current transaction. */ |
|
75 virtual void CommitCurrentTransactionL(TUint aSessionId); |
|
76 /** Rollback the current transaction. */ |
|
77 virtual void RollbackCurrentTransactionL(TUint aSessionId); |
|
78 /** Determine if a transaction is currently in progress. */ |
|
79 virtual TBool IsTransactionActive() const; |
|
80 |
|
81 protected: |
|
82 CLplGenericProxy(MLplPersistenceBroker& aBroker, MLplTransactionManager& aTranMan); |
|
83 |
|
84 private: |
|
85 MLplPersistenceBroker& iBroker; |
|
86 MLplTransactionManager& iTranMan; |
|
87 }; |
|
88 |
|
89 |
|
90 #endif //__CLPLGENERICPROXY_H__ |