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