Creatio development guide
PDF
This documentation is valid for Creatio version 7.15.0. We recommend using the newest version of Creatio documentation.

Synchronizing metadata in Creatio

Glossary Item Box

General information

The auxiliary SysSyncMetaData metadata table is used for synchronization, which is the junction between the outer RemoteItem table (synchronizing element in external storage) and LocalItem (synchronization element in Creatio). Each table row is represented in the system as an instance of SysSyncMetaData. The SysSyncMetaData class properties are shown in Table 1.

Table 1. SysSyncMetaData class properties.

Parameter Type Description
RemoteId String Element ID in external storage
SyncSchemaName String Synchronized element schema name.
LocalId Guid Element ID in local storage
IsLocalDeleted Boolean It indicates whether an item has been removed from the local storage since the last synchronization. The parameter is updated before the synchronization and application of changes in the local storage. On the basis of its value, when selecting modified elements from local storage, the SyncEntity state is set. Obsolete, left for compatibility. LocalState is currently used.
IsRemoteDeleted Boolean It indicates whether an item has been removed from the external storage since the last synchronization. Obsolete, left for compatibility. RemoteState is currently used.
Version Date Date of the last element modification.
ModifiedInStoreId Guid ID of storage in which the last modification was performed.
CreatedInStoreId Guid ID of storage in which the synchronization element was created.
RemoteStoreId Guid ID of external storage with which the element was synchronized.
ExtraParameters String Additional element parameters.
LocalState Int Element state in local storage (0 - not modified, 1 - new, 2 - modified, 3 - deleted).
RemoteState Int Element state in external storage (0 - not modified, 1 - new, 2 - modified, 3 - deleted).

Only information about synchronized elements is stored in the metadata.

There can be multiple metadata table records for a single synchronization element - one for each application object included in a synchronization element.

Activity and participants — a single synchronization element. However, the metadata contains one record for each activity and one record for each participant.

Currently, only one object from external storage is transformed into several Creatio objects, as shown in Fig. 1.

Fig. 1. Schema of transformation of an external storage object into a local storage object.

The metadata system for a single synchronization element is represented as the ItemMetadata object class (SysSyncMetaData element collection). Metadata management is carried out through the class that implements the IReplicaMetadata interface. An instance of the class that implements the IReplicaMetadata interface is created via the MetaDataStore factory class for a particular storage.

MetaDataStore class

Creates the specific class instance that implements the IReplicaMetadata interface for a storage. The class methods are shown in Table 2.

Table 2. MetaDataStore class methods

Method Returned value type Description
GetReplicaMetadata(Guid localStoreId, Guid remoteStoreId) IreplicaMetadata Creates the class instance that implements the IReplicaMetadata interface for the specific storage.

ItemMetadata class

This class is an indivisible object of metadata synchronization. It contains a set of metadata for each synchronization element (SysSyncMetadata element collection). The class properties are shown in Table 3.

Table 3. SysSyncMetaData class properties.

Parameter Type Description
RemoteId String Element ID in external storage
RemoteItemName String Element name in external storage

IReplicaMetadata interface

This class implements the IReplicaMetadata interface, encapsulates the synchronization metadata and works with ItemMetadata objects. The interface properties are shown in table 4 and methods in table 5.

Table 4. The IReplicaMetadata interface properties

Parameter Type Description
RemoteStoreId Guid External storage ID.
LocalStoreId Guid Local storage ID.


Table 5. The IReplicaMetadata interface methods

Method Returned value type Description
FindItemStore (string remoteItemId) ItemMetadata Finds and returns the ItemMetadata synchronization metadata object by an ID in the remoteItemnId external storage.
UpdateItemMetadata (ItemMetadata oldItemMetaDatas, IRemoteItem remoteItem, LocalItem localItem, bool changesToBpm) Void Updates metadata after synchronization.
EnumerateItemsWithChangesInBpm (SyncContext context) IEnumerable<ItemMetadata> Returns a collection of ItemMetadata objects that have been modified since the last synchronization and not processed during the current synchronization session.
CollectChangesInSyncedEntities (UserConnection userConnection, string schemaName, DateTime lastSyncVersion) Void Updates metadata for synchronization elements modified in Creatio. If an element has been modified since the last SysMetadata synchronization, the Version column will be filled in with the date of element modification. The ActualizeSysSyncMetaData procedure is used to update metadata.
CollectNewDetailsForSyncedEntities (UserConnection userConnection, DetailEntityConfig detailEntityConfig, string remoteItemName) Void Creates new records in the SysSyncMetaData table for the synchronization element details.
TryResolveRemoteId (Guid localId, out string remoteId) Boolean Returns the element ID in the external remoteId storage from metadata by a unique localId synchronization element in Creatio. If an element is marked as deleted, the remoteId wil not be returned, and the method will return false.
TryResolveExtraParameters (Guid localId, out string extraParameters) Boolean Returns additional extraParameters parameters for the synchronization element by localId. If extraParameters are not found, the method returns false.

 

© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?