Interface DMADataModel


public interface DMADataModel
Represents a data model defined in the Data Model Assistant (DMA).
Since:
6.2.2
See Also:
  • Method Details

    • getName

      String getName()
      Returns the name of the data model.
    • getVersionName

      String getVersionName()
      Returns the version name of this data model if it is a version.
    • lookupVersion

      DMADataModel lookupVersion(String aVersionName)
      Returns the specified version of this data model.

      Returns null if no version exists with this name for this data model.

    • getVersions

      List<DMADataModel> getVersions()
      Returns the versions associated to this data model.
    • getPublications

      List<String> getPublications()
      Returns all the publications that have been created from this data model.
    • publish

      SchemaLocation publish(Session aSession) throws OperationException
      Publish the specified data model according to its configuration.

      Returns the reference to the schema that has been generated.

      If a custom configuration is desired, then use publish(DataModelingPublicationSpec, Session).

      Throws:
      IllegalStateException - if the configuration of the data model indicates that the publication is embedded and if the data model has several publications. In this case the publication to update must be explicitly set.
      OperationException - if the current user is not allowed to publish the specified data model or if an error occurs during the publication process.
      IllegalArgumentException - if the specified session is null.
      See Also:
    • publish

      Publish the specified data model according to a specific configuration. Currently, two modes are supported:
      • Embedded publication

      • Packaged publication

      Important: When a specific configuration is set then the configuration defined at data model level is ignored.

      Embedded Publication

      The embedded publication process can either create a new publication or update an existent one.

      In order to make an embedded publication, use DataModelingEmbeddedPublicationSpec.

      Create a new Publication
      A new publication is created when:
      • The data model does not have any existing publication;
      • The specified publication name does not match any existing publications in the current repository.
      Update a Publication

      An existing publication is updated when the specified publication name matches any existing publications in the current repository.

      Create Snapshot
      During the embedded publication process a snapshot can be created using the method DataModelingEmbeddedPublicationSpec.setCreateSnapshot(boolean).

      Packaged Publication

      It publishes an XML Schema document (xsd file) packaged in a module. If such document already exists in the desired location then the publication process updates it, otherwise a new document is created.

      In order to make a packaged publication, use DataModelingEmbeddedPublicationSpec.

      Publication Process

      Publication process is carried out according to the following steps:

      1. The consistency of the specification is checked.
      2. The publication is executed and a schema is generated according to the specified configuration.

      Usage

      Example 1: publish a data model using its own configuration

       // First, retrieve the data mode to be published
       DataModelingManager manager = DataModelingManager.getDataModelingManager(aRepository);
       final DMADataModel dataModel = manager.lookupDataModel(aDataModelName);
      
       // Second, publish the data model according to its default configuration.
       dataModel.publish(aUserSession);
       

      Example 2: publish a data model in a specific module.

       // First, retrieve the data mode to be published
       DataModelingManager manager = DataModelingManager.getDataModelingManager(aRepository);
       final DMADataModel dataModel = manager.lookupDataModel(aDataModelName);
      
       // Second, create a custom setting for packaged publication and set the custom module and xsd file path
       final String moduleName = "custom_module";
       final String targetXsdInModule = "/WEB-INF/ebx/schemas/myDataModel.xsd";
       DataModelingPackagedPublicationSpec spec = DataModelingPackagedPublicationSpec.forPackagedPublication(moduleName,
              targetXsdInModule);
      
       // Third, publish the data model and provide the previous specification and the current user session as parameters
       dataModel.publish(spec, aUserSession);
       

      Example 3: publish a data model in repository with a custom publication name

       // First, retrieve the data mode to be published
       DataModelingManager manager = DataModelingManager.getDataModelingManager(aRepository);
       String aDataModelName = "myDataModel";
       final DMADataModel dataModel = manager.lookupDataModel(aDataModelName);
      
       // Second, create a custom setting for embedded publication
       final String customPublicationName = "custom_publication_name";
       final DataModelingEmbeddedPublicationSpec spec = DataModelingEmbeddedPublicationSpec
              .forEmbeddedPublication(customPublicationName);
      
       // Third, publish the data model and provide the previous specification and the current user session as a parameter
       dataModel.publish(spec, aUserSession);
       
      Throws:
      OperationException - if the current user is not allowed to publish the specified data model of if an error occurs during the publication process.
      IllegalArgumentException - if the specified spec or session is null.
      See Also:
    • getPublicationSpec

      DataModelingPublicationSpec getPublicationSpec()
      Returns the specification for publishing this data model according to its configuration.
      See Also:
    • getLabel

      String getLabel(Locale aLocale)
      Returns the label of this data model in the specified Locale.
      Throws:
      IllegalArgumentException - if the specified locale is null.
    • getDescription

      String getDescription(Locale aLocale)
      Returns the description of this data model in the specified Locale.
      Throws:
      IllegalArgumentException - if the specified locale is null.
    • getModuleName

      String getModuleName()
      This method returns:
      • The module name where the XML Schema file is located if the data model has to be published in a module;
      • The name of the module containing the Java resources used by the data model if it has to be published in the repository;
      • null in other cases.