mtpfws/mtpfw/dataproviders/dputility/inc/cmtpknowledgehandler.h
changeset 17 aabe5387f5ce
parent 0 d0791faffa3f
child 47 63cf70d3ecd8
equal deleted inserted replaced
0:d0791faffa3f 17:aabe5387f5ce
    28 #include "mtpsvcdpconst.h"
    28 #include "mtpsvcdpconst.h"
    29 #include "mmtpsvcobjecthandler.h"
    29 #include "mmtpsvcobjecthandler.h"
    30 
    30 
    31 class CMTPTypeFile;
    31 class CMTPTypeFile;
    32 class CRepository;
    32 class CRepository;
       
    33 
       
    34 NONSHARABLE_CLASS(CKnowledgeObject) : public CBase
       
    35 	{
       
    36 public:
       
    37 	static CKnowledgeObject* NewL(CRepository& aRepository);
       
    38 	~CKnowledgeObject();
       
    39 	
       
    40 	/**
       
    41 	Get the value from the central repository
       
    42 	@leave One of the system wide error codes, if repository get value fail
       
    43 	*/
       
    44 	void LoadL();
       
    45 	/**
       
    46 	Set the cached value to the central repository
       
    47 	@leave One of the system wide error codes, if repository set value fail
       
    48 	*/
       
    49 	void CommitL();
       
    50 	/** 
       
    51 	Clear the cached knowledge object property values 
       
    52 	*/
       
    53 	void Clear();
       
    54 	/**
       
    55 	Update cached DateModified to current Device time
       
    56 	*/
       
    57 	void RefreshDateModifed();
       
    58 	/**
       
    59 	Check if the cached object property values are aligned with repository
       
    60 	*/
       
    61 	TBool IsDirty() {return iDirty;};
       
    62 	
       
    63 	//Get method for all prop
       
    64 	TUint64 Size(){return iKnowledgeObjectSize;};
       
    65 	TDesC& DateModified(){return iDateModified;};
       
    66 	TDesC& Name(){return iName;};
       
    67 	const TMTPTypeUint128& LastAuthorProxyID() {return iLastAuthorProxyID;};
       
    68 	
       
    69 	//Set method for all prop
       
    70 	void SetSize(TUint64 aSize);
       
    71 	void SetDateModified(const TDesC& aDateModified);
       
    72 	void SetName(const TDesC& aName);
       
    73 	void SetLastAuthorProxyID(TUint64 aHigh, TUint64 aLow);
       
    74 	
       
    75 private:
       
    76 	//key of central repository
       
    77 	enum TMTPKnowledgeStoreKeyNum
       
    78 		{
       
    79 		ESize 				= 0x10001, 
       
    80 		EDateModified 		= 0x10002,
       
    81 		EName 				= 0x10003,
       
    82 		ELastAuthorProxyID 	= 0x10004
       
    83 		};
       
    84 
       
    85 	// Bit flag of the property
       
    86 	enum TMTPKnowledgeBitFlag
       
    87 		{
       
    88 		EBitFlagNone 				= 0x00,
       
    89 		EBitFlagSize 				= 0x01, 
       
    90 		EBitFlagDateModified 		= 0x02,
       
    91 		EBitFlagName 				= 0x04,
       
    92 		EBitFlagLastAuthorProxyID 	= 0x08,
       
    93 		EBitFlagAll 				= 0x0F
       
    94 		};
       
    95 
       
    96 private:
       
    97 	CKnowledgeObject(CRepository& aRepository);
       
    98 	
       
    99 	void ConstructL();
       
   100 	
       
   101 	TMTPResponseCode SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData);
       
   102 	
       
   103 	CRepository&     	iRepository;
       
   104 
       
   105 	// The bit wise value of TMTPKnowledgeBitFlag 
       
   106 	// to state which property is not aligned with repository
       
   107 	TUint				iDirty;
       
   108 	
       
   109 	TUint64          	iKnowledgeObjectSize; 
       
   110 	RBuf             	iDateModified;
       
   111 	RBuf             	iName;
       
   112 	TMTPTypeUint128  	iLastAuthorProxyID;
       
   113 	
       
   114 	/**
       
   115 	FLOGGER debug trace member variable.
       
   116 	*/
       
   117 	__FLOG_DECLARATION_MEMBER_MUTABLE;
       
   118 	
       
   119 	};
    33 
   120 
    34 /** 
   121 /** 
    35 Controls access to the knowledge object.
   122 Controls access to the knowledge object.
    36 @internalComponent
   123 @internalComponent
    37 */
   124 */
    66 	void CommitL();
   153 	void CommitL();
    67 	void CommitForNewObjectL(TDes& aSuid);
   154 	void CommitForNewObjectL(TDes& aSuid);
    68 	void RollBack();
   155 	void RollBack();
    69 	void ReleaseObjectBuffer();	
   156 	void ReleaseObjectBuffer();	
    70 
   157 
    71 	enum TCacheStatus
       
    72 		{
       
    73 		EOK,
       
    74 		EDirty,
       
    75 		EDeleted
       
    76 		};
       
    77 	//key of central repository
       
    78 	enum TMTPKnowledgeStoreKeyNum
       
    79 		{
       
    80 		ESize = 0x10001, 
       
    81 		EDateModified = 0x10002,
       
    82 		EName = 0x10003,
       
    83 		ELastAuthorProxyID = 0x10004
       
    84 		};
       
    85 	
   158 	
    86 	TMTPResponseCode SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData);
       
    87 
       
    88 private:
   159 private:
    89 	CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework,TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid);
   160 	CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework,TUint16 aFormatCode, CRepository& aReposotry, const TDesC& aKwgSuid);
    90 	void ConstructL();
   161 	void ConstructL();
    91 	
   162 	
    92 	/**
   163 	/**
    93 	Get the value from the central repository
       
    94 	@leave One of the system wide error codes, if repository get value fail
       
    95 	*/
       
    96 	void LoadKnowledgeObjPropertiesL();
       
    97 	/**
       
    98 	Cleanup Item operation for drop all knowledge properties
       
    99 	*/
       
   100 	static void DropCacheWrapper(TAny* aObject);
       
   101 	void DropKnowledgeObjPropertiesCache();
       
   102 	/**
       
   103 	Helper for GetObjectInfo request handling
   164 	Helper for GetObjectInfo request handling
   104 	*/
   165 	*/
   105 	void BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const;
   166 	void BuildObjectInfoL(CMTPTypeObjectInfo& aObjectInfo) const;
   106 	/**
       
   107 	Delete knowledge object properties and content
       
   108 	@leave One of the system wide error codes, if repository set value fail
       
   109 	*/
       
   110 	void DeleteAllObjectPropertiesL();
       
   111 	
   167 	
   112 private:
   168 private:
   113 	MMTPDataProviderFramework&  iFramework;
   169 	MMTPDataProviderFramework&  iFramework;
   114 	CRepository&                iRepository;
   170 	CRepository&                iRepository;
   115 	TUint32                     iStorageID;
   171 	TUint32                     iStorageID;
   116 	TUint16                     iKnowledgeFormatCode;
   172 	TUint16                     iKnowledgeFormatCode;
   117 	TUint64                     iKnowledgeObjectSize; 
   173 	
   118 	HBufC*                      iDateModified;
   174 	CKnowledgeObject*			iCachedKnowledgeObject;
   119 	HBufC*                      iName;
   175 	
   120 	TMTPTypeUint128             iLastAuthorProxyID;
       
   121 	TCacheStatus                iCacheStatus;
       
   122 	TCacheStatus                iCacheStatusFlag;
       
   123 	TFileName                   iKnowObjFileName;
   176 	TFileName                   iKnowObjFileName;
   124 	TFileName                   iKnowObjSwpFileName;
   177 	TFileName                   iKnowObjSwpFileName;
   125 	// Knowledge object content file
   178 	// Knowledge object content file
   126 	CMTPTypeFile*               iKnowledgeObj;
   179 	CMTPTypeFile*               iKnowledgeObj;
   127 	// Knowledge object swap file
   180 	// Knowledge object swap file