RemappingFilter: IMetabaseObjectDescriptors;
RemappingFilter: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptors;
The RemappingFilter property returns the collection of objects that must be skipped during copying.
This property is used on another copying of time series database into existing time series database. RemappingFilter enables the user to cut the number of objects to be replicated.
The RemappingFilter property is recommended to use always if a replicated time series database contains child dictionaries.
Executing the example requires that the repository contains time series databases with the TSBD_SRC and MDM_TBL_DICT_COUNTRY identifiers. Data of the time series database must have same structure and same child objects with the MDM table dictionary with the MDM_TBL_DICT_COUNTRY identifier.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Obj: IMetabaseObject;
ObjDesc: IMetabaseObjectDescriptor;
RubUpdateEx: ICubeMetaUpdateEx;
RubObj: IMetabaseObject;
Rub: IRubricator;
RemappingFilter: IMetabaseObjectDescriptors;
Progress: IMetabaseUpdateProgress;
Begin
// Get repository
mb := MetabaseClass.Active;
// Create a replication object
CrInfo := Mb.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBEMETAUPDATE;
CrInfo.Id := Mb.GenerateId("Cube_Meta_Upd");
CrInfo.Permanent := True;
CrInfo.Parent := Mb.Root;
ObjDesc := Mb.CreateObject(CrInfo);
Obj := ObjDesc.Edit;
// Set up parameters of replication object
RubUpdateEx := Obj As ICubeMetaUpdateEx;
// Specify source time series database
RubObj := mb.ItemById("TSDB_SRC").Bind;
Rub := RubObj.As IRubricator;
RubUpdateEx.Rubricator := Rub;
// Specify the repository, to which time series database is replicated
RubUpdateEx.Metabase := Mb;
// Specify MDM to store data of the time series database
RubUpdateEx.RdsDatabase := Rub.Database;
// Specify time series database to, which replication is executed
RubUpdateEx.TargetRubricator := mb.ItemById("TSDB_DEST").Bind As IRubricator;
// Exclude from replication the objects
// that are present in the time series database, to which replication is executed
RemappingFilter := RubUpdateEx.RemappingFilter;
RemappingFilter.Add(mb.ItemByIdNamespace("MDM_TBL_DICT_COUNTRY", RubObj.Key));
// Replicate
RubUpdateEx.Apply(Progress);
// Save changes in replication object
Obj.Save;
End Sub UserProc;
After executing the example the TSDB_SRC time series database is replicated to the MDM_TBL_DICT_COUNTRY time series database. The MDM_TBL_DICT_COUNTRY child dictionary will not be copied again.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
Obj: IMetabaseObject;
ObjDesc: IMetabaseObjectDescriptor;
RubUpdateEx: ICubeMetaUpdateEx;
RubObj: IMetabaseObject;
Rub: IRubricator;
RemappingFilter: IMetabaseObjectDescriptors;
Progress: IMetabaseUpdateProgress;
Begin
// Get repository
mb := Params.Metabase;
// Create a replication object
CrInfo := Mb.CreateCreateInfo();
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBEMETAUPDATE As integer;
CrInfo.Id := Mb.GenerateId("Cube_Meta_Upd", 0);
CrInfo.Permanent := True;
CrInfo.Parent := Mb.Root;
ObjDesc := Mb.CreateObject(CrInfo);
Obj := ObjDesc.Edit();
// Set up parameters of replication object
RubUpdateEx := Obj As ICubeMetaUpdateEx;
// Specify source time series database
RubObj := mb.ItemById["TSDB_SRC"].Bind();
Rub := RubObj As IRubricator;
RubUpdateEx.Rubricator := Rub;
// Specify the repository, to which time series database is replicated
RubUpdateEx.Metabase := Mb;
// Specify MDM to store data of the time series database
RubUpdateEx.RdsDatabase := Rub.Database;
// Specify time series database to, which replication is executed
RubUpdateEx.TargetRubricator := mb.ItemById["TSDB_DEST"].Bind() As IRubricator;
// Exclude from replication the objects
// that are present in the time series database, to which replication is executed
RemappingFilter := RubUpdateEx.RemappingFilter;
RemappingFilter.Add(mb.ItemByIdNamespace["MDM_TBL_DICT_COUNTRY", RubObj.Key]);
// Replicate
RubUpdateEx.Apply(Progress);
// Save changes in replication object
Obj.Save();
End Sub;
See also: