RemappingFilter: IMetabaseObjectDescriptors;
RemappingFilter: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptors;
The RemappingFilter property returns the collection of objects than must be skipped during copying.
This property is used on another copying of time series database in existing time series database. RemappingFilter enables the user to cut the number of objects to be copied.
The RemappingFilter property is recommended to use always if a copied 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 copying 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 copying 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 copied
RubUpdateEx.Metabase := Mb;
// Specify MDM to store data of the time series database
RubUpdateEx.RdsDatabase := Rub.Database;
// Specify time series database to copy in
RubUpdateEx.TargetRubricator := mb.ItemById("TSDB_DEST").Bind As IRubricator;
// Exclude objects that are present in time series database to which copying will be executed
RemappingFilter := RubUpdateEx.RemappingFilter;
RemappingFilter.Add(mb.ItemByIdNamespace("MDM_TBL_DICT_COUNTRY", RubObj.Key));
// Copy
RubUpdateEx.Apply(Progress);
// Save changes in copying object
Obj.Save;
End Sub UserProc;
As a result of execution of the example the TSDB_SRC time series database will be copied 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 copying 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 copying 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 copied
RubUpdateEx.Metabase := Mb;
// Specify MDM to store data of the time series database
RubUpdateEx.RdsDatabase := Rub.Database;
// Specify time series database to copy in
RubUpdateEx.TargetRubricator := mb.ItemById["TSDB_DEST"].Bind() As IRubricator;
// Exclude objects that are present in time series database to which copying will be executed
RemappingFilter := RubUpdateEx.RemappingFilter;
RemappingFilter.Add(mb.ItemByIdNamespace["MDM_TBL_DICT_COUNTRY", RubObj.Key]);
// Copy
RubUpdateEx.Apply(Progress);
// Save changes in copying object
Obj.Save();
End Sub;
See also: