Package com.orchestranetworks.addon.dml


package com.orchestranetworks.addon.dml

Classes and interfaces to call the Dynamic data modeling service.


Example of executing data model generation.

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();

Sample for creating a data model source with the specific data model name declared in the Data model table in the Dynamic data modeling dataset.

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);
  • Class
    Description
    Defines a Dynamic data modeling exception.
    Stores the data result when generating an XML Schema Document (XSD) file.
    Defines the sources to generate data models.
    Represents a data model specification, which contains the configurations used for generating an XML Schema Document (XSD) file.
    Specifies the configuration to create a data model source from a file.
    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.
    Provides the methods to get a SourcePrimaryKey.
    Provides a method for generating an XML Schema Document (XSD) file.
    Creates instances of XSDGenerator.