Interface DMADataModel
- Since:
- 6.2.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetDescription(Locale aLocale) Returns the description of this data model in the specified Locale.Returns the label of this data model in the specified Locale.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;nullin other cases.getName()Returns the name of the data model.Returns all the publications that have been created from this data model.Returns thespecificationfor publishing this data model according to its configuration.Returns the version name of this data model if it is a version.Returns the versions associated to this data model.lookupVersion(String aVersionName) Returns the specified version of this data model.publish(DataModelingPublicationSpec aSpec, Session aSession) Publish the specified data model according to a specific configuration.Publish the specified data model according to its configuration.
-
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
Returns the specified version of this data model.Returns
nullif no version exists with this name for this data model. -
getVersions
List<DMADataModel> getVersions()Returns the versions associated to this data model. -
getPublications
Returns all the publications that have been created from this data model. -
publish
Publish the specified data model according to its configuration.Returns the reference to the
schemathat 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 isnull.- See Also:
-
publish
SchemaLocation publish(DataModelingPublicationSpec aSpec, Session aSession) throws OperationException 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 methodDataModelingEmbeddedPublicationSpec.setCreateSnapshot(boolean).Packaged Publication
It publishes an
XML Schemadocument (xsdfile) 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:
- The consistency of the specification is checked.
- 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 specifiedspecor session isnull.- See Also:
-
-
getPublicationSpec
DataModelingPublicationSpec getPublicationSpec()Returns thespecificationfor publishing this data model according to its configuration. -
getLabel
Returns the label of this data model in the specified Locale.- Throws:
IllegalArgumentException- if the specifiedlocaleisnull.
-
getDescription
Returns the description of this data model in the specified Locale.- Throws:
IllegalArgumentException- if the specifiedlocaleisnull.
-
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;
nullin other cases.
-