Metadata Module¶
The Meta Data Manager of MIKE Workbench is in charge of controlling two types of data associated with the real data:
- Change log – a timeline of changes to an entity is maintained automatically and displayed when the entity is selected in the UI
- Meta data – a user defined set of properties for each type of entity, which can be edited for each instance of an entity. I.e. the meta data properties of feature class need not be the same as the meta data properties of data series. And the values of properties of different time series are likely also different.
The sample below shows how to get metadata for an entity.
// Get metadata for a specific entity (here a time series).
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;
var ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries");
var metadataModule = application.Modules.Get("Metadata Manager") as DHI.Solutions.MetadataManager.Interfaces.IMetadataModule;
var entityMetadata = metadataModule.GetMetadata(ts);
# Get metadata for a specific entity (here a time series).
tsModule = app.Modules.Get("Time series Manager")
ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries")
metadataModule = application.Modules.Get("Metadata Manager")
entityMetadata = metadataModule.GetMetadata(ts)
# Get metadata for a specific entity (here a time series).
tsModule = DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule(app.Modules.Get("Time series Manager"))
ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries")
metadataModule = application.Modules.Get("Metadata Manager")
entityMetadata = metadataModule.GetMetadata(ts)
Metadata Module Providers¶
The following providers are included in the metadata module.
| Provider | Description |
|---|---|
| MetadataList | Manage metadata. |
| MetadataSchemaList | Manage metadata schemas (XSD). |
| LanguageList | Manage languages. |
| TranslatedKeyList | Manage translated keys for a language. |
Read more about using module providers here
Change log Module¶
The change log module contains methods for getting and updating the change log of MIKE OPERATIONS.
Code Sample
var changeLogModule = application.Modules.Get("ChangeLog Manager") as DHI.Solutions.Generic.IChangeLogModule;
// Get the change log of a specific entity (here a time series).
var tsModule = application.Modules.Get("Time series Manager") as DHI.Solutions.TimeseriesManager.Interfaces.ITimeSeriesModule;
var ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries");
var timeSeriesChangeLogEntryList = changeLogModule.GetChangeLog(ts);
// Get changes made for any entity in a certain period.
var allEntityTypes = application.EntityTypeList.FetchAll();
var fromDateTime = new DateTime(2022, 1, 1);
var toDateTime = new DateTime(2022, 2, 1);
var anyChangeLogEntryList = changeLogModule.GetChangeLog(fromDateTime, toDateTime, allEntityTypes);
// Get changes made by a certain user in a specified period.
var userChangeLogEntryList = changeLogModule.GetChangeLog("muUserName", fromDateTime, toDateTime);
changeLogModule = app.Modules.Get("ChangeLog Manager")
# Get the change log of a specific entity (here a time series).
tsModule = app.Modules.Get("Time series Manager")
ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries")
if ts == None:
raise Exception("Time series was not found.")
timeSeriesChangeLogEntryList = changeLogModule.GetChangeLog(ts)
# Get changes made for any entity in a certain period.
allEntityTypes = app.EntityTypeList.FetchAll()
fromDateTime = datetime.datetime(2022, 1, 1)
toDateTime = datetime.datetime(2022, 2, 1)
anyChangeLogEntryList = changeLogModule.GetChangeLog(fromDateTime, toDateTime, allEntityTypes)
# Get changes made by a certain user in a specified period.
userChangeLogEntryList = changeLogModule.GetChangeLog("muUserName", fromDateTime, toDateTime)
changeLogModule = DHI.Solutions.Generic.IChangeLogModule(app.Modules.Get("ChangeLog Manager"))
# Get the change log of a specific entity (here a time series).
tsModule = app.Modules.Get("Time series Manager")
ts = tsModule.TimeSeriesList.Fetch("/MyTimeSeries")
if ts == None:
raise Exception("Time series was not found.")
timeSeriesChangeLogEntryList = changeLogModule.GetChangeLog(ts)
# Get changes made for any entity in a certain period.
allEntityTypes = app.EntityTypeList.FetchAll()
fromDateTime = datetime.datetime(2022, 1, 1)
toDateTime = datetime.datetime(2022, 2, 1)
anyChangeLogEntryList = changeLogModule.GetChangeLog(fromDateTime, toDateTime, allEntityTypes)
# Get changes made by a certain user in a specified period.
userChangeLogEntryList = changeLogModule.GetChangeLog("muUserName", fromDateTime, toDateTime)
Tools¶
Change-log query¶
Tool for querying the entity change log for changed made in a period and/or by specified users.
| Tool Info | Change-log query |
|---|---|
| NuGet Package | DHI.MikeOperations.MetadataManager.Tools.ChangeLogQuery |
| API Reference | DHI.Solutions.MetadataManager.Tools.ChangeLogQueryTool.IChangeLogQueryTool |
| Input Items | No input items required |
| Output Items | A table of change log entries |
Tool Properties
- UserName: Gets or sets the UserName who made the changes to query for.
- StartDate: Gets or sets the the start date for change log entries to query for.
- EndDate: Gets or sets the the end date for change log entries to query for
- EntityType: Gets or sets the entity type (Time Series, Feature Class, Raster, Job, Spreadsheet, etc.) to query change log entries for. More entity types can be specified separeted by a comma).
- ActionTypes: Gets or sets the action types (Add, Update and/or Delete) to query for, separated by a comma ','.
- MaxLogEntries: Gets or sets the maximum log entries returned when quering an entity (default = 1000).
Code Sample
// Get the tool
var tool = application.Tools.CreateNew("Change-log query") as DHI.Solutions.MetadataManager.Tools.ChangeLogQueryTool.ChangeLogQueryTool;
// Set the tool properties and execute.
tool.ActionTypes = "Add";
tool.EntityType = "Time Series";
tool.MaxLogEntries = 100;
tool.Execute();
// Get the output of the tool.
var tableContainer = tool.OutputItems[0] as DHI.Solutions.Generic.Tools.TableContainer;
var changeLogRows = tableContainer.TabularData.DataTableValues.Rows;
Schema Import Tool¶
Tool for importing a metadata schema for an entity type.
| Tool Info | Schema Import Tool |
|---|---|
| NuGet Package | DHI.MikeOperations.MetadataManager.Tools.SchemaImport |
| API Reference | DHI.Solutions.MetadataManager.Tools.SchemaImportTool.ISchemaImportTool |
| Input Items | No input items required |
| Output Items | No output items |
Tool Properties
- FilePath: Gets or sets the path to the schema file to import.
- EntityTypeName: Gets or sets the entity type name to import the schema to.
Code Sample
// Get the tool.
var tool = application.Tools.CreateNew("Schema Import Tool") as DHI.Solutions.MetadataManager.Tools.SchemaImportTool.ISchemaImportTool;
# Get the tool.
tool = app.Tools.CreateNew("Schema Import Tool")
# Get the tool.
tool = DHI.Solutions.MetadataManager.Tools.SchemaImportTool.ISchemaImportTool(app.Tools.CreateNew("Schema Import Tool"))
To change log table¶
The tool to display ChangeLogtable
| Tool Info | To change log table |
|---|---|
| NuGet Package | DHI.MikeOperations.MetadataManager.Tools.ToChangeLogTable |
| API Reference | DHI.Solutions.MetadataManager.UI.Tools.ToChangeLogTable.ToChangeLogTable |
| Input Items | No input items required |
| Output Items | No output items |
Tool Properties
- TableDisplayOptions:
- TableOutputName:
Code Sample
// Get the tool.
var tool = application.Tools.CreateNew("To change log table") as DHI.Solutions.MetadataManager.UI.Tools.ToChangeLogTable.ToChangeLogTable;
# Get the tool.
tool = app.Tools.CreateNew("To change log table")