mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp
changeset 17 aabe5387f5ce
parent 0 d0791faffa3f
child 12 8b094906a049
equal deleted inserted replaced
0:d0791faffa3f 17:aabe5387f5ce
    37 _LIT(KMTPNoBackupFolder, "nobackup\\");	
    37 _LIT(KMTPNoBackupFolder, "nobackup\\");	
    38 _LIT(KMTPSlash, "\\");
    38 _LIT(KMTPSlash, "\\");
    39 _LIT(KMTPKnowledgeObjFileName, "mtp_knowledgeobj.dat");
    39 _LIT(KMTPKnowledgeObjFileName, "mtp_knowledgeobj.dat");
    40 _LIT(KMTPKnowledgeObjSwpFileName, "mtp_knowledgeobj.swp");
    40 _LIT(KMTPKnowledgeObjSwpFileName, "mtp_knowledgeobj.swp");
    41 
    41 
       
    42 
       
    43 CKnowledgeObject* CKnowledgeObject::NewL(CRepository& aRepository)
       
    44 	{
       
    45 	CKnowledgeObject *self = new (ELeave) CKnowledgeObject(aRepository);
       
    46 	CleanupStack::PushL(self);
       
    47 	self->ConstructL();
       
    48 	CleanupStack::Pop(self);
       
    49 	return self;
       
    50 	}
       
    51 
       
    52 CKnowledgeObject::CKnowledgeObject(CRepository& aRepository) : iRepository(aRepository)
       
    53 	{
       
    54 	
       
    55 	}
       
    56 CKnowledgeObject::~CKnowledgeObject()
       
    57 	{
       
    58 	__FLOG(_L8("~CKnowledgeObject - Entry")); 
       
    59 	iDateModified.Close();
       
    60 	iName.Close();
       
    61 	__FLOG(_L8("~CKnowledgeObject - Exit")); 
       
    62 	__FLOG_CLOSE;
       
    63 	}
       
    64 void CKnowledgeObject::ConstructL()
       
    65 	{
       
    66 	__FLOG_OPEN(KMTPSubsystem, KComponent);
       
    67 	__FLOG(_L8("CKnowledgeObject Construct - Entry"));
       
    68 	iKnowledgeObjectSize = KObjectSizeNotAvaiable;
       
    69 	iDateModified.CreateL(KDateTimeMaxLength);
       
    70 	iName.CreateL(KNameMaxLength);
       
    71 	iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64);
       
    72 	iDirty = EBitFlagAll;
       
    73 	__FLOG(_L8("CKnowledgeObject Construct - Exit"));
       
    74 	}
       
    75 
       
    76 void CKnowledgeObject::LoadL()
       
    77 	{
       
    78 	__FLOG(_L8("CKnowledgeObject LoadL - Entry"));
       
    79 	// Load ObjectSize
       
    80 	TInt objSize;
       
    81 	User::LeaveIfError(iRepository.Get(ESize, objSize));
       
    82 	iKnowledgeObjectSize = objSize;
       
    83 
       
    84 	// Load DateModify
       
    85 	iDateModified.Zero();
       
    86 	User::LeaveIfError(iRepository.Get(EDateModified, iDateModified));
       
    87 	
       
    88 	// Load Name
       
    89 	iName.Zero();
       
    90 	User::LeaveIfError(iRepository.Get(EName, iName));
       
    91 
       
    92 	// Load LastAuthorProxyID:
       
    93 	TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128
       
    94 	iLastAuthorProxyID.FirstWriteChunk(writeBuf);
       
    95 	User::LeaveIfError(iRepository.Get(ELastAuthorProxyID, writeBuf));
       
    96 	iDirty = EBitFlagNone;
       
    97 	__FLOG(_L8("CKnowledgeObject LoadL - Exit"));
       
    98 	return;
       
    99 	}
       
   100 
       
   101 
       
   102 void CKnowledgeObject::Clear()
       
   103 	{
       
   104 	__FLOG(_L8("CKnowledgeObject Clear - Entry"));
       
   105 	iKnowledgeObjectSize = KObjectSizeNotAvaiable;
       
   106 	iDateModified.Zero();
       
   107 	iName.Zero();
       
   108 	iLastAuthorProxyID.Set(KMTPUnInitialized64, KMTPUnInitialized64);
       
   109 	iDirty = EBitFlagAll;
       
   110 	__FLOG(_L8("CKnowledgeObject Clear - Exit"));
       
   111 	}
       
   112 
       
   113 void CKnowledgeObject::SetSize(TUint64 aSize)
       
   114 	{
       
   115 	iKnowledgeObjectSize = aSize;
       
   116 	iDirty |= EBitFlagSize;
       
   117 	}
       
   118 
       
   119 void CKnowledgeObject::SetDateModified(const TDesC& /*aDateModified*/)
       
   120 	{
       
   121 	/**
       
   122 	 * DateModifed will be auto updated when commit. If PC set this prop, it will be ignored.
       
   123 	 * If someday PC want to force the DateModifed be saved, the following code piece should 
       
   124 	 * be opened, and add check in commit when save DateModified.
       
   125 	 *iDateModified.Copy(aDateModified);
       
   126 	 *iDirty |= EBitFlagDateModified;
       
   127 	**/
       
   128 	}
       
   129 
       
   130 void CKnowledgeObject::SetName(const TDesC& aName)
       
   131 	{
       
   132 	iName.Copy(aName);
       
   133 	iDirty |= EBitFlagName;
       
   134 	}
       
   135 
       
   136 void CKnowledgeObject::SetLastAuthorProxyID(TUint64 aHigh, TUint64 aLow) 
       
   137 	{
       
   138 	iLastAuthorProxyID.Set(aHigh, aLow);
       
   139 	iDirty |= EBitFlagLastAuthorProxyID;
       
   140 	}
       
   141 
       
   142 void CKnowledgeObject::CommitL()
       
   143 	{
       
   144 	__FLOG(_L8("CKnowledgeObject CommitL - Entry"));
       
   145 	if (EBitFlagSize == (iDirty & EBitFlagSize))
       
   146 		{
       
   147 		// TUint64 -> TInt, some capability is lost, 
       
   148 		// anyway, it's enough for knowledge object.   
       
   149 		User::LeaveIfError(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize));
       
   150 		}
       
   151 
       
   152 	if (EBitFlagName == (iDirty & EBitFlagName))
       
   153 		{
       
   154 		User::LeaveIfError(iRepository.Set(EName, iName));
       
   155 		}
       
   156 	
       
   157 	if (EBitFlagLastAuthorProxyID == (iDirty & EBitFlagLastAuthorProxyID))
       
   158 		{
       
   159 		if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID))
       
   160 			{
       
   161 			User::Leave(KErrGeneral);
       
   162 			}
       
   163 		}
       
   164 	
       
   165 	// update DateModified to be the time of Commit
       
   166 	RefreshDateModifed();
       
   167 	User::LeaveIfError(iRepository.Set(EDateModified, iDateModified));
       
   168 
       
   169 	iDirty = EBitFlagNone;
       
   170 	__FLOG(_L8("CKnowledgeObject KnowledgeObject CommitL - Exit"));
       
   171 	return;
       
   172 	}
       
   173 
       
   174 TMTPResponseCode CKnowledgeObject::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData)
       
   175 	{
       
   176 	__FLOG(_L8("CKnowledgeObject SetColumnType128ValueL - Entry"));
       
   177 	TInt ret;
       
   178 	TMTPResponseCode responseCode = EMTPRespCodeOK;
       
   179 	TBuf8<KMTPTypeINT128Size>  data;
       
   180 	data.FillZ(data.MaxLength());
       
   181 	TUint64 upperValue = aNewData.UpperValue();
       
   182 	TUint64 lowerValue = aNewData.LowerValue();
       
   183 	
       
   184 	/**
       
   185 	Least significant 64-bit buffer offset.
       
   186 	*/
       
   187 	const TInt           KMTPTypeUint128OffsetLS = 0;
       
   188 	/**
       
   189 	Most significant 64-bit buffer offset.
       
   190 	*/
       
   191 	const TInt           KMTPTypeUint128OffsetMS = 8;
       
   192 	
       
   193 	memcpy(&data[KMTPTypeUint128OffsetMS], &upperValue, sizeof(upperValue));
       
   194 	memcpy(&data[KMTPTypeUint128OffsetLS], &lowerValue, sizeof(lowerValue));
       
   195 	
       
   196 	ret = iRepository.Set(aColumnNum, data);
       
   197 	if (KErrNone != ret)
       
   198 		{
       
   199 		responseCode = EMTPRespCodeGeneralError;
       
   200 		}
       
   201 	__FLOG_VA((_L8("CKnowledgeObject SetColumnType128ValueL - Exit with responseCode = 0x%04X"), responseCode));
       
   202 	return responseCode;
       
   203 	}
       
   204 
       
   205 
       
   206 void CKnowledgeObject::RefreshDateModifed()
       
   207 	{
       
   208 	__FLOG(_L8("CKnowledgeObject RefreshDateModifed - Entry"));
       
   209 	//get current time
       
   210 	TTime now;	
       
   211 	now.UniversalTime();
       
   212 	_LIT(KFormat,"%F%Y%M%DT%H%T%SZ");
       
   213 	iDateModified.Zero();
       
   214 	now.FormatL(iDateModified, KFormat);
       
   215 	__FLOG(_L8("CKnowledgeObject RefreshDateModifed - Exit"));
       
   216 	return;
       
   217 	}
       
   218 
    42 EXPORT_C CMTPKnowledgeHandler* CMTPKnowledgeHandler::NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, 
   219 EXPORT_C CMTPKnowledgeHandler* CMTPKnowledgeHandler::NewL(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, 
    43 												CRepository& aReposotry, const TDesC& aKwgSuid)
   220 												CRepository& aReposotry, const TDesC& aKwgSuid)
    44 	{
   221 	{
    45 	CMTPKnowledgeHandler *self = new (ELeave) CMTPKnowledgeHandler(aFramework, aFormatCode, aReposotry, aKwgSuid);
   222 	CMTPKnowledgeHandler *self = new (ELeave) CMTPKnowledgeHandler(aFramework, aFormatCode, aReposotry, aKwgSuid);
    46 	CleanupStack::PushL(self);
   223 	CleanupStack::PushL(self);
    50 	}
   227 	}
    51 
   228 
    52 EXPORT_C CMTPKnowledgeHandler::~CMTPKnowledgeHandler()
   229 EXPORT_C CMTPKnowledgeHandler::~CMTPKnowledgeHandler()
    53 	{
   230 	{
    54 	__FLOG(_L8("~CMTPKnowledgeHandler - Entry")); 
   231 	__FLOG(_L8("~CMTPKnowledgeHandler - Entry")); 
    55 	delete iDateModified;
       
    56 	delete iName;
       
    57 	delete iKnowledgeObj;
   232 	delete iKnowledgeObj;
    58 	delete iKnowledgeSwpBuffer;
   233 	delete iKnowledgeSwpBuffer;
       
   234 	delete iCachedKnowledgeObject;
    59 	__FLOG(_L8("~CMTPKnowledgeHandler - Exit"));
   235 	__FLOG(_L8("~CMTPKnowledgeHandler - Exit"));
    60 	__FLOG_CLOSE;
   236 	__FLOG_CLOSE;
    61 	}
   237 	}
    62 
   238 
    63 CMTPKnowledgeHandler::CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, 
   239 CMTPKnowledgeHandler::CMTPKnowledgeHandler(MMTPDataProviderFramework& aFramework, TUint16 aFormatCode, 
    64 										CRepository& aReposotry, const TDesC& aKwgSuid) :
   240 										CRepository& aReposotry, const TDesC& aKwgSuid) :
    65 	iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode),
   241 	iFramework(aFramework), iRepository(aReposotry), iKnowledgeFormatCode(aFormatCode), iSuid(aKwgSuid)
    66 	iKnowledgeObjectSize(KObjectSizeNotAvaiable), iCacheStatus(EOK), iSuid(aKwgSuid)
       
    67 	{
   242 	{
    68 	}
   243 	}
    69 
   244 
    70 void CMTPKnowledgeHandler::ConstructL()
   245 void CMTPKnowledgeHandler::ConstructL()
    71 	{
   246 	{
    91 		{
   266 		{
    92 		// In case DP received some object content
   267 		// In case DP received some object content
    93 		User::LeaveIfError(iFramework.Fs().Delete(iKnowObjSwpFileName));
   268 		User::LeaveIfError(iFramework.Fs().Delete(iKnowObjSwpFileName));
    94 		}
   269 		}
    95 
   270 
    96 	LoadKnowledgeObjPropertiesL();
   271 	// create and load knowledge object properties
       
   272 	iCachedKnowledgeObject = CKnowledgeObject::NewL(iRepository);
       
   273 	iCachedKnowledgeObject->LoadL();
    97 	__FLOG(_L8("ConstructL - Exit"));
   274 	__FLOG(_L8("ConstructL - Exit"));
    98 	}
   275 	}
    99 
   276 
   100 EXPORT_C void CMTPKnowledgeHandler::SetStorageId(TUint32 aStorageId)
   277 EXPORT_C void CMTPKnowledgeHandler::SetStorageId(TUint32 aStorageId)
   101 	{
   278 	{
   103 	}
   280 	}
   104 
   281 
   105 void CMTPKnowledgeHandler::CommitL()
   282 void CMTPKnowledgeHandler::CommitL()
   106 	{
   283 	{
   107 	__FLOG(_L8("CommitL - Entry"));
   284 	__FLOG(_L8("CommitL - Entry"));
   108 
       
   109 	User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction));
   285 	User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction));
   110 	iRepository.CleanupCancelTransactionPushL();
   286 	iRepository.CleanupCancelTransactionPushL();
   111 	if(iKnowledgeObjectSize != KObjectSizeNotAvaiable)
   287 	
   112 		{
   288 	iCachedKnowledgeObject->CommitL();
   113 		User::LeaveIfError(iRepository.Set(ESize, (TInt)iKnowledgeObjectSize));
   289 	
   114 		}
       
   115 	if(iDateModified)
       
   116 		{
       
   117 		User::LeaveIfError(iRepository.Set(EDateModified, *iDateModified));
       
   118 		}
       
   119 	if(iName)
       
   120 		{
       
   121 		User::LeaveIfError(iRepository.Set(EName, *iName));
       
   122 		}
       
   123 	
       
   124 	if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID))
       
   125 		{
       
   126 		User::Leave(KErrGeneral);
       
   127 		}
       
   128 	// Close all knowledge file and reset pointer.
   290 	// Close all knowledge file and reset pointer.
   129 	if (iKnowledgeObj)
   291 	if (iKnowledgeObj)
   130 		{
   292 		{
   131 		delete iKnowledgeObj;
   293 		delete iKnowledgeObj;
   132 		iKnowledgeObj = NULL;
   294 		iKnowledgeObj = NULL;
   142 		{
   304 		{
   143 		// In case DP received some object content
   305 		// In case DP received some object content
   144 		User::LeaveIfError(iFramework.Fs().Replace(iKnowObjSwpFileName, iKnowObjFileName));
   306 		User::LeaveIfError(iFramework.Fs().Replace(iKnowObjSwpFileName, iKnowObjFileName));
   145 		}
   307 		}
   146 	// If swp file isn't exsited, that means 0 sized object received, need do nothing.
   308 	// If swp file isn't exsited, that means 0 sized object received, need do nothing.
   147 	
   309 
   148 	TUint32 keyInfo;
   310 	TUint32 keyInfo;
   149 	User::LeaveIfError(iRepository.CommitTransaction(keyInfo));
   311 	User::LeaveIfError(iRepository.CommitTransaction(keyInfo));
   150 	CleanupStack::Pop(&iRepository);
   312 	CleanupStack::Pop(&iRepository);
       
   313 
   151 	__FLOG(_L8("CommitL - Exit"));
   314 	__FLOG(_L8("CommitL - Exit"));
   152 	}
   315 	}
   153 
   316 
   154 void CMTPKnowledgeHandler::CommitForNewObjectL(TDes& aSuid)
   317 void CMTPKnowledgeHandler::CommitForNewObjectL(TDes& aSuid)
   155 	{
   318 	{
   158 	}
   321 	}
   159 	
   322 	
   160 void CMTPKnowledgeHandler::RollBack()
   323 void CMTPKnowledgeHandler::RollBack()
   161 	{
   324 	{
   162 	__FLOG(_L8("Rollback - Entry"));
   325 	__FLOG(_L8("Rollback - Entry"));
   163 	TRAP_IGNORE(LoadKnowledgeObjPropertiesL());
   326 	iCachedKnowledgeObject->Clear();
       
   327 	TRAP_IGNORE(iCachedKnowledgeObject->LoadL());
   164 	__FLOG(_L8("Rollback - Exit"));
   328 	__FLOG(_L8("Rollback - Exit"));
   165 	}
   329 	}
   166 
   330 
   167 EXPORT_C void CMTPKnowledgeHandler::GetObjectSuidL(TDes& aSuid) const
   331 EXPORT_C void CMTPKnowledgeHandler::GetObjectSuidL(TDes& aSuid) const
   168 	{
   332 	{
   169 	__FLOG(_L8("GetObjectSuidL - Entry"));
   333 	__FLOG(_L8("GetObjectSuidL - Entry"));
   170 	if(iKnowledgeObjectSize != KObjectSizeNotAvaiable)
   334 	if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable)
   171 		{
   335 		{
   172 		aSuid.Append(iSuid);
   336 		aSuid.Append(iSuid);
   173 		}
   337 		}
   174 	__FLOG(_L8("GetObjectSuidL - Exit"));
   338 	__FLOG(_L8("GetObjectSuidL - Exit"));
   175 	}
       
   176 
       
   177 void CMTPKnowledgeHandler::LoadKnowledgeObjPropertiesL()
       
   178 	{
       
   179 	__FLOG(_L8("LoadKnowledgeObjPropertiesL - Entry"));
       
   180 	iCacheStatus = EOK;
       
   181 	iCacheStatusFlag = EDirty;
       
   182 	TCleanupItem cacheDroper(DropCacheWrapper, this);
       
   183 	CleanupStack::PushL(cacheDroper);
       
   184 	TInt objSize;
       
   185 	User::LeaveIfError(iRepository.Get(ESize, objSize));
       
   186 	iKnowledgeObjectSize = objSize;
       
   187 
       
   188 	// Load DateModify
       
   189 	delete iDateModified;
       
   190 	iDateModified = NULL;
       
   191 	iDateModified = HBufC::NewL(KDateTimeMaxLength);
       
   192 	TPtr ptrDate(iDateModified->Des());
       
   193 	User::LeaveIfError(iRepository.Get(EDateModified, ptrDate));
       
   194 	
       
   195 	// Load Name
       
   196 	delete iName;
       
   197 	iName = NULL;
       
   198 	iName = HBufC::NewL(KNameMaxLength);
       
   199 	TPtr ptrName(iName->Des());
       
   200 	User::LeaveIfError(iRepository.Get(EName, ptrName));
       
   201 
       
   202 	// Load LastAuthorProxyID:
       
   203 	TPtr8 writeBuf(NULL, 0); //walkaroud for the TMTPTypeUint128
       
   204 	iLastAuthorProxyID.FirstWriteChunk(writeBuf);
       
   205 	User::LeaveIfError(iRepository.Get(ELastAuthorProxyID, writeBuf));
       
   206 	CleanupStack::Pop(this);
       
   207 	// Doesn't load object content to cache beacause it can grow up to 100KB
       
   208 	__FLOG(_L8("LoadKnowledgeObjPropertiesL - Exit"));
       
   209 	}
       
   210 
       
   211 void CMTPKnowledgeHandler::DropCacheWrapper(TAny* aObject)
       
   212 	{
       
   213 	reinterpret_cast<CMTPKnowledgeHandler*>(aObject)->DropKnowledgeObjPropertiesCache();
       
   214 	}
       
   215 
       
   216 void CMTPKnowledgeHandler::DropKnowledgeObjPropertiesCache()
       
   217 	{
       
   218 	__FLOG(_L8("DropKnowledgeObjPropertiesCache - Entry"));
       
   219 	iCacheStatus = iCacheStatusFlag;
       
   220 	iKnowledgeObjectSize = KObjectSizeNotAvaiable;
       
   221 	
       
   222 	// Load DateModify
       
   223 	delete iDateModified;
       
   224 	iDateModified = NULL;
       
   225 	
       
   226 	// Load Name
       
   227 	delete iName;
       
   228 	iName = NULL;
       
   229 	
       
   230 	// Reset LastAuthorProxyID
       
   231 	TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), 
       
   232 						MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32));
       
   233 	iLastAuthorProxyID.Set(tmp.UpperValue(), tmp.LowerValue());
       
   234 	__FLOG(_L8("DropKnowledgeObjPropertiesCache - Exit"));
       
   235 	}
   339 	}
   236 
   340 
   237 TMTPResponseCode CMTPKnowledgeHandler::SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid)
   341 TMTPResponseCode CMTPKnowledgeHandler::SendObjectInfoL(const CMTPTypeObjectInfo& aObjectInfo, TUint32& aParentHandle, TDes& aSuid)
   238 	{
   342 	{
   239 	__FLOG(_L("SendObjectInfoL - Entry"));
   343 	__FLOG(_L("SendObjectInfoL - Entry"));
   243 		responseCode = EMTPRespCodeInvalidParentObject;
   347 		responseCode = EMTPRespCodeInvalidParentObject;
   244 		}
   348 		}
   245 	else
   349 	else
   246 		{
   350 		{
   247 		//if there's a read error reread
   351 		//if there's a read error reread
   248 		if(EDirty == iCacheStatus)
   352 		if(iCachedKnowledgeObject->IsDirty())
   249 			{
   353 			{
   250 			LoadKnowledgeObjPropertiesL();
   354 			__FLOG(_L8("Warning: The cached knowledge is dirty"));
       
   355 			iCachedKnowledgeObject->Clear();
       
   356 			iCachedKnowledgeObject->LoadL();
   251 			}
   357 			}
   252 		//already has a knowledge object
   358 		//already has a knowledge object
   253 		if(iKnowledgeObjectSize != KObjectSizeNotAvaiable)
   359 		if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable)
   254 			{
   360 			{
   255 			responseCode = EMTPRespCodeAccessDenied;
   361 			responseCode = EMTPRespCodeAccessDenied;
   256 			}
   362 			}
   257 		else
   363 		else
   258 			{
   364 			{
   259 			iKnowledgeObjectSize = aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize);
   365 			iCachedKnowledgeObject->Clear();
   260 			delete iDateModified;
   366 			iCachedKnowledgeObject->SetSize(aObjectInfo.Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize));
   261 			iDateModified = NULL;
   367 			// DateModified will be updated when commit.
   262 			iDateModified = aObjectInfo.StringCharsL(CMTPTypeObjectInfo::EDateModified).AllocL();
       
   263 			aSuid = iSuid;
   368 			aSuid = iSuid;
   264 			}
   369 			}
   265 		}
   370 		}
   266 	__FLOG(_L("SendObjectInfoL - Exit"));
   371 	__FLOG(_L("SendObjectInfoL - Exit"));
   267 	return responseCode;
   372 	return responseCode;
   278 		}
   383 		}
   279 	else
   384 	else
   280 		{
   385 		{
   281 		//if there's a read error reread
   386 		//if there's a read error reread
   282 		aParentHandle = KMTPHandleNoParent;
   387 		aParentHandle = KMTPHandleNoParent;
   283 		if(EDirty == iCacheStatus)
   388 		if(iCachedKnowledgeObject->IsDirty())
   284 			{
   389 			{
   285 			LoadKnowledgeObjPropertiesL();
   390 			__FLOG(_L8("Warning: The cached knowledge is dirty"));
       
   391 			iCachedKnowledgeObject->Clear();
       
   392 			iCachedKnowledgeObject->LoadL();
   286 			}
   393 			}
   287 		//already has a knowledge object
   394 		//already has a knowledge object
   288 		if(iKnowledgeObjectSize != KObjectSizeNotAvaiable)
   395 		if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable)
   289 			{
   396 			{
   290 			responseCode = EMTPRespCodeAccessDenied;
   397 			responseCode = EMTPRespCodeAccessDenied;
   291 			}
   398 			}
   292 		else
   399 		else
   293 			{
   400 			{
   294 			iKnowledgeObjectSize = aObjectSize;
   401 			iCachedKnowledgeObject->Clear();
       
   402 			iCachedKnowledgeObject->SetSize(aObjectSize);
   295 			aSuid = iSuid;
   403 			aSuid = iSuid;
   296 			}
   404 			}
   297 		}
   405 		}
   298 	__FLOG(_L8("SendObjectPropListL - Exit"));
   406 	__FLOG(_L8("SendObjectPropListL - Exit"));
   299 	return responseCode;
   407 	return responseCode;
   305 	__FLOG(_L8("GetObjectPropertyL - Entry"));
   413 	__FLOG(_L8("GetObjectPropertyL - Entry"));
   306 	TMTPResponseCode responseCode = EMTPRespCodeOK;
   414 	TMTPResponseCode responseCode = EMTPRespCodeOK;
   307 	CMTPTypeObjectPropListElement* propertyElement = NULL;
   415 	CMTPTypeObjectPropListElement* propertyElement = NULL;
   308 	TUint32 aHandle = aObjectMetaData.Uint(CMTPObjectMetaData::EHandle);
   416 	TUint32 aHandle = aObjectMetaData.Uint(CMTPObjectMetaData::EHandle);
   309 	
   417 	
       
   418 	if(iCachedKnowledgeObject->IsDirty())
       
   419 		{
       
   420 		__FLOG(_L8("Warning: The cached knowledge is dirty"));
       
   421 		iCachedKnowledgeObject->LoadL();
       
   422 		}
       
   423 	
   310 	switch (aPropertyCode)
   424 	switch (aPropertyCode)
   311 		{
   425 		{
   312 		case EMTPGenObjPropCodeParentID:
   426 		case EMTPGenObjPropCodeParentID:
   313 			{
   427 			{
   314 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   428 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   317 			}
   431 			}
   318 				
   432 				
   319 		case EMTPGenObjPropCodeName:
   433 		case EMTPGenObjPropCodeName:
   320 			{
   434 			{
   321 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   435 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   322 			if (iName && iName->Length() > 0)
   436 			if (iCachedKnowledgeObject->Name().Length() > 0)
   323 				{
   437 				{
   324 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, *iName);			
   438 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->Name());
   325 				}
   439 				}
   326 			else
   440 			else
   327 				{
   441 				{
   328 				_LIT(KDefaultKwgObjName, "GenericObject01");
   442 				_LIT(KDefaultKwgObjName, "GenericObject01");
   329 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, KDefaultKwgObjName());	
   443 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, KDefaultKwgObjName());	
   347 			break;
   461 			break;
   348 			}
   462 			}
   349 
   463 
   350 		case EMTPGenObjPropCodeObjectSize:
   464 		case EMTPGenObjPropCodeObjectSize:
   351 			{
   465 			{
   352 			if (iKnowledgeObjectSize != ~0)
   466 			if (iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable)
   353 				{
   467 				{
   354 				propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   468 				propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   355 				propertyElement->SetUint64L(CMTPTypeObjectPropListElement::EValue,iKnowledgeObjectSize);
   469 				propertyElement->SetUint64L(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->Size());
   356 				}
   470 				}
   357 			break;
   471 			break;
   358 			}
   472 			}
   359 
   473 
   360 		case EMTPGenObjPropCodeStorageID:
   474 		case EMTPGenObjPropCodeStorageID:
   378 			break;
   492 			break;
   379 			}
   493 			}
   380 
   494 
   381 		case EMTPGenObjPropCodeDateModified:
   495 		case EMTPGenObjPropCodeDateModified:
   382 			{
   496 			{
       
   497 			if(iCachedKnowledgeObject->DateModified().Length() == 0)
       
   498 				{
       
   499 				iCachedKnowledgeObject->RefreshDateModifed();
       
   500 				}
   383 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   501 			propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   384 			if(iDateModified && iDateModified->Length() > 0)
   502 			propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, iCachedKnowledgeObject->DateModified());
   385 				{
       
   386 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, *iDateModified);	
       
   387 				}
       
   388 			else
       
   389 				{
       
   390 				TTime now;	
       
   391 				now.UniversalTime();
       
   392 				const TInt KMaxTimeStringSize = 50;
       
   393 				TBuf<KMaxTimeStringSize> dateTimeBuf;
       
   394 				_LIT(KFormat,"%F%Y%M%DT%H%T%S");
       
   395 				now.FormatL(dateTimeBuf, KFormat);
       
   396 				propertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, dateTimeBuf);	
       
   397 				}
       
   398 			break;
   503 			break;
   399 			}
   504 			}
   400 			
   505 			
   401 		case EMTPSvcObjPropCodeLastAuthorProxyID:
   506 		case EMTPSvcObjPropCodeLastAuthorProxyID:
   402 			{
   507 			{
   403 			const TMTPTypeUint128 unInitValue(MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32), 
   508 			if ((iCachedKnowledgeObject->LastAuthorProxyID().UpperValue() != KMTPUnInitialized64)
   404 										MAKE_TUINT64(KMTPUnInitialized32, KMTPUnInitialized32));
   509 				 && (iCachedKnowledgeObject->LastAuthorProxyID().LowerValue() !=KMTPUnInitialized64))
   405 			if(!unInitValue.Equal(iLastAuthorProxyID))
       
   406 				{
   510 				{
   407 				propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   511 				propertyElement = &(aPropList.ReservePropElemL(aHandle, aPropertyCode));
   408 				propertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue,
   512 				propertyElement->SetUint128L(CMTPTypeObjectPropListElement::EValue,
   409 											iLastAuthorProxyID.UpperValue(),
   513 						iCachedKnowledgeObject->LastAuthorProxyID().UpperValue(),
   410 											iLastAuthorProxyID.LowerValue());
   514 						iCachedKnowledgeObject->LastAuthorProxyID().LowerValue());
   411 				}
   515 				}
   412 			break;	
   516 			break;	
   413 			}
   517 			}
   414 			
   518 			
   415 		default:
   519 		default:
   435 		TInt ret = KErrNone;
   539 		TInt ret = KErrNone;
   436 		TUint16 propertyCode(aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode));
   540 		TUint16 propertyCode(aElement.Uint16L(CMTPTypeObjectPropListElement::EPropertyCode));
   437 		switch (propertyCode)
   541 		switch (propertyCode)
   438 			{
   542 			{
   439 			case EMTPGenObjPropCodeObjectSize:
   543 			case EMTPGenObjPropCodeObjectSize:
   440 				if(aOperationCode == EMTPOpCodeSetObjectPropList)
   544 				{
   441 					{
   545 				iCachedKnowledgeObject->SetSize(aElement.Uint64L(CMTPTypeObjectPropListElement::EValue));
   442 					ret = iRepository.Set(ESize, (TInt)aElement.Uint64L(CMTPTypeObjectPropListElement::EValue));
       
   443 					}
       
   444 				iKnowledgeObjectSize = aElement.Uint64L(CMTPTypeObjectPropListElement::EValue);
       
   445 				break;
   546 				break;
   446 				
   547 				}
   447 			case EMTPGenObjPropCodeDateModified:
   548 			case EMTPGenObjPropCodeDateModified:
   448 				if(aOperationCode == EMTPOpCodeSetObjectPropList)
   549 				{
   449 					{
   550 				// DateModified will be updated when Commit
   450 					ret = iRepository.Set(EDateModified, aElement.StringL(CMTPTypeObjectPropListElement::EValue));
   551 				iCachedKnowledgeObject->SetDateModified(aElement.StringL(CMTPTypeObjectPropListElement::EValue));
   451 					}
       
   452 				delete iDateModified;
       
   453 				iDateModified = NULL;
       
   454 				iDateModified = aElement.StringL(CMTPTypeObjectPropListElement::EValue).AllocL();
       
   455 				break;
   552 				break;
   456 				
   553 				}
   457 			case EMTPGenObjPropCodeName:
   554 			case EMTPGenObjPropCodeName:
   458 				if(aOperationCode == EMTPOpCodeSetObjectPropList)
   555 				{
   459 					{
   556 				iCachedKnowledgeObject->SetName(aElement.StringL(CMTPTypeObjectPropListElement::EValue));
   460 					ret = iRepository.Set(EName, aElement.StringL(CMTPTypeObjectPropListElement::EValue));
       
   461 					}
       
   462 				delete iName;
       
   463 				iName = NULL;
       
   464 				iName = aElement.StringL(CMTPTypeObjectPropListElement::EValue).AllocL();
       
   465 				break;
   557 				break;
   466 				
   558 				}
   467 			case EMTPSvcObjPropCodeLastAuthorProxyID:
   559 			case EMTPSvcObjPropCodeLastAuthorProxyID:
   468 				{
   560 				{
   469 				TUint64 high_value = 0;
   561 				TUint64 high_value = 0;
   470 				TUint64 low_value  = 0;
   562 				TUint64 low_value  = 0;
   471 				aElement.Uint128L(CMTPTypeObjectPropListElement::EValue, high_value, low_value);
   563 				aElement.Uint128L(CMTPTypeObjectPropListElement::EValue, high_value, low_value);
   472 				if(aOperationCode == EMTPOpCodeSetObjectPropList)
   564 				iCachedKnowledgeObject->SetLastAuthorProxyID(high_value, low_value);
   473 					{
       
   474 					responseCode = SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID);
       
   475 					}
       
   476 				iLastAuthorProxyID.Set(high_value, low_value);
       
   477 				break;
   565 				break;
   478 				}
   566 				}
   479 				
   567 				
   480 			default:
   568 			default:
   481 				responseCode = EMTPRespCodeObjectPropNotSupported;
   569 				responseCode = EMTPRespCodeObjectPropNotSupported;
   492 
   580 
   493 // Remove the knowledge object
   581 // Remove the knowledge object
   494 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/)
   582 TMTPResponseCode CMTPKnowledgeHandler::DeleteObjectL(const CMTPObjectMetaData& /*aObjectMetaData*/)
   495 	{
   583 	{
   496 	__FLOG(_L8("DeleteObjectL - Entry"));
   584 	__FLOG(_L8("DeleteObjectL - Entry"));
   497 	iCacheStatusFlag = EDirty;
   585 
   498 	TCleanupItem cacheDroper(DropCacheWrapper, this);
   586 	User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction));
   499 	CleanupStack::PushL(cacheDroper);
   587 	iRepository.CleanupCancelTransactionPushL();
       
   588 
   500 	// Delete obejct properties in transaction, if leave, mgr will rollback all properties.
   589 	// Delete obejct properties in transaction, if leave, mgr will rollback all properties.
   501 	DeleteAllObjectPropertiesL();
   590 	iCachedKnowledgeObject->Clear();
   502 	CleanupStack::Pop(this);
   591 	iCachedKnowledgeObject->CommitL();
   503 	// Drop all cached properties.
   592 	
   504 	iCacheStatusFlag = EDeleted;
   593 	// Reset knowledgeobject pointer and close the file.
   505 	CMTPKnowledgeHandler::DropCacheWrapper(this);
   594 	if (iKnowledgeObj)
   506 	LoadKnowledgeObjPropertiesL();
   595 		{
       
   596 		delete iKnowledgeObj;
       
   597 		iKnowledgeObj = NULL;
       
   598 		}
       
   599 	
       
   600 	// Keep file delete is atomic.
       
   601 	if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName))
       
   602 		{
       
   603 		User::LeaveIfError(iFramework.Fs().Delete(iKnowObjFileName));
       
   604 		}
       
   605 
       
   606 	TUint32 keyInfo;
       
   607 	User::LeaveIfError(iRepository.CommitTransaction(keyInfo));
       
   608 	CleanupStack::Pop(&iRepository);
       
   609 
   507 	__FLOG(_L8("DeleteObjectL - Exit"));
   610 	__FLOG(_L8("DeleteObjectL - Exit"));
   508 	return EMTPRespCodeOK;
   611 	return EMTPRespCodeOK;
   509 	}
   612 	}
   510 
   613 
   511 // Return the knowledge object content
   614 // Return the knowledge object content
   536 	__FLOG(_L8("DeleteObjectPropertyL - Entry"));
   639 	__FLOG(_L8("DeleteObjectPropertyL - Entry"));
   537 	TMTPResponseCode responseCode = EMTPRespCodeOK;
   640 	TMTPResponseCode responseCode = EMTPRespCodeOK;
   538 	switch (aPropertyCode)
   641 	switch (aPropertyCode)
   539 		{
   642 		{
   540 		case EMTPGenObjPropCodeDateModified:
   643 		case EMTPGenObjPropCodeDateModified:
   541 			delete iDateModified;
   644 			// DateModified will be updated when Commit
   542 			iDateModified = NULL;
   645 			iCachedKnowledgeObject->SetDateModified(KEmptyContent16);
   543 			if (KErrNone != iRepository.Set(EDateModified, KEmptyContent16))
       
   544 				{
       
   545 				responseCode = EMTPRespCodeGeneralError;
       
   546 				}
       
   547 			break;
   646 			break;
   548 		case EMTPSvcObjPropCodeLastAuthorProxyID:
   647 		case EMTPSvcObjPropCodeLastAuthorProxyID:
   549 			{
   648 			{
   550 			TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), 
   649 			iCachedKnowledgeObject->SetLastAuthorProxyID(KMTPUnInitialized64, KMTPUnInitialized64);
   551 								MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32));
       
   552 			iLastAuthorProxyID.Set(tmp.UpperValue(), tmp.LowerValue());
       
   553 			responseCode = SetColumnType128Value(ELastAuthorProxyID, iLastAuthorProxyID);
       
   554 			break;
   650 			break;
   555 			}
   651 			}
   556 			
   652 			
   557 		case EMTPObjectPropCodeParentObject:
   653 		case EMTPObjectPropCodeParentObject:
   558 		case EMTPObjectPropCodeName:
   654 		case EMTPObjectPropCodeName:
   592 	{
   688 	{
   593 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EStorageID, iStorageID);	
   689 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EStorageID, iStorageID);	
   594 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EObjectFormat, iKnowledgeFormatCode);
   690 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EObjectFormat, iKnowledgeFormatCode);
   595 	// Not use
   691 	// Not use
   596 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, 0x0000);
   692 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, 0x0000);
   597 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iKnowledgeObjectSize);
   693 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, iCachedKnowledgeObject->Size());
   598 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EThumbFormat, 0);
   694 	aObjectInfo.SetUint16L(CMTPTypeObjectInfo::EThumbFormat, 0);
   599 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbCompressedSize, 0);
   695 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbCompressedSize, 0);
   600 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbPixWidth, 0);
   696 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbPixWidth, 0);
   601 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbPixHeight, 0);
   697 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EThumbPixHeight, 0);
   602 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EImagePixWidth, 0);
   698 	aObjectInfo.SetUint32L(CMTPTypeObjectInfo::EImagePixWidth, 0);
   613 	}
   709 	}
   614 
   710 
   615 TMTPResponseCode CMTPKnowledgeHandler::GetObjectInfoL(const CMTPObjectMetaData& /*aObjectMetaData*/, CMTPTypeObjectInfo& aObjectInfo)
   711 TMTPResponseCode CMTPKnowledgeHandler::GetObjectInfoL(const CMTPObjectMetaData& /*aObjectMetaData*/, CMTPTypeObjectInfo& aObjectInfo)
   616 	{
   712 	{
   617 	__FLOG(_L8("GetObjectInfoL - Entry"));
   713 	__FLOG(_L8("GetObjectInfoL - Entry"));
   618 	if(iKnowledgeObjectSize != KObjectSizeNotAvaiable)
   714 	if(iCachedKnowledgeObject->Size() != KObjectSizeNotAvaiable)
   619 		{
   715 		{
   620 		BuildObjectInfoL(aObjectInfo);
   716 		BuildObjectInfoL(aObjectInfo);
   621 		}
   717 		}
   622 	__FLOG(_L8("GetObjectInfoL - Exit"));
   718 	__FLOG(_L8("GetObjectInfoL - Exit"));
   623 	return EMTPRespCodeOK;
   719 	return EMTPRespCodeOK;
   624 	}
   720 	}
   625 
   721 
   626 
   722 
   627 void CMTPKnowledgeHandler::DeleteAllObjectPropertiesL()
   723 void CMTPKnowledgeHandler::ReleaseObjectBuffer()
   628 	{
   724 	{
   629 	__FLOG(_L8("DeleteAllObjectPropertiesL - Entry"));
   725 	__FLOG(_L8("ReleaseObjectBuffer - Entry"));
   630 	User::LeaveIfError(iRepository.StartTransaction(CRepository::EReadWriteTransaction));
       
   631 	iRepository.CleanupCancelTransactionPushL();
       
   632 	User::LeaveIfError(iRepository.Set(EDateModified, KEmptyContent16));
       
   633 	User::LeaveIfError(iRepository.Set(EName, KEmptyContent16));
       
   634 	User::LeaveIfError(iRepository.Set(ESize, static_cast<TInt>(KObjectSizeNotAvaiable)));
       
   635 	
       
   636 	TMTPTypeUint128 tmp(MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32), 
       
   637 						MAKE_TINT64(KMTPUnInitialized32, KMTPUnInitialized32));
       
   638 	if (EMTPRespCodeOK != SetColumnType128Value(ELastAuthorProxyID, tmp))
       
   639 		{
       
   640 		User::Leave(KErrGeneral);
       
   641 		}
       
   642 	// Reset knowledgeobject pointer and close the file.
       
   643 	if (iKnowledgeObj)
   726 	if (iKnowledgeObj)
   644 		{
   727 		{
   645 		delete iKnowledgeObj;
   728 		delete iKnowledgeObj;
   646 		iKnowledgeObj = NULL;
   729 		iKnowledgeObj = NULL;
   647 		}
   730 		}
   648 	
       
   649 	// Keep file delete is atomic.
       
   650 	if (BaflUtils::FileExists(iFramework.Fs(), iKnowObjFileName))
       
   651 		{
       
   652 		User::LeaveIfError(iFramework.Fs().Delete(iKnowObjFileName));
       
   653 		}
       
   654 	
       
   655 	TUint32 keyInfo;
       
   656 	User::LeaveIfError(iRepository.CommitTransaction(keyInfo));
       
   657 	CleanupStack::Pop(&iRepository);
       
   658 	
       
   659 	__FLOG(_L8("DeleteAllObjectPropertiesL - Exit"));
       
   660 	return;
       
   661 	}
       
   662 
       
   663 void CMTPKnowledgeHandler::ReleaseObjectBuffer()
       
   664 	{
       
   665 	__FLOG(_L8("ReleaseObjectBuffer - Entry"));
       
   666 	if (iKnowledgeObj)
       
   667 		{
       
   668 		delete iKnowledgeObj;
       
   669 		iKnowledgeObj = NULL;
       
   670 		}
       
   671 	__FLOG(_L8("ReleaseObjectBuffer - Exit"));
   731 	__FLOG(_L8("ReleaseObjectBuffer - Exit"));
   672 	}
   732 	}
   673 
   733 
   674 TMTPResponseCode CMTPKnowledgeHandler::GetObjectSizeL(const TDesC& aSuid, TUint64& aObjectSize)
   734 TMTPResponseCode CMTPKnowledgeHandler::GetObjectSizeL(const TDesC& aSuid, TUint64& aObjectSize)
   675 	{
   735 	{
   676 	__FLOG(_L8("GetObjectSizeL - Entry"));
   736 	__FLOG(_L8("GetObjectSizeL - Entry"));
   677 	if (aSuid != iSuid)
   737 	if (aSuid != iSuid)
   678 		{
   738 		{
   679 		return EMTPRespCodeGeneralError;
   739 		return EMTPRespCodeGeneralError;
   680 		}
   740 		}
   681 	aObjectSize = iKnowledgeObjectSize;
   741 	aObjectSize = iCachedKnowledgeObject->Size();
   682 	__FLOG(_L8("GetObjectSizeL - Exit"));
   742 	__FLOG(_L8("GetObjectSizeL - Exit"));
   683 	return EMTPRespCodeOK;
   743 	return EMTPRespCodeOK;
   684 	}
       
   685 
       
   686 TMTPResponseCode CMTPKnowledgeHandler::SetColumnType128Value(TMTPKnowledgeStoreKeyNum aColumnNum, TMTPTypeUint128& aNewData)
       
   687 	{
       
   688 	__FLOG(_L8("SetColumnType128ValueL - Entry"));
       
   689 	TInt ret;
       
   690 	TMTPResponseCode responseCode = EMTPRespCodeOK;
       
   691 	TBuf8<KMTPTypeINT128Size>  data;
       
   692 	data.FillZ(data.MaxLength());
       
   693 	TUint64 upperValue = aNewData.UpperValue();
       
   694 	TUint64 lowerValue = aNewData.LowerValue();
       
   695 	
       
   696 	/**
       
   697 	Least significant 64-bit buffer offset.
       
   698 	*/
       
   699 	const TInt           KMTPTypeUint128OffsetLS = 0;
       
   700 	/**
       
   701 	Most significant 64-bit buffer offset.
       
   702 	*/
       
   703 	const TInt           KMTPTypeUint128OffsetMS = 8;
       
   704 	
       
   705 	memcpy(&data[KMTPTypeUint128OffsetMS], &upperValue, sizeof(upperValue));
       
   706 	memcpy(&data[KMTPTypeUint128OffsetLS], &lowerValue, sizeof(lowerValue));
       
   707 	
       
   708 	ret = iRepository.Set(aColumnNum, data);
       
   709 	if (KErrNone != ret)
       
   710 		{
       
   711 		responseCode = EMTPRespCodeGeneralError;
       
   712 		}
       
   713 	__FLOG_VA((_L8("SetColumnType128ValueL - Exit with responseCode = 0x%04X"), responseCode));
       
   714 	return responseCode;
       
   715 	}
   744 	}
   716 
   745 
   717 TMTPResponseCode CMTPKnowledgeHandler::GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray<TUint32>& aPropCodes)
   746 TMTPResponseCode CMTPKnowledgeHandler::GetAllObjectPropCodeByGroupL(TUint32 aGroupId, RArray<TUint32>& aPropCodes)
   718 	{
   747 	{
   719 	__FLOG(_L8("GetAllObjectPropCodeByGroupL - Entry"));
   748 	__FLOG(_L8("GetAllObjectPropCodeByGroupL - Entry"));
   747 		responseCode = (TMTPResponseCode)0xA805;
   776 		responseCode = (TMTPResponseCode)0xA805;
   748 		}
   777 		}
   749 	__FLOG(_L8("GetAllObjectPropCodeByGroupL - Exit"));
   778 	__FLOG(_L8("GetAllObjectPropCodeByGroupL - Exit"));
   750 	return responseCode;
   779 	return responseCode;
   751 	}
   780 	}
       
   781 
       
   782