epoc32/include/metadatabase.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    13 // Description:
    13 // Description:
    14 // Meta-database declarations for use in storing comms data
    14 // Meta-database declarations for use in storing comms data
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 
       
    19 
       
    20 /**
    18 /**
    21  @file
    19  @file
    22  @publishedPartner
    20  @publishedAll
    23  @released
    21  @released
    24 */
    22 */
    25 
       
    26 
    23 
    27 #if (!defined METADATABASE_H)
    24 #if (!defined METADATABASE_H)
    28 #define       METADATABASE_H
    25 #define       METADATABASE_H
    29 
    26 
    30 
    27 
    31 
    28 
    32 // NetMeta headers
    29 // NetMeta headers
    33 #include <comms-infras/metadata.h>
    30 #include <comms-infras/metadata.h>
    34 #include <comms-infras/metatype.h>
    31 #include <comms-infras/metatype.h>
       
    32 
       
    33 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    34 #include <metadatabase_partner.h>
       
    35 #endif
    35 
    36 
    36 // CommsDat headers
    37 // CommsDat headers
    37 #include <commsdat.h>
    38 #include <commsdat.h>
    38 
    39 
    39 
    40 
   155 Attribute flags for an element in the Meta Database
   156 Attribute flags for an element in the Meta Database
   156 Attributes describe access rights to the data in the database
   157 Attributes describe access rights to the data in the database
   157 @publishedAll
   158 @publishedAll
   158 @released
   159 @released
   159 */
   160 */
   160 typedef TUint32         TMDBAttributeFlags;	
   161 typedef TUint32         TMDBAttributeFlags;
   161 
       
   162 
   162 
   163 /**
   163 /**
   164 The identifier for any entry in the MetaDatabase.
   164 The identifier for any entry in the MetaDatabase.
   165 It can specify
   165 It can specify
   166 	<TableId><ColumnId><RecordId>
   166 	<TableId><ColumnId><RecordId>
   172 @publishedAll
   172 @publishedAll
   173 @released
   173 @released
   174 */
   174 */
   175 typedef TUint32         TMDBElementId;
   175 typedef TUint32         TMDBElementId;
   176 
   176 
       
   177 
       
   178 //
       
   179 // COMMSDAT RECORD BASE CLASS
       
   180 // Contains fields common to all records
       
   181 //
       
   182 
       
   183 	// Element Type Ids
       
   184 
       
   185     /** 
       
   186     Field will contain a user-defined numeric tag for a record.
       
   187     Useful for user searches and cheaper to search on a numeric tag than a string name.
       
   188     Can be null.
       
   189     This tag is not automatically connected with the record id itself,
       
   190     which is contained within the ElementId for the record and not in any field.
       
   191 
       
   192     @publishedAll
       
   193     @released
       
   194     */
       
   195 	const TMDBElementId KCDTIdRecordTag			 = 0x00010000; 
       
   196 
       
   197     /**
       
   198     Field will contain a user-defined string tag for a record. 
       
   199     This is used to uniquely identify business level information within a record.
       
   200     
       
   201     This field is useful for user searches, however it should be noted that it would be more efficient to use the KCDTIdRecordTag field instead
       
   202     as it is quicker and cheaper to search for a number than for a string.
       
   203 
       
   204     @publishedAll
       
   205     @released
       
   206     */
       
   207     const TMDBElementId KCDTIdRecordName		 = 0x00020000; 
       
   208 
       
   209 
       
   210 	// Element Type Names
       
   211 	#define	KCDTypeNameRecordTag				_S("Id")
       
   212 	#define	KCDTypeNameRecordName		        _S("Name")
       
   213     
       
   214     
   177 class CMDBSession : public CBase
   215 class CMDBSession : public CBase
   178 /*
   216 /**
   179 A session with the underlying storage server
   217 A session with the underlying storage server
   180 @publishedAll
   218 @publishedAll
   181 @released
   219 @released
   182 */
   220 */
   183 {
   221 {
   200     @leave  System-wide error codes if there is an unexpected error
   238     @leave  System-wide error codes if there is an unexpected error
   201     
   239     
   202     @pre    None
   240     @pre    None
   203     @post   on success a session has been created and initialised
   241     @post   on success a session has been created and initialised
   204 
   242 
   205     @publishedAll
       
   206 	*/
   243 	*/
   207 	IMPORT_C static CMDBSession* NewL(TVersion aRequiredVersion);
   244 	IMPORT_C static CMDBSession* NewL(TVersion aRequiredVersion);
   208 
   245 
   209 	/**
   246 	/**
   210 	As NewL and adds Session to the CleanupStack
   247 	As NewL and adds Session to the CleanupStack
   211 
   248 
   212 	@publishedAll
       
   213 	*/
   249 	*/
   214 	IMPORT_C static CMDBSession* NewLC(TVersion aRequiredVersion);
   250 	IMPORT_C static CMDBSession* NewLC(TVersion aRequiredVersion);
   215 
   251 
   216 	/**
   252 	/**
   217 	Virtual Destructor
   253 	Virtual Destructor
   218 
   254 
   219 	@publishedAll
       
   220 	*/
   255 	*/
   221 	IMPORT_C ~CMDBSession();
   256 	IMPORT_C ~CMDBSession();
   222 
   257 
   223 
   258 
   224 	/**
   259 	/**
   225 	Close session with storage server.
   260 	Close session with storage server.
   226 
       
   227 	@publishedAll
   261 	@publishedAll
   228 	@deprecated v9.1 Destructor is all that is required
   262 	@deprecated v9.1 Destructor is all that is required
   229 	*/
   263 	*/
   230 	IMPORT_C void Close();
   264 	IMPORT_C void Close();
   231 
   265 
   232 
   266 
   233 	/**
   267 	/**
   234 	Lookup latest data format version
   268 	Returns the KCDCurrentVersion constant which maps to the KCDVersion1_1 
   235 
   269 	constant for backward compatibility reason. Please avoid using this method 
       
   270 	when creating a CommsDat session object and use explicit schema version 
       
   271 	instead.
       
   272 	
   236 	@pre   None
   273 	@pre   None
   237     @post  None
   274     @post  None
       
   275     
   238 	@publishedAll
   276 	@publishedAll
       
   277 	@deprecated
       
   278 
   239 	*/
   279 	*/
   240 	IMPORT_C static TVersion LatestVersion();
   280 	IMPORT_C static TVersion LatestVersion();
   241 
   281 
   242 
   282 
   243 	/**
   283 	/**
   244 	Lookup data format version currently in use by client
   284 	Lookup data format version currently in use by client
   245 
   285 
   246 	@publishedAll
   286 
   247 	*/
   287 	*/
   248 	IMPORT_C TVersion VersionInUse();
   288 	IMPORT_C TVersion VersionInUse();
   249 
   289 
   250 
   290 
   251 	/**
   291 	/**
   258     @leave  Will leave with a system-wide error code if an error occurs during commit
   298     @leave  Will leave with a system-wide error code if an error occurs during commit
   259 
   299 
   260 	@pre    None
   300 	@pre    None
   261     @post   on success the session has exclusive write access to the database
   301     @post   on success the session has exclusive write access to the database
   262 
   302 
   263 	@publishedAll
   303 
   264 	*/
   304 	*/
   265 	IMPORT_C void OpenTransactionL();
   305 	IMPORT_C void OpenTransactionL();
   266 
   306 
   267 
   307 
   268 	/**
   308 	/**
   273 
   313 
   274 	@pre    None
   314 	@pre    None
   275 
   315 
   276 	@post   On success the database is updated with data added, modified or deleted during the transaction
   316 	@post   On success the database is updated with data added, modified or deleted during the transaction
   277     @post   On failure, any open data containers may not be in sync with the database and should be discarded or reloaded
   317     @post   On failure, any open data containers may not be in sync with the database and should be discarded or reloaded
   278 	@publishedAll
       
   279 	*/
   318 	*/
   280 	IMPORT_C void CommitTransactionL();
   319 	IMPORT_C void CommitTransactionL();
   281 
   320 
   282 
   321 
   283 	/**
   322 	/**
   284 	Cancel Transaction with database and rollback all associated changes
   323 	Cancel Transaction with database and rollback all associated changes
   285         Will not make any changes to the client's containers
       
   286 
   324 
   287     @leave	Will fail with KErrNotFound if not in transaction
   325     @leave	Will fail with KErrNotFound if not in transaction
   288 
   326 
   289     @pre    None - though for correct usage, ensure a transaction is already open
   327     @pre    None - though for correct usage, ensure a transaction is already open
   290 	@post   Any open data containers may not be in sync with the database and should be discarded or reloaded
   328 	@post   Any open data containers may not be in sync with the database and should be discarded or reloaded
   291 	@publishedAll
       
   292 	*/
   329 	*/
   293 	IMPORT_C void RollbackTransactionL();
   330 	IMPORT_C void RollbackTransactionL();
   294 
   331 
   295    /**
   332    /**
   296 	Query if this session is in a transaction with the database
   333 	Query if this session is in a transaction with the database
   297 	Return code will indicate
   334 	Return code will indicate
   298 		Not in transaction,
   335 		Not in transaction,
   299 		Already in transaction for this session,
   336 		Already in transaction for this session,
   300 		Write-lock not available.  Another session has it.
   337 		Write-lock not available.  Another session has it.
   301 
       
   302     @pre None
   338     @pre None
   303 	@publishedAll
       
   304 	*/
   339 	*/
   305 	IMPORT_C TInt IsInTransaction();
   340 	IMPORT_C TInt IsInTransaction();
   306 
   341 
   307 	
   342 	
   308     /**
   343     /**
   311     @params aAttributeFlags indicates the requested access level to stored data.
   346     @params aAttributeFlags indicates the requested access level to stored data.
   312             Attributes set by this call will be ignored as restrictions in all database interactions,
   347             Attributes set by this call will be ignored as restrictions in all database interactions,
   313 	        providing the client has enough platform security capabilities to back up the request
   348 	        providing the client has enough platform security capabilities to back up the request
   314 	
   349 	
   315     @pre None
   350     @pre None
   316 	@publishedAll
       
   317 	*/
   351 	*/
   318 	IMPORT_C void SetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   352 	IMPORT_C void SetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   319 
   353 
   320 	
   354 	
   321 	/**
   355 	/**
   329 
   363 
   330     @return EFalse if the flag is not set in the session mask 
   364     @return EFalse if the flag is not set in the session mask 
   331             This means that the attribute is obeyed in all database interactions for this session
   365             This means that the attribute is obeyed in all database interactions for this session
   332 
   366 
   333     @pre None
   367     @pre None
   334 	@publishedAll
   368 	
   335 	*/
   369 	*/
   336 	IMPORT_C TBool IsSetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   370 	IMPORT_C TBool IsSetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   337 
   371 
   338     
   372     
   339     /**
   373     /**
   346         attribute mask and will be obeyed as restrictions in all database interactions, 
   380         attribute mask and will be obeyed as restrictions in all database interactions, 
   347         providing the client has enough platform security capabilities to back up the request
   381         providing the client has enough platform security capabilities to back up the request
   348         
   382         
   349     @pre None
   383     @pre None
   350 	
   384 	
   351 	@publishedAll
   385 	
   352 	*/
   386 	*/
   353 	IMPORT_C void ClearAttributeMask(TMDBAttributeFlags aAttributeFlags);
   387 	IMPORT_C void ClearAttributeMask(TMDBAttributeFlags aAttributeFlags);
   354 
   388 
   355 
   389 
   356 
   390 
   361 
   395 
   362     @return KErrNone on success or a system-wide error code
   396     @return KErrNone on success or a system-wide error code
   363     
   397     
   364     @pre  None
   398     @pre  None
   365 
   399 
   366 	@publishedAll
       
   367 	*/
   400 	*/
   368 	IMPORT_C TInt CancelAllNotifications();
   401 	IMPORT_C TInt CancelAllNotifications();
   369 
   402 
   370 
   403 
   371     /**
   404     /**
   377 
   410 
   378     @return KErrNone on success.  Otherwise a system-wide error code
   411     @return KErrNone on success.  Otherwise a system-wide error code
   379     	
   412     	
   380     @pre None
   413     @pre None
   381 
   414 
   382     @internalComponent
       
   383 	*/	
   415 	*/	
   384 	IMPORT_C TInt PublishProperties();
   416 	IMPORT_C TInt PublishProperties();
   385 
   417 
   386 private:
   418 private:
   387 
   419 
   392 private:
   424 private:
   393 
   425 
   394 	CMDBSessionImpl* iMDBSessionImpl;
   426 	CMDBSessionImpl* iMDBSessionImpl;
   395 	
   427 	
   396 	friend class MMetaDatabase;
   428 	friend class MMetaDatabase;
       
   429 	friend class CommsDatSchema;
   397 };
   430 };
   398 
   431 
   399 
   432 
   400 
   433 
   401 
   434 
   402 
   435 
   403 class MMetaDatabase : public Meta::MMetaData
   436 class MMetaDatabase : public Meta::MMetaData
   404 /*
   437 /**
   405 Interface for interaction with a database server
   438 Interface for interaction with a database server
   406 Inherited by each data set type that can be stored
   439 Inherited by each data set type that can be stored
   407 @publishedAll
   440 @publishedAll
       
   441 @released
   408 */
   442 */
   409 {
   443 {
   410 public:
   444 public:
   411 
   445 
   412 	IMPORT_C virtual ~MMetaDatabase();
   446 	IMPORT_C virtual ~MMetaDatabase();
   438         Ensure the ElementId for this container fully identifies the target data in the database
   472         Ensure the ElementId for this container fully identifies the target data in the database
   439             <Table><Column><Record>
   473             <Table><Column><Record>
   440         Ensure that the session object has been initialised with the correct dataset version
   474         Ensure that the session object has been initialised with the correct dataset version
   441         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   475         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   442 
   476 
   443 	@publishedAll
       
   444 	*/
   477 	*/
   445 	IMPORT_C void LoadL(CMDBSession& aSession);
   478 	IMPORT_C void LoadL(CMDBSession& aSession);
   446 
   479 
   447 
   480 
   448 	/**
   481 	/**
   459 			EFalse if no data found that the client is authorised to view
   492 			EFalse if no data found that the client is authorised to view
   460             
   493             
   461         May also leave with KErrGeneral or other general error codes.
   494         May also leave with KErrGeneral or other general error codes.
   462 
   495 
   463         On failure, the container should be discarded or repopulated before it is used again
   496         On failure, the container should be discarded or repopulated before it is used again
   464 
   497 		
       
   498 		Please note - a case insensitive search is done in the case of text based fields
       
   499 		
   465     @pre
   500     @pre
   466 
   501 
   467         Populate this container where necessary with valid data to match during the find operation
   502         Populate this container where necessary with valid data to match during the find operation
   468         Ensure the ElementId for this container correcty identifies the target table in the database
   503         Ensure the ElementId for this container correcty identifies the target table in the database
   469             <Table><Column>
   504             <Table><Column>
   470         Ensure that the session object has been initialised with the correct dataset version
   505         Ensure that the session object has been initialised with the correct dataset version
   471         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   506         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   472 	@publishedAll
       
   473 	 */
   507 	 */
   474 	IMPORT_C TBool FindL(CMDBSession& aSession);
   508 	IMPORT_C TBool FindL(CMDBSession& aSession);
   475 
   509 
   476 
   510 
   477 	/**
   511 	/**
   497 
   531 
   498         Ensure the ElementId for this container fully identifies the target data in the database
   532         Ensure the ElementId for this container fully identifies the target data in the database
   499             <Table><Column><Record>
   533             <Table><Column><Record>
   500         Ensure that the session object has been initialised with the correct dataset version
   534         Ensure that the session object has been initialised with the correct dataset version
   501         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   535         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   502 	@publishedAll
       
   503 	*/
   536 	*/
   504 	IMPORT_C void RefreshL(CMDBSession& aSession);
   537 	IMPORT_C void RefreshL(CMDBSession& aSession);
   505 
   538 
   506 
   539 
   507 	/**
   540 	/**
   526 	        KErrAlreadyExists
   559 	        KErrAlreadyExists
   527 
   560 
   528         May also leave with other general error codes if there are unexpected 
   561         May also leave with other general error codes if there are unexpected 
   529         problems (e.g. KErrNoMemory when out of memory)
   562         problems (e.g. KErrNoMemory when out of memory)
   530 
   563 
   531 
   564 		Store will be atomic - all fields stored after success.  No fields stored if the function leaves
       
   565 		
   532         If StoreL fails or the later commit is not successful, The data in the container will not
   566         If StoreL fails or the later commit is not successful, The data in the container will not
   533         match the data in the database.  
   567         match the data in the database.  
   534 
   568 
   535         On failure, the container should be discarded or repopulated before it is used again
   569         On failure, the container should be discarded or repopulated before it is used again
   536 
   570 
   540         Ensure the ElementId for this container fully identifies the target location in the database
   574         Ensure the ElementId for this container fully identifies the target location in the database
   541             <Table><Column><Record>
   575             <Table><Column><Record>
   542         Ensure that the session object has been initialised with the correct dataset version
   576         Ensure that the session object has been initialised with the correct dataset version
   543         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   577         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   544         
   578         
   545 	@publishedAll
       
   546 	*/
   579 	*/
   547 	IMPORT_C void StoreL(CMDBSession& aSession);
   580 	IMPORT_C void StoreL(CMDBSession& aSession);
   548 
   581 
   549 
   582 
   550 	/**
   583 	/**
   551 	Modify all fields in the database that have been changed in this container by the caller
   584 	Modify all fields in the database that have been changed in this container by the caller
   552         
       
   553         Only modifies existing data in the database, won't create new fields  VCT - is this true?? don't think so
       
   554 	
   585 	
   555         Modification is atomic for this container.  It uses an internal transaction even if 
   586         Modification is atomic for this container.  It uses an internal transaction even if 
   556         no overall transaction set by client.
   587         no overall transaction set by client.
   557             All changed fields in the element are modified in database on success.  
   588             All changed fields in the element are modified in database on success.  
   558             No fields are altered in the database if the function leaves
   589             No fields are altered in the database if the function leaves
   560         Client can request to ignore access control flags by setting the attribute mask
   591         Client can request to ignore access control flags by setting the attribute mask
   561             CMDBSession::SetAttributeMask()
   592             CMDBSession::SetAttributeMask()
   562 		However, only fields that the client has capabilities to alter will be modified.in the database
   593 		However, only fields that the client has capabilities to alter will be modified.in the database
   563 		A request to modify data in an unauthorised area will cause the function to leave.with 
   594 		A request to modify data in an unauthorised area will cause the function to leave.with 
   564             KErrPermissionDenied
   595             KErrPermissionDenied
   565 
   596 		
   566         If field does not exist, the function will leave with 
       
   567             KErrNotFound [VCT - surely not]
       
   568 
   597 
   569 		May also leave with other general error codes if there are unexpected 
   598 		May also leave with other general error codes if there are unexpected 
   570         problems (e.g. KErrNoMemory when out of memory)
   599         problems (e.g. KErrNoMemory when out of memory)
   571 
   600 
   572         On failure, the container should be discarded or repopulated before it is used again
   601         On failure, the container should be discarded or repopulated before it is used again
   576         Populate this container with valid data for storage
   605         Populate this container with valid data for storage
   577         Ensure the ElementId for this container fully identifies the target data in the database
   606         Ensure the ElementId for this container fully identifies the target data in the database
   578             <Table><Column><Record>
   607             <Table><Column><Record>
   579         Ensure that the session object has been initialised with the correct dataset version
   608         Ensure that the session object has been initialised with the correct dataset version
   580         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   609         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   581 	@publishedAll
       
   582 	*/
   610 	*/
   583 	IMPORT_C void ModifyL(CMDBSession& aSession);
   611 	IMPORT_C void ModifyL(CMDBSession& aSession);
   584 
   612 
   585 
   613 
   586 	/**
   614 	/**
   599     @pre    Ensure the ElementId for this container fully identifies the target data in the database
   627     @pre    Ensure the ElementId for this container fully identifies the target data in the database
   600                 <Table><Column><Record>
   628                 <Table><Column><Record>
   601             Ensure that the session object has appropriate access control attributes to manage the target data in the database
   629             Ensure that the session object has appropriate access control attributes to manage the target data in the database
   602             Ensure the ElementId for this container correcty identifies the target data in the database
   630             Ensure the ElementId for this container correcty identifies the target data in the database
   603 
   631 
   604 	@publishedAll
       
   605 	*/
   632 	*/
   606 	IMPORT_C void DeleteL(CMDBSession& aSession);
   633 	IMPORT_C void DeleteL(CMDBSession& aSession);
   607 
   634 
   608 
   635 
   609 	/**
   636 	/**
   629     @params aSession        a valid session object
   656     @params aSession        a valid session object
   630     @params aRequestStatus  the requestStatus object that will be completed on notification
   657     @params aRequestStatus  the requestStatus object that will be completed on notification
   631     
   658     
   632     @pre    None
   659     @pre    None
   633     @post   A notification request will be outstanding
   660     @post   A notification request will be outstanding
   634 
       
   635 	@publishedAll
       
   636 	*/
   661 	*/
   637 	IMPORT_C TInt RequestNotification(CMDBSession&          aSession,
   662 	IMPORT_C TInt RequestNotification(CMDBSession&          aSession,
   638 									  TRequestStatus&        aRequestStatus);
   663 									  TRequestStatus&        aRequestStatus);
   639 
   664 
   640 	/**
   665 	/**
   646 
   671 
   647     @pres
   672     @pres
   648          
   673          
   649         There is an outstanding notification request
   674         There is an outstanding notification request
   650 
   675 
   651 	@publishedAll
       
   652 	*/
   676 	*/
   653 	IMPORT_C TInt CancelNotification(CMDBSession&       aSession,
   677 	IMPORT_C TInt CancelNotification(CMDBSession&       aSession,
   654 									 TRequestStatus&     aRequestStatus);
   678 									 TRequestStatus&     aRequestStatus);
   655 
   679 
   656 
   680 
   657 protected:
   681 protected:
   658 
   682 
   659 
   683 
   660 	explicit MMetaDatabase();
   684 	IMPORT_C explicit MMetaDatabase();
   661 
   685 
   662 private:
   686 private:
   663 
   687 
   664     /*
   688     /*
   665     @internalComponent
   689     @internalComponent
   666     */
   690     */
   667     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes);
   691     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes, TBool isTheLoadForMapper = EFalse);
   668 
   692 
   669     /*
   693     /*
   670     @internalComponent
   694     @internalComponent
   671     */
   695     */
   672     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes, RArray<TUint32>& aMatches);
   696     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes, RArray<TUint32>& aMatches, TBool isTheLoadForMapper = EFalse);
   673 
   697 
   674     /*
   698     /*
   675     @internalComponent
   699     @internalComponent
   676     */
   700     */
   677     void DoFindL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, RArray<TUint32>& candidates, RArray<TUint32>& matches);
   701     void DoFindL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, RArray<TUint32>& candidates, RArray<TUint32>& matches);
   696 
   720 
   697 
   721 
   698 
   722 
   699 
   723 
   700 class CMDBElement : public CBase, public MMetaDatabase
   724 class CMDBElement : public CBase, public MMetaDatabase
   701 /*
   725 /**
   702 Every item stored in the database is represented as a CMDBElement
   726 Every item stored in the database is represented as a CMDBElement
   703 This class contains the id and attributes of every item in the database
   727 This class contains the id and attributes of every item in the database
   704 and for individual fields it also contains the value.
   728 and for individual fields it also contains the value.
   705 
   729 
   706 @publishedAll
   730 @publishedAll
   710 public:
   734 public:
   711 
   735 
   712 
   736 
   713 	/**
   737 	/**
   714 	Default Constructor
   738 	Default Constructor
   715 
       
   716 	@publishedAll
       
   717 	*/
   739 	*/
   718 	IMPORT_C CMDBElement();
   740 	IMPORT_C CMDBElement();
   719 
   741 
   720 
   742 
   721 	/**
   743 	/**
   722 	Constructor
   744 	Constructor
   723 
       
   724 	@publishedAll
       
   725 	*/
   745 	*/
   726 	IMPORT_C CMDBElement(TMDBElementId aElementId);
   746 	IMPORT_C CMDBElement(TMDBElementId aElementId);
   727 	
   747 	
   728 	
   748 	
   729 	/**
   749 	/**
   730 	Destructor
   750 	Destructor
   731 
       
   732 	@publishedAll
       
   733 	*/
   751 	*/
   734 	IMPORT_C ~CMDBElement();
   752 	IMPORT_C ~CMDBElement();
   735 
   753 
   736 
   754 
   737 	// Accessors
   755 	// Accessors
   745 
   763 
   746 	This identifies the meaning of the field in the database schema
   764 	This identifies the meaning of the field in the database schema
   747 	It also identifies the type of the data stored in this element
   765 	It also identifies the type of the data stored in this element
   748 	and the instance of the type
   766 	and the instance of the type
   749 
   767 
   750 	@publishedAll
       
   751 	*/
   768 	*/
   752 	IMPORT_C TMDBElementId ElementId() const;
   769 	IMPORT_C TMDBElementId ElementId() const;
   753 
   770 
   754 
   771 
   755 	/**
   772 	/**
   763 	It also identifies the type of the data contained in this element
   780 	It also identifies the type of the data contained in this element
   764 
   781 
   765     For an element that is a Table or a Record, the ColumnId field will be set to 
   782     For an element that is a Table or a Record, the ColumnId field will be set to 
   766 
   783 
   767     KCDMaxColumnId
   784     KCDMaxColumnId
   768 	@publishedAll
       
   769 	*/
   785 	*/
   770 	IMPORT_C TMDBElementId  TypeId() const;
   786 	IMPORT_C TMDBElementId  TypeId() const;
   771 
   787 
   772 
   788 
   773 	/**
   789 	/**
   777 
   793 
   778 	<TableId><x><x>
   794 	<TableId><x><x>
   779 
   795 
   780 	It identifies the table in the database that holds the data contained in this element
   796 	It identifies the table in the database that holds the data contained in this element
   781 
   797 
   782 	@publishedAll
       
   783 	*/
   798 	*/
   784 	IMPORT_C TMDBElementId  TableId() const;
   799 	IMPORT_C TMDBElementId  TableId() const;
   785 
   800 
   786     
   801     
   787     /**
   802     /**
   789 
   804 
   790 	The RecordId is part of the ElementId <x><x><RecordId>
   805 	The RecordId is part of the ElementId <x><x><RecordId>
   791 
   806 
   792 	It identifies a particular instance of this type of Element in the database
   807 	It identifies a particular instance of this type of Element in the database
   793 
   808 
   794 	@publishedAll
       
   795 	*/
   809 	*/
   796 	IMPORT_C TInt RecordId() const;
   810 	IMPORT_C TInt RecordId() const;
   797 
   811 
   798 
   812 
   799 	/**
   813 	/**
   800 	Returns the Attributes of an object of this type.
   814 	Returns the Attributes of an object of this type.
   801 
   815 
   802 	Attributes express database access rights for the data of this element
   816 	Attributes express database access rights for the data of this element
   803 
   817 
   804 	@publishedAll
       
   805 	*/
   818 	*/
   806 	IMPORT_C TMDBAttributeFlags Attributes() const;
   819 	IMPORT_C TMDBAttributeFlags Attributes() const;
   807 
   820 
   808     // SETTER FUNCTIONS
   821     // SETTER FUNCTIONS
   809 
   822 
   810 	/**
   823 	/**
   811 	Sets the ElementId
   824 	Sets the ElementId
   812 
   825 
   813 	@publishedAll
       
   814 	*/
   826 	*/
   815 	IMPORT_C void SetElementId(TMDBElementId aElementId);
   827 	IMPORT_C void SetElementId(TMDBElementId aElementId);
   816 
   828 
   817 
   829 
   818 	/**
   830 	/**
   819 	Sets the TypeId
   831 	Sets the TypeId
   820 
   832 
   821 	@publishedAll
       
   822 	*/
   833 	*/
   823 	IMPORT_C void SetTypeId(TMDBElementId aElementId);
   834 	IMPORT_C void SetTypeId(TMDBElementId aElementId);
   824 
   835 
   825 
   836 
   826 	/**
   837 	/**
   827 	Sets the RecordId
   838 	Sets the RecordId
   828 
   839 
   829 	@publishedAll
       
   830 	*/
   840 	*/
   831 	IMPORT_C void SetRecordId(TInt aRecordId);
   841 	IMPORT_C void SetRecordId(TInt aRecordId);
   832 
   842 
   833 
   843 
   834 	/**
   844 	/**
   835 	Sets one or more attributes
   845 	Sets one or more attributes
   836 
   846 
   837 	@publishedAll
       
   838 	*/
   847 	*/
   839 	IMPORT_C void SetAttributes(TMDBAttributeFlags aAttributes);
   848 	IMPORT_C void SetAttributes(TMDBAttributeFlags aAttributes);
   840 
   849 
   841 
   850 
   842 	/**
   851 	/**
   843 	Clears one or more attributes
   852 	Clears one or more attributes
   844 
   853 
   845 	@publishedAll
       
   846 	*/
   854 	*/
   847 	IMPORT_C void ClearAttributes(TMDBAttributeFlags aAttributes);
   855 	IMPORT_C void ClearAttributes(TMDBAttributeFlags aAttributes);
   848 
   856 
   849 
   857 
   850 	/**
   858 	/**
   851 	Queries the attributes
   859 	Queries the attributes
   852 
   860 
   853 	Returns ETrue if all queried attributes are set
   861 	Returns ETrue if all queried attributes are set
   854 	Returns EFalse if any queried attribute is not set.
   862 	Returns EFalse if any queried attribute is not set.
   855 
       
   856 	@publishedAll
       
   857 	*/
   863 	*/
   858 	IMPORT_C TBool IsSetAttribute(TMDBAttributeFlags aAttributes) const;
   864 	IMPORT_C TBool IsSetAttribute(TMDBAttributeFlags aAttributes) const;
   859 
   865 
   860 
   866 
   861 	/**
   867 	/**
   862 	Queries the state of the field value
   868 	Queries the state of the field value
   863 
   869 
   864 	Returns ETrue if the value of the element is not set
   870 	Returns ETrue if the value of the element is not set
   865 	Returns EFalse if the element contains a value
   871 	Returns EFalse if the element contains a value
   866 
   872 
   867 	@publishedAll
       
   868 	*/
   873 	*/
   869 	IMPORT_C TBool IsNull() const;	
   874 	IMPORT_C TBool IsNull() const;	
   870 	
   875 	
   871 	
   876 	
   872 	
   877 	
   875     /**
   880     /**
   876 	Queries the type of the field value
   881 	Queries the type of the field value
   877 
   882 
   878 	Returns the enumeration TCDFieldValueTypes that represents the value that can be stored in this element
   883 	Returns the enumeration TCDFieldValueTypes that represents the value that can be stored in this element
   879 
   884 
   880 	@publishedAll
       
   881 	*/
   885 	*/
   882 
   886 
   883 	virtual TCDFieldValueTypes Type()=0;
   887 	virtual TCDFieldValueTypes Type()=0;
   884 
   888 
   885 	/**
   889 	/**
   886 	@internalComponent
   890 	@internalComponent
   887 	*/
   891 	*/
   888     TMDBElementId* Data(){return &iElementId;}
   892     TMDBElementId* Data(){return &iElementId;}
   889     
       
   890 	/**
       
   891 	@internalComponent
       
   892 	*/
       
   893     const TMDBElementId* CData(){return &iElementId;}
       
   894     
       
   895 
       
   896 	
   893 	
   897 protected:
   894 protected:
   898 
   895 
   899 	TMDBElementId     iElementId;
   896 	TMDBElementId     iElementId;
   900 	
   897 	
   903     };
   900     };
   904 
   901 
   905 
   902 
   906 
   903 
   907 
   904 
   908 ///////////////////////////////////////////////////////////////////////////////////////
   905 //
   909 //  COMMSDAT CONTAINERS
   906 //  COMMSDAT CONTAINERS
   910 //
   907 //
   911 
   908 
   912 /**
   909 /**
   913 Commsdat Container classes qualifying numeric values
   910 Commsdat Container classes qualifying numeric values
   914 @internalComponent 
   911 @publishedAll 
   915 */
   912 */
   916 class CMDBNumFieldBase : public CMDBElement
   913 class CMDBNumFieldBase : public CMDBElement
   917 {
   914 {
   918 public:
   915 public:
   919 	/**
   916 	/**
   924 
   921 
   925    	/**
   922    	/**
   926 	Constructor setting Field's ElementId
   923 	Constructor setting Field's ElementId
   927 	*/
   924 	*/
   928 	IMPORT_C CMDBNumFieldBase(TMDBElementId aFieldId);
   925 	IMPORT_C CMDBNumFieldBase(TMDBElementId aFieldId);
   929 		
   926 
   930 
   927 
   931     /**
   928     /**
   932 	Assignment operator for field value
   929 	Assignment operator for field value
   933 	*/
   930 	*/
   934 	IMPORT_C CMDBNumFieldBase& operator=(const TInt aValue);
   931 	IMPORT_C CMDBNumFieldBase& operator=(const TInt aValue);
   935 	
   932 	
   936     IMPORT_C void SetMaxLengthL(TInt aLength);
   933     IMPORT_C void SetMaxLengthL(TInt aLength);
   937     TMDBElementId GetL();
   934     TMDBElementId GetL();
   938 	     
   935 	     
   939     EXP_DATA_VTABLE
   936     EXP_DATA_VTABLE
   940 
   937         
       
   938 
       
   939 private:
   941 	virtual TCDFieldValueTypes Type()
   940 	virtual TCDFieldValueTypes Type()
   942 		{
   941 		{
   943 		return EInt;
   942 		return EInt;
   944 		}    
   943 		}    
   945     
   944     
   950 /**
   949 /**
   951 A thin template that guards typed data access in a single CMDBElement
   950 A thin template that guards typed data access in a single CMDBElement
   952 This class describes a single numeric field in the database
   951 This class describes a single numeric field in the database
   953 
   952 
   954 @publishedAll
   953 @publishedAll
       
   954 @released
   955 */
   955 */
   956 {
   956 {
   957 public:
   957 public:
   958 
   958 
   959 	/**
   959 	/**
   960 	Default Constructor
   960 	Default Constructor
   961 
       
   962 	@publishedAll
       
   963 	*/
   961 	*/
   964 	inline CMDBField()
   962 	inline CMDBField()
   965 		{
   963 		{
   966 		}
   964 		}
   967 
   965 
   968 	/**
   966 	/**
   969 	Constructor setting Field's ElementId
   967 	Constructor setting Field's ElementId
   970 
       
   971 	@publishedAll
       
   972 	*/
   968 	*/
   973 	inline CMDBField(TMDBElementId aFieldId)
   969 	inline CMDBField(TMDBElementId aFieldId)
   974 		: CMDBNumFieldBase(aFieldId)
   970 		: CMDBNumFieldBase(aFieldId)
   975 		{
   971 		{
   976 		}
   972 		}
   977 
   973 
   978 
   974 
   979 	/**
   975 	/**
   980 	Assignment operator for field value
   976 	Assignment operator for field value
   981 
       
   982 	@publishedAll
       
   983 	*/
   977 	*/
   984 	inline CMDBField<TYPE>& operator=(const TYPE& aValue)
   978 	inline CMDBField<TYPE>& operator=(const TYPE& aValue)
   985 	{
   979 	{
   986     	return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=((TInt&)aValue);
   980     	return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=((TInt&)aValue);
   987 	}
   981 	}
   992 	    return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=(aValue);
   986 	    return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=(aValue);
   993 	}
   987 	}
   994 	
   988 	
   995 	/**
   989 	/**
   996 	Conversion operator for field value
   990 	Conversion operator for field value
   997 
       
   998 	@publishedAll
       
   999 	*/
   991 	*/
  1000 	inline operator TYPE&()
   992 	inline operator TYPE&()
  1001 	{
   993 	{
  1002 		return (TYPE&)iValue;
   994 		return (TYPE&)iValue;
  1003 	}
   995 	}
  1004 	
   996 	
  1005 	/**
   997 	/**
  1006 	Conversion operator for field value
   998 	Conversion operator for field value
  1007 
       
  1008 	@publishedAll
       
  1009 	*/
   999 	*/
  1010 	inline CMDBField<TYPE>& GetL()
  1000 	inline CMDBField<TYPE>& GetL()
  1011 	{
  1001 	{
  1012 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1002 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1013 			{
  1003 			{
  1017 		return (TYPE&)iValue;
  1007 		return (TYPE&)iValue;
  1018 	}
  1008 	}
  1019 	
  1009 	
  1020 	/**
  1010 	/**
  1021 	Function for setting a value
  1011 	Function for setting a value
  1022 
       
  1023 	@publishedAll
       
  1024 	*/
  1012 	*/
  1025 	inline void SetL(const TYPE& aValue)
  1013 	inline void SetL(const TYPE& aValue)
  1026 	{
  1014 	{
  1027 	CMDBNumFieldBase::operator=(aValue);
  1015 	CMDBNumFieldBase::operator=(aValue);
  1028 	}
  1016 	}
  1029 	
  1017 	
  1030 };
  1018 };
  1031 
  1019 
  1032 
  1020 
  1033 
  1021 
  1034 //////////////////
  1022 //
  1035 /**
  1023 /**
  1036 Base Container class qualifying a text field
  1024 Base Container class qualifying a text field
  1037 @internalComponent
  1025 @publishedAll
  1038 */
  1026 */
  1039 class CMDBTextFieldBase : public CMDBElement
  1027 class CMDBTextFieldBase : public CMDBElement
  1040 {
  1028 {
  1041 public:
  1029 public:
  1042 	/**
  1030 	/**
  1063 	
  1051 	
  1064 	    	
  1052 	    	
  1065     IMPORT_C void SetMaxLengthL(TInt aLength);
  1053     IMPORT_C void SetMaxLengthL(TInt aLength);
  1066 
  1054 
  1067     EXP_DATA_VTABLE
  1055     EXP_DATA_VTABLE
  1068     
  1056 
       
  1057 private:
  1069 	virtual TCDFieldValueTypes Type()
  1058 	virtual TCDFieldValueTypes Type()
  1070 		{
  1059 		{
  1071 		return EText;
  1060 		return EText;
  1072 		}    
  1061 		}    
  1073 
  1062 
  1084 /**
  1073 /**
  1085 A thin template that guards typed data access in a single CMDBElement
  1074 A thin template that guards typed data access in a single CMDBElement
  1086 This class describes a single field in the database
  1075 This class describes a single field in the database
  1087 
  1076 
  1088 @publishedAll
  1077 @publishedAll
       
  1078 @released
  1089 */
  1079 */
  1090 {
  1080 {
  1091 public:
  1081 public:
  1092 
  1082 
  1093 	/**
  1083 	/**
  1094 	Default Constructor
  1084 	Default Constructor
  1095 
       
  1096 	@publishedAll
       
  1097 	*/
  1085 	*/
  1098 	inline CMDBField()
  1086 	inline CMDBField()
  1099 		{
  1087 		{
  1100 		}
  1088 		}
  1101 
  1089 
  1102 	/**
  1090 	/**
  1103 	Constructor setting Field's ElementId
  1091 	Constructor setting Field's ElementId
  1104 
       
  1105 	@publishedAll
       
  1106 	*/
  1092 	*/
  1107 	inline CMDBField(TMDBElementId aFieldId)
  1093 	inline CMDBField(TMDBElementId aFieldId)
  1108 		: CMDBTextFieldBase(aFieldId)
  1094 		: CMDBTextFieldBase(aFieldId)
  1109 		{
  1095 		{
  1110 		}
  1096 		}
  1128         return *this;   
  1114         return *this;   
  1129 	}
  1115 	}
  1130 
  1116 
  1131 	/**
  1117 	/**
  1132 	Conversion operator for field value
  1118 	Conversion operator for field value
  1133 
       
  1134 	@publishedAll
       
  1135 	*/
  1119 	*/
  1136 	inline operator const TDesC&()
  1120 	inline operator const TDesC&()
  1137 	{
  1121 	{
  1138         if (! iValue)
  1122         if (! iValue)
  1139             return KNullDesC;
  1123             return KNullDesC;
  1141 		return *(HBufC*)iValue;
  1125 		return *(HBufC*)iValue;
  1142 	}
  1126 	}
  1143 	
  1127 	
  1144 	/**
  1128 	/**
  1145 	Conversion operator for field value
  1129 	Conversion operator for field value
  1146 
       
  1147 	@publishedAll
       
  1148 	*/
  1130 	*/
  1149 	inline TDesC& GetL()
  1131 	inline TDesC& GetL()
  1150 	{
  1132 	{
  1151 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1133 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1152 			{
  1134 			{
  1156 		return *(HBufC*)iValue;
  1138 		return *(HBufC*)iValue;
  1157 	}
  1139 	}
  1158 	
  1140 	
  1159 	/**
  1141 	/**
  1160 	Function for setting a value
  1142 	Function for setting a value
  1161 
       
  1162 	@publishedAll
       
  1163 	*/
  1143 	*/
  1164 	inline void SetL(const TDesC& aValue)
  1144 	inline void SetL(const TDesC& aValue)
  1165 	{
  1145 	{
  1166 	SetMaxLengthL(aValue.Length());
  1146 	SetMaxLengthL(aValue.Length());
  1167 	CMDBTextFieldBase::operator=(aValue);
  1147 	CMDBTextFieldBase::operator=(aValue);
  1169 	
  1149 	
  1170 	
  1150 	
  1171 };
  1151 };
  1172 
  1152 
  1173 
  1153 
  1174 //////////////////
  1154 //
  1175 /**
  1155 /**
  1176 Container class for qualifying binary values
  1156 Container class for qualifying binary values
  1177 @internalComponent 
  1157 @publishedAll 
  1178 */
  1158 */
  1179 class CMDBBinFieldBase : public CMDBElement
  1159 class CMDBBinFieldBase : public CMDBElement
  1180 {
  1160 {
  1181 public:
  1161 public:
  1182 	/**
  1162 	/**
  1206 	To allocate space for field data.
  1186 	To allocate space for field data.
  1207 	*/
  1187 	*/
  1208 	IMPORT_C void SetMaxLengthL(TInt aLength);
  1188 	IMPORT_C void SetMaxLengthL(TInt aLength);
  1209 
  1189 
  1210     EXP_DATA_VTABLE
  1190     EXP_DATA_VTABLE
  1211     
  1191 
       
  1192 private:
  1212 	virtual TCDFieldValueTypes Type()
  1193 	virtual TCDFieldValueTypes Type()
  1213 		{
  1194 		{
  1214 		return EDesC8;
  1195 		return EDesC8;
  1215 		}    
  1196 		}    
  1216 };
  1197 };
  1221 /**
  1202 /**
  1222 A thin template that guards typed data access in a single CMDBElement
  1203 A thin template that guards typed data access in a single CMDBElement
  1223 This class describes a single field in the database
  1204 This class describes a single field in the database
  1224 
  1205 
  1225 @publishedAll
  1206 @publishedAll
       
  1207 @released
  1226 */
  1208 */
  1227 {
  1209 {
  1228 public:
  1210 public:
  1229 
  1211 
  1230 	/**
  1212 	/**
  1231 	Default Constructor
  1213 	Default Constructor
  1232 
       
  1233 	@publishedAll
       
  1234 	*/
  1214 	*/
  1235 	inline CMDBField()
  1215 	inline CMDBField()
  1236 		{
  1216 		{
  1237 		}
  1217 		}
  1238 
  1218 
  1239 	/**
  1219 	/**
  1240 	Constructor setting Field's ElementId
  1220 	Constructor setting Field's ElementId
  1241 
       
  1242 	@publishedAll
       
  1243 	*/
  1221 	*/
  1244 	inline CMDBField(TMDBElementId aFieldId)
  1222 	inline CMDBField(TMDBElementId aFieldId)
  1245 		: CMDBBinFieldBase(aFieldId)
  1223 		: CMDBBinFieldBase(aFieldId)
  1246 		{
  1224 		{
  1247 		}
  1225 		}
  1266     	}
  1244     	}
  1267 
  1245 
  1268 
  1246 
  1269 	/**
  1247 	/**
  1270 	Conversion operator for field value
  1248 	Conversion operator for field value
  1271 
       
  1272 	@publishedAll
       
  1273 	*/
  1249 	*/
  1274 	inline operator const TDesC8&()
  1250 	inline operator const TDesC8&()
  1275     	{
  1251     	{
  1276 		    if (! iValue)
  1252 		    if (! iValue)
  1277                 return KNullDesC8;
  1253                 return KNullDesC8;
  1279     		return *(HBufC8*)iValue;
  1255     		return *(HBufC8*)iValue;
  1280     	}
  1256     	}
  1281     	
  1257     	
  1282     /**
  1258     /**
  1283 	Conversion operator for field value
  1259 	Conversion operator for field value
  1284 
       
  1285 	@publishedAll
       
  1286 	*/
  1260 	*/
  1287 	inline TDesC8& GetL()
  1261 	inline TDesC8& GetL()
  1288 	{
  1262 	{
  1289 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1263 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1290 			{
  1264 			{
  1294     	return *(HBufC8*)iValue;
  1268     	return *(HBufC8*)iValue;
  1295 	}
  1269 	}
  1296 	
  1270 	
  1297 	/**
  1271 	/**
  1298 	Function for setting a value
  1272 	Function for setting a value
  1299 
       
  1300 	@publishedAll
       
  1301 	*/
  1273 	*/
  1302 	inline void SetL(const TDesC8& aValue)
  1274 	inline void SetL(const TDesC8& aValue)
  1303 	{
  1275 	{
  1304 	SetMaxLengthL(aValue.Length());
  1276 	SetMaxLengthL(aValue.Length());
  1305 	CMDBBinFieldBase::operator=(aValue);
  1277 	CMDBBinFieldBase::operator=(aValue);
  1307 	
  1279 	
  1308 };
  1280 };
  1309 
  1281 
  1310 
  1282 
  1311 
  1283 
  1312 ///////////////////////////////////////////////////////////////////////////////////////////////
  1284 //
  1313 
  1285 
  1314 /**
  1286 /**
  1315 Base class for CMDBRecordLink
  1287 Base class for CMDBRecordLink
  1316 @internalComponent 
  1288 @publishedAll 
  1317 */
  1289 */
  1318 class CMDBRecordLinkBase : public CMDBNumFieldBase
  1290 class CMDBRecordLinkBase : public CMDBNumFieldBase
  1319 {
  1291 {
  1320 public :	
  1292 public :	
  1321 
  1293 
  1339 	Conversion operator for field value
  1311 	Conversion operator for field value
  1340 	which gets the id of the element list
  1312 	which gets the id of the element list
  1341 	*/
  1313 	*/
  1342 	IMPORT_C operator TMDBElementId();
  1314 	IMPORT_C operator TMDBElementId();
  1343 
  1315 
       
  1316 
       
  1317 protected:
       
  1318 
       
  1319 	EXP_DATA_VTABLE
       
  1320 
       
  1321 private:
  1344     TCDFieldValueTypes Type()
  1322     TCDFieldValueTypes Type()
  1345 		{
  1323 		{
  1346 		return ELink;
  1324 		return ELink;
  1347 		}    
  1325 		}    
  1348 
       
  1349 protected:
       
  1350 
       
  1351 	EXP_DATA_VTABLE
       
  1352 
       
  1353 public:
  1326 public:
  1354     
  1327     
  1355 	// the record referenced by the link id stored in the value of this field.
  1328 	// the record referenced by the link id stored in the value of this field.
  1356 	CMDBElement*     iLinkedRecord;
  1329 	CMDBElement*     iLinkedRecord;
  1357 
  1330 
  1366  The value of a CMDBRecordLink field as stored in the database is the 
  1339  The value of a CMDBRecordLink field as stored in the database is the 
  1367  ElementId (<Table><Record>) of the linked record.
  1340  ElementId (<Table><Record>) of the linked record.
  1368 
  1341 
  1369  The linked record itself can be viewed via the iLinkedRecord member and its accessors
  1342  The linked record itself can be viewed via the iLinkedRecord member and its accessors
  1370  
  1343  
  1371  iLinkedRecord must be created explicitly by the client - either on construction, 
  1344  If a record is loaded then the iLinkedRecord must be created explicitly 
  1372  or by use of the CreateLinkL or SetLinkL functions. Often the linked record is not 
  1345  by the client - either on construction, or by use of the CreateLinkL or 
  1373  required by a caller.  So creating it automatically would just waste memory
  1346  SetLinkL functions. Often the linked record is not required by a caller.  
       
  1347  So creating it automatically would just waste memory
       
  1348  
       
  1349  However in the case of an explicit load of a LinkedRecord field the ILinkedRecord
       
  1350  is created.
  1374  
  1351  
  1375  When instantiating iLinkedRecord directly take care to match the object's type to the Type 
  1352  When instantiating iLinkedRecord directly take care to match the object's type to the Type 
  1376  ID that will be found at the linking element.  It is better to use the CreateLinkL or 
  1353  ID that will be found at the linking element.  It is better to use the CreateLinkL or 
  1377  SetLinkL functions to ensure type safety
  1354  SetLinkL functions to ensure type safety
  1378  
  1355  
  1383 */
  1360 */
  1384 {
  1361 {
  1385 public :
  1362 public :
  1386 	/**
  1363 	/**
  1387 	Constructor/Destructor
  1364 	Constructor/Destructor
  1388 
       
  1389 	@publishedAll
       
  1390 	*/
  1365 	*/
  1391 
  1366 
  1392 	inline CMDBRecordLink()
  1367 	inline CMDBRecordLink()
  1393 		: CMDBRecordLinkBase() {}
  1368 		: CMDBRecordLinkBase() {}
  1394 
  1369 
  1395 	/**
  1370 	/**
  1396 	Constructor
  1371 	Constructor
  1397 
       
  1398 	@publishedAll
       
  1399 	*/
  1372 	*/
  1400 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId)
  1373 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId)
  1401 		: CMDBRecordLinkBase(aLinkingFieldId) {}
  1374 		: CMDBRecordLinkBase(aLinkingFieldId) {}
  1402 
  1375 
  1403 	/**
  1376 	/**
  1404 	Constructor
  1377 	Constructor
  1405 
       
  1406 	@publishedAll
       
  1407 	*/
  1378 	*/
  1408 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId, RECORD_TYPE* aLinkedRecord)
  1379 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId, RECORD_TYPE* aLinkedRecord)
  1409 		: CMDBRecordLinkBase(aLinkingFieldId, (CMDBElement*)aLinkedRecord) {}
  1380 		: CMDBRecordLinkBase(aLinkingFieldId, (CMDBElement*)aLinkedRecord) {}
  1410 
  1381 
  1411 	/**
       
  1412 	@publishedAll
       
  1413 	*/
       
  1414 	inline CMDBRecordLink& operator=(const TMDBElementId aValue)
  1382 	inline CMDBRecordLink& operator=(const TMDBElementId aValue)
  1415 	{
  1383 	{
  1416 		return (CMDBRecordLink&)CMDBRecordLinkBase::operator=(aValue);
  1384 		return (CMDBRecordLink&)CMDBRecordLinkBase::operator=(aValue);
  1417 	}
  1385 	}
  1418 	
  1386 	
  1419 
  1387 
  1420     // SETTERS
  1388     // SETTERS
  1421 
  1389 
  1422 	/**
  1390 	/**
  1423 	Set the field value (this will be validated on StoreL)
  1391 	Set the field value (this will be validated on StoreL)
  1424 
       
  1425 	@publishedAll
       
  1426 	*/
  1392 	*/
  1427 	inline void SetL(const TMDBElementId aValue)
  1393 	inline void SetL(const TMDBElementId aValue)
  1428 		{
  1394 		{
  1429 		CMDBRecordLinkBase::operator=(aValue);
  1395 		CMDBRecordLinkBase::operator=(aValue);
  1430 		}
  1396 		}
  1432 
  1398 
  1433     // OPERATORS
  1399     // OPERATORS
  1434 
  1400 
  1435 	/**
  1401 	/**
  1436 	conversion operator for linked record of this type
  1402 	conversion operator for linked record of this type
  1437 
       
  1438 	@publishedAll
       
  1439 	*/
  1403 	*/
  1440 	inline operator RECORD_TYPE*()
  1404 	inline operator RECORD_TYPE*()
  1441 	{
  1405 	{
  1442 		return static_cast<RECORD_TYPE*>(iLinkedRecord);
  1406 		return static_cast<RECORD_TYPE*>(iLinkedRecord);
  1443 	}	
  1407 	}	
  1445 };
  1409 };
  1446 
  1410 
  1447 enum TFieldTypeAttributes
  1411 enum TFieldTypeAttributes
  1448 /**
  1412 /**
  1449 To express type information for all MetaDatabase fields
  1413 To express type information for all MetaDatabase fields
  1450 @publishedAll
  1414 */
  1451 @released
  1415 	{
  1452 */
  1416 	ENoAttrs,	//< No attributes associated with this field.
  1453 	{
  1417 	ENotNull, 	//< Ensures the field contains a value and must not be null.	
  1454 	ENoAttrs,	///< No attributes associated with this field.
       
  1455 	ENotNull, 	///< Ensures the field contains a value and must not be null.	
       
  1456 	};
  1418 	};
  1457 
  1419 
  1458 typedef struct
  1420 typedef struct
  1459 /**
  1421 /**
  1460 To express type information for all MetaDatabase fields
  1422 To express type information for all MetaDatabase fields
  1461 @publishedAll
  1423 */
  1462 @released
  1424 	{
  1463 */
  1425 		const TMDBElementId	        iTypeId;		//< Identifier for the field.	
  1464 	{
  1426 		const TInt                  iValType;		//< The field type value e.g.EText, EMedText.
  1465 		const TMDBElementId	        iTypeId;		///< Identifier for the field.	
  1427 	    const TFieldTypeAttributes	iTypeAttr;		//< The field attribute, either ENoAttrs or ENotNull.
  1466 		const TInt                  iValType;		///< The field type value e.g.EText, EMedText.
  1428         const TText * const         iTypeName;		//< Name of the field type.
  1467 	    const TFieldTypeAttributes	iTypeAttr;		///< The field attribute, either ENoAttrs or ENotNull.
       
  1468         const TText * const         iTypeName;		///< Name of the field type.
       
  1469 	    
  1429 	    
  1470 	} SRecordTypeInfo;
  1430 	} SRecordTypeInfo;
  1471 
  1431 
  1472 
  1432 
  1473 #define MDB_GENERIC_TYPE_INFO(a, b, c, d) SGenericRecordTypeInfo(a, b, c, d)
  1433 #define MDB_GENERIC_TYPE_INFO(a, b, c, d) SGenericRecordTypeInfo(a, b, c, d)
  1475 typedef TBuf<64> TGenericTypeName;
  1435 typedef TBuf<64> TGenericTypeName;
  1476 
  1436 
  1477 typedef struct SGenericRecordTypeInfoTag
  1437 typedef struct SGenericRecordTypeInfoTag
  1478 /**
  1438 /**
  1479 To express type information for all MetaDatabase fields
  1439 To express type information for all MetaDatabase fields
  1480 @publishedAll
       
  1481 @released
       
  1482 */
  1440 */
  1483 	{
  1441 	{
  1484 	     SGenericRecordTypeInfoTag()
  1442 	     SGenericRecordTypeInfoTag()
  1485     	     : iTypeId(0), iValType(0), iTypeAttr(ENoAttrs) {}
  1443     	     : iTypeId(0), iValType(0), iTypeAttr(ENoAttrs) {}
  1486 
  1444 
  1506 	                                     TFieldTypeAttributes aAttrType,
  1464 	                                     TFieldTypeAttributes aAttrType,
  1507 	                               const TGenericTypeName&    aTypeName)
  1465 	                               const TGenericTypeName&    aTypeName)
  1508     	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName) {}
  1466     	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName) {}
  1509 
  1467 
  1510 
  1468 
  1511 		 TMDBElementId	       iTypeId;			///< Identifier for the field type.	
  1469 		 TMDBElementId	       iTypeId;			//< Identifier for the field type.	
  1512 		 TInt                  iValType;		///< The field type value e.g.EText, EMedText.
  1470 		 TInt                  iValType;		//< The field type value e.g.EText, EMedText.
  1513 	     TFieldTypeAttributes  iTypeAttr;		///< The type's attribute, either ENoAttrs or ENotNull
  1471 	     TFieldTypeAttributes  iTypeAttr;		//< The type's attribute, either ENoAttrs or ENotNull
  1514          TGenericTypeName	   iTypeName;		///< Name of the field type.
  1472          TGenericTypeName	   iTypeName;		//< Name of the field type.
  1515 	} SGenericRecordTypeInfo;
  1473 	} SGenericRecordTypeInfo;
  1516 	
  1474 	
  1517 	
  1475 	
  1518 
  1476 
  1519 class CMDBRecordBase : public CMDBNumFieldBase
  1477 class CMDBRecordBase : public CMDBNumFieldBase
  1598 @publishedAll
  1556 @publishedAll
  1599 @released
  1557 @released
  1600 */
  1558 */
  1601     {
  1559     {
  1602     public:
  1560     public:
  1603 		/**
       
  1604 		@internalComponent
       
  1605 		*/
       
  1606     	IMPORT_C CMDBRecordSetBase();
  1561     	IMPORT_C CMDBRecordSetBase();
  1607 
  1562 
  1608 		/**
       
  1609 		@internalComponent
       
  1610 		*/
       
  1611     	IMPORT_C CMDBRecordSetBase(TMDBElementId aElementId);
  1563     	IMPORT_C CMDBRecordSetBase(TMDBElementId aElementId);
  1612 
  1564 
  1613 		/**
       
  1614 		@internalComponent
       
  1615 		*/
       
  1616     	IMPORT_C ~CMDBRecordSetBase();
  1565     	IMPORT_C ~CMDBRecordSetBase();
  1617 
  1566 
  1618         inline CMDBRecordSetBase& operator=(const TPtrC& aValue)
  1567         inline CMDBRecordSetBase& operator=(const TPtrC& aValue)
  1619         {
  1568         {
  1620         return (CMDBRecordSetBase&)CMDBTextFieldBase::operator=(aValue);
  1569         return (CMDBRecordSetBase&)CMDBTextFieldBase::operator=(aValue);
  1637 /**
  1586 /**
  1638 Use this class to express a list of records of a particular MetaDatabase Element type
  1587 Use this class to express a list of records of a particular MetaDatabase Element type
  1639 Records can be ordered using the standard RPointerArray functions
  1588 Records can be ordered using the standard RPointerArray functions
  1640 
  1589 
  1641 @publishedAll
  1590 @publishedAll
       
  1591 @released
  1642 */
  1592 */
  1643 {
  1593 {
  1644 public:
  1594 public:
  1645 
  1595 
  1646 	inline CMDBRecordSet(){}
  1596 	inline CMDBRecordSet(){}
  1660 
  1610 
  1661 private:
  1611 private:
  1662 
  1612 
  1663 };
  1613 };
  1664 
  1614 
  1665 
       
  1666 
       
  1667 
       
  1668 } //end namespace CommsDat
  1615 } //end namespace CommsDat
  1669 
  1616 
  1670 #endif  // METADATABASE_H
  1617 #endif  // METADATABASE_H