See: Description
Interface | Description |
---|---|
DataModelResult |
Stores the data result when generating an XML Schema Document (XSD) file.
|
DataModelSource |
Defines the sources to generate data models.
|
XSDGenerator |
Provides a method for generating an XML Schema Document (XSD) file.
|
Class | Description |
---|---|
DataModelSpec |
Represents a data model specification, which contains the configurations used for generating an XML Schema Document (XSD) file.
|
SourceFile |
Specifies the configuration to create a data model source from a file.
|
SourcePrimaryKey |
Specifies the configurations to create a data model source from an instance of a
PrimaryKey that identifies a record of the Data model table in the Dynamic data modeling dataset. |
SourcePrimaryKeyFactory |
Provides the methods to get a
SourcePrimaryKey . |
XSDGeneratorFactory |
Creates instances of
XSDGenerator . |
Exception | Description |
---|---|
DataModelException |
Defines a Dynamic data modeling exception.
|
Classes and interfaces to call the Dynamic data modeling service.
First, you need to define the source used for data model generation. You can use a file or a record in the Dynamic data modeling dataset's Data model table. The following describes how to define each source type:
When defining the data model source from Excel, XML and DDL files:
String dataModelName; String inputFilePath; File inputFile = new File(inputFilePath); SourceFile dataModelSource = new SourceFile(dataModelName, inputFile);
When using XML format files, you also need to define the table paths:
String tableAPath="/root/TableA"; String tableBPath="/root/TableB"; Set<String> tablePaths=new LinkedHashSet<String>(); tablePaths.add(tableAPath); tablePaths.add(tableBPath); dataModelSource.setXMLTablePaths(tablePaths);
To define the data model source from PrimaryKey
that identifies a record of the Data model table in the Dynamic data modeling dataset.
String dataModelName; PrimaryKey dataModelRecordPrimaryKey; SourcePrimaryKey dataModelSource = new SourcePrimaryKey(dataModelName, dataModelRecordPrimaryKey);
Then, you need to define the data model specification, which contains the configurations used for generating an XML Schema Document (XSD) file.
Repository repository; Session session; DataModelSpec dataModelSpec = new DataModelSpec(repository, session); dataModelSpec.setDataModelSource(dataModelSource);
During data model generation, you can save data model configurations to the Dynamic data modeling dataset using the options below:
To save the configuration:
dataModelSpec.setSavedToDynamicDataModelingDataset(true);
To define the field name used for the field label when saving the data model configuration in the Dynamic data modeling dataset:
dataModelSpec.setFieldNameForLabelApplied(true);
After that, you can execute the service:
DataModelResult dataModelResult = XSDGeneratorFactory.getXSDGenerator().generate(dataModelSpec);
The final result is an XML Schema Document (XSD), which can be accessed as below:
File datamodelFile=dataModelResult.getExportedFile();
To create an instance of SourcePrimaryKey
with the specific data model name declared in the Data model table, you need to implement the following:
Repository repository; String dataModelName; SourcePrimaryKey dataModelSource = SourcePrimaryKeyFactory.getInstance().getSourcePrimarykey(repository, dataModelName);