ICubeMetaUpdateAdditionalObject.DescriptorOnly

Fore Syntax

DescriptorOnly: Boolean;

Fore.NET Syntax

DescriptorOnly: Boolean;

Description

The DescriptorOnly property determines whether copied object includes object descriptors only.

Comments

If the property is set to True, only object descriptor is included into the copied object. This case requires that object of the same class and with the same identifier to be present in the repository where it is copied, or the Target property must be set. If the Target property is specified for the object, on copying the database copy is set to use the object specified in the Target property. If the object is absent in the repository where copying is executed and the Target property is not set, an exception is thrown on copying.

If the time series database is based on shortcuts, the DescriptorOnly property can be used for the dictionaries that are referred via these shortcuts. In this case on copying the shortcut is reconfigured to the dictionary specified in the Target property. The dictionary itself is not copied.

If the property is set to False, the copying object will include the whole object (description, parameters, structure and object data according to the settings of the DataSettings property). And if the object exists in the repository, to which the copying is executed, it is refreshed, otherwise a new object is created.

The property is set to False by default.

NOTE. It is impossible to set the DescriptorOnly property to True if the TargetParent property is specified to the object.

Fore Example

Executing the example requires two repositories. Both repositories are located on one server. MDM repositories with the MDM identifier are created in each repository. MDM repositories contain the UNITS and MEASURES dictionaries required for correct work of time series databases. The first repository contains the FC time series database that will be copied to the second repository. An additional attribute based on MDM repository shortcut is created in the database. The shortcut has the SHORTCUT_COUNTRY identifier, the MDM dictionary, to which this shortcut refers, has the COUNTRY identifier. The COUNTRY_1 dictionary is created in the MDM repository of the second repository.

Sub UserProc;
Var
    Mb, Mb2: IMetabase;
    Rds, Rds2: IRdsDatabase;
    Update: ICubeMetaUpdateEx;
    CreateInfo: IMetabaseObjectCreateInfo;
    Rubr: IRubricator;
    Remapings: ICubeMetaUpdateDictionaryRemapings;
    Remap: ICubeMetaUpdateDictionaryRemaping;
    Prerequisite: ICubeMetaUpdateAdditionalObjects;
    PrerequisiteObj: ICubeMetaUpdateAdditionalObject;
Begin
    Mb := MetabaseClass.Active;
    //Create a copying object
    Update := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
    Update.Metabase := Mb;
    Rubr := Mb.ItemById("FC").Bind As IRubricator;
    //Database to be copied
    Update.Rubricator := Rubr;
    //...
    Mb2 := //Connection to repository to which copying is executed
    //...
    CreateInfo := Update.CreateInfo;
    CreateInfo.Parent := Mb2.Root;
    CreateInfo.Id := "FC_Copy";
    CreateInfo.Name := "FC_Copy";
    //MDM repository in source repository
    Rds := Mb.ItemById("RDS").Bind As IRdsDatabase;
    //MDM repository in the repository, to which copying is executed
    Rds2 := Mb2.ItemById("RDS").Bind As IRdsDatabase;
    Update.RdsDatabase := Rds2;
    //Reconfigure dictionaries
    Remapings := Update.DictionaryRemapings;
    Remap := Remapings.FindById("UNITS");
    Remap.Target := Mb2.ItemByIdNamespace("UNITS", (Rds2 As IMetabaseObject).Key);
    Remap := Remapings.Add;
    Remap.SourceId := "MEASURES";
    Remap.Target := Mb2.ItemByIdNamespace("MEASURES", (Rds2 As IMetabaseObject).Key);
    //Set up objects copied before time series database
    Prerequisite := Update.PrerequisiteObjects;
    //The COUNTRY source dictionary
    PrerequisiteObj := Prerequisite.Add(MB.ItemByIdNamespace("COUNTRY", (Rds As IMetabaseObject).Key));
    //Dictionary to be used in the database copy instead of the COUNTRY dictionary
    PrerequisiteObj.Target := MB2.ItemByIdNamespace("COUNTRY_1", (Rds2 As IMetabaseObject).Key);
    PrerequisiteObj.DescriptorOnly := True;
    //Shortcut for the MDM repository, on which attribute of time series database is based
    PrerequisiteObj := Prerequisite.Add(MB.ItemById("SHORTCUT_COUNTRY"));
    PrerequisiteObj.TargetParent := (Rds2 As IMetabaseObject);
    //Copy time series database
    Update.Apply(Null);
End Sub UserProc;

After executing the example the time series database is copied from the current repository to the repository, connection to which must be established and which context must be passed to the Mb2 variable. Before the database is copied, the system copies the shortcut, on which the database attribute is based. This shortcut is reconfigured to the MDM dictionary with the COUNTRY_1 identifier. The COUNTRY source MDM dictionary is not used in copying, its description is included into the Prerequisite collection especially to reconfigure the appropriate shortcut.

Fore.NET Example

Executing the example requires two repositories. Both repositories are located on one server. MDM repositories with the MDM identifier are created in each repository. MDM repositories contain the UNITS and MEASURES dictionaries required for correct work of time series databases. The FC time series database is created in the first repository to be copied to the second repository. An additional attribute based on MDM repository shortcut is created in the database. The shortcut has the SHORTCUT_COUNTRY identifier, the MDM dictionary to which this shortcut refers, has the COUNTRY identifier. The COUNTRY_1 dictionary is created in the MDM repository of the second repository.

Public Shared Sub Main(Params: StartParams);
Var
    Mb, Mb2: IMetabase;
    Rds, Rds2: IRdsDatabase;
    Update: ICubeMetaUpdateEx;
    CreateInfo: IMetabaseObjectCreateInfo;
    Rubr: IRubricator;
    Remapings: ICubeMetaUpdateDictionaryRemapings;
    Remap: ICubeMetaUpdateDictionaryRemaping;
    Prerequisite: ICubeMetaUpdateAdditionalObjects;
    PrerequisiteObj: ICubeMetaUpdateAdditionalObject;
Begin
    Mb := Params.Metabase;
    //Create a copying object
    Update := New CubeMetaUpdateClass() As ICubeMetaUpdateEx;
    Update.Metabase := Mb;
    Rubr := Mb.ItemById["FC"].Bind() As IRubricator;
    //Database to be copied
    Update.Rubricator := Rubr;
    //...
    Mb2 := //Connection to repository to which copying is executed
    //...
    CreateInfo := Update.CreateInfo;
    CreateInfo.Parent := Mb2.Root;
    CreateInfo.Id := "FC_Copy";
    CreateInfo.Name := "FC_Copy";
    //MDM repository in source repository
    Rds := Mb.ItemById["RDS"].Bind() As IRdsDatabase;
    //MDM repository in the repository, to which copying is executed
    Rds2 := Mb2.ItemById["RDS"].Bind() As IRdsDatabase;
    Update.RdsDatabase := Rds2;
    //Reconfigure dictionaries
    Remapings := Update.DictionaryRemapings;
    Remap := Remapings.FindById("UNITS");
    Remap.Target := Mb2.ItemByIdNamespace["UNITS", (Rds2 As IMetabaseObject).Key];
    Remap := Remapings.Add();
    Remap.SourceId := "MEASURES";
    Remap.Target := Mb2.ItemByIdNamespace["MEASURES", (Rds2 As IMetabaseObject).Key];
    //Set up objects copied before time series database
    Prerequisite := Update.PrerequisiteObjects;
    //The COUNTRY source dictionary
    PrerequisiteObj := Prerequisite.Add(MB.ItemByIdNamespace["COUNTRY", (Rds As IMetabaseObject).Key]);
    //Dictionary to be used in database copy instead of  the COUNTRY dictionary
    PrerequisiteObj.Target := MB2.ItemByIdNamespace["COUNTRY_1", (Rds2 As IMetabaseObject).Key];
    PrerequisiteObj.DescriptorOnly := True;
    //Shortcut for the MDM dictionary, on which time series database is based
    PrerequisiteObj := Prerequisite.Add(MB.ItemById["SHORTCUT_COUNTRY"]);
    PrerequisiteObj.TargetParent := (Rds2 As IMetabaseObject);
    //Copy time series database
    Update.Apply(Null);
End Sub;

This procedure is an entry point for the .NET assembly. After executing the example the time series database is copied from the current repository to the repository, connection to which must be established and which context must be passed to the Mb2 variable. Before the database is copied, the system copies the shortcut, on which the database attribute is based. This shortcut is reconfigured to the MDM dictionary with the COUNTRY_1 identifier. The COUNTRY source MDM dictionary is not used in copying, its description is included into the Prerequisite collection especially to reconfigure the appropriate shortcut.

See also:

ICubeMetaUpdateAdditionalObject