Class EntityModelService

java.lang.Object
com.priint.pubserver.plugin.PluginControlDefault
com.priint.pubserver.entitydata.service.AbstractService
com.priint.pubserver.entitydata.service.EntityModelService
All Implemented Interfaces:
com.priint.pubserver.plugin.interfaces.PluginControl

@Consumes({"application/json","application/xml"}) @Produces({"application/json","application/xml"}) @Path("/entitymodel") public class EntityModelService extends AbstractService
RESTful service interface for querying entity model manager of publishing server.

Supports through its URIs some helper methods from EntityManagerRemote interface.

You may use either XML or JSON as serialization method.

In case of errors a ServerResult object will be returned along with the HTTP status code (in most cases 500) containing exception details.

Since:
4.0.5
  • Field Details

    • MAPPED_NAME

      public static final String MAPPED_NAME
      The name of the service.

      This constant is used to identify the service in the system.

      See Also:
  • Constructor Details

    • EntityModelService

      public EntityModelService()
  • Method Details

    • modEntityModelIdentifiers

      @Path("/identifiers") @GET public com.priint.pubserver.webservice.ServiceResult modEntityModelIdentifiers() throws com.priint.pubserver.exception.PubServerException
      Retrieves the entity model identifiers.

      This method handles a GET request to retrieve the identifiers of all available entity models. It uses the EntityManager to fetch the identifiers from the underlying data source.

      Returns:
      A ServiceResult object containing the collection of entity model identifiers.
      Throws:
      com.priint.pubserver.exception.PubServerException - If an error occurs during the retrieval process.
    • modModelEntity

      @GET @Path("/{model}/{entityType}/{identifier}") public com.priint.pubserver.entity.Entity modModelEntity(@PathParam("model") String entityModelIdentifier, @PathParam("entityType") String entityType, @PathParam("identifier") String identifier) throws com.priint.pubserver.exception.PubServerException
      Get entity by model and entity type.

      This method retrieves an entity based on the specified model identifier, entity type, and identifier. It uses the EntityManager to fetch the entity from the underlying data source.

      Parameters:
      entityModelIdentifier - The identifier of the entity model.
      entityType - The type of the entity to be retrieved.
      identifier - The identifier of the entity to be retrieved.
      Returns:
      The requested Entity object.
      Throws:
      com.priint.pubserver.exception.PubServerException - If an error occurs during the retrieval process.
    • modModelEntityByConnectorEntity

      @GET @Path("/{model}/Entity/{identifier}/{entityType}") public com.priint.pubserver.entity.Entity modModelEntityByConnectorEntity(@PathParam("model") String entityModelIdentifier, @PathParam("entityType") String entityType, @PathParam("identifier") String identifier) throws com.priint.pubserver.exception.PubServerException
      Get entity by connector entity.

      This method retrieves an entity based on the specified model identifier, entity type, and identifier. It uses the EntityManager to fetch the entity from the underlying data source.

      Parameters:
      entityModelIdentifier - The identifier of the entity model.
      entityType - The type of the entity to be retrieved.
      identifier - The identifier of the entity to be retrieved.
      Returns:
      The requested Entity object.
      Throws:
      com.priint.pubserver.exception.PubServerException - If an error occurs during the retrieval process.
    • modExportModelToXML

      @GET @Path("/{model}") public com.priint.pubserver.entity.EntityModel modExportModelToXML(@PathParam("model") String entityModelIdentifier) throws com.priint.pubserver.exception.PubServerException
      Exports the model as XML.

      This method handles a GET request to export the model for the specified entity model. It retrieves the model data and returns it in XML format.

      Parameters:
      entityModelIdentifier - The identifier of the entity model to be exported.
      Returns:
      An EntityModel object representing the exported model.
      Throws:
      com.priint.pubserver.exception.PubServerException - If an error occurs during the export process.
    • modExportModelConfiguration

      @GET @Path("/{entityModelIdentifier}/PluginConfigList") public jakarta.ws.rs.core.Response modExportModelConfiguration(@PathParam("entityModelIdentifier") String entityModelIdentifier) throws ServiceException
      Exports the model configuration for a specific entity model.

      This method handles a GET request to export the model configuration for the specified entity model. It retrieves the configuration data and returns it in a response.

      Parameters:
      entityModelIdentifier - The identifier of the entity model for which the configuration is to be exported.
      Returns:
      A Response object containing the exported model configuration.
      Throws:
      ServiceException - If an error occurs during the export process.
    • modImportModelConfiguration

      @POST @Path("/{entityModelIdentifier}/PluginConfigList") public jakarta.ws.rs.core.Response modImportModelConfiguration(@PathParam("entityModelIdentifier") String entityModelIdentifier, @QueryParam("mode") @DefaultValue("") String mode, @QueryParam("connectorIdentifier") @DefaultValue("") String connectorIdentifier, @QueryParam("connectorInstance") @DefaultValue("") String connectorInstance, com.priint.pubserver.webservice.ServiceResult serviceRequest) throws ServiceException
      Imports a model configuration for a specific entity model.

      This method handles a POST request to import a model configuration for the specified entity model. It supports different modes of operation such as create, update, or replace. The method processes the provided configuration data and updates the system accordingly.

      Example usage: curl -X POST \ 'https://pubserver.example.com/EntityDataService/entitymodel/aio/PluginConfigList?mode=create&connectorIdentifier=connector1&connectorInstance=instance1' \ -H 'Content-Type: application/json' \ -d '{"entries": {...}}'

      Parameters:
      entityModelIdentifier - The identifier of the entity model for which the configuration is to be imported.
      mode - The mode of operation for the import (e.g., create, update, or replace).
      connectorIdentifier - The identifier of the connector to associate with the imported configuration.
      connectorInstance - The instance of the connector to associate with the imported configuration.
      serviceRequest - The ServiceResult object containing the configuration data to be imported.
      Returns:
      A Response object containing the result of the import operation.
      Throws:
      ServiceException - If an error occurs during the import process.
      Since:
      4.1.6
    • modDuplicateModel

      @POST @Path("/{modelId}/duplicate") public jakarta.ws.rs.core.Response modDuplicateModel(@PathParam("modelId") String oldModelId, @QueryParam("new-model") String newModelId, @QueryParam("tenant") String oldTenantName, @QueryParam("new-tenant") String newTenantName, @QueryParam("connector") String oldConnectorSpec, @QueryParam("new-connector") String newConnectorSpec) throws ServiceException
      Duplicates an existing entity model.

      This method handles a POST request to duplicate an existing entity model identified by the given model ID. It allows specifying a new model ID, tenant names, and connector specifications for the duplication process.

      Example usage: curl -X POST \ 'https://pubserver.example.com/EntityDataService/entitymodel/aio/duplicate?new-model=ai2&tenant=WerkII&new-tenant=Default&connector=com.priint.pubserver.connector.jpa.api.PublishingHubDBConnector:aio&new-connector=com.priint.pubserver.connector.rest.RestConnector:ai2' \ -H 'Accept: application/xml'

      Parameters:
      oldModelId - The identifier of the existing entity model to be duplicated.
      newModelId - The identifier for the new duplicated entity model.
      oldTenantName - The name of the tenant associated with the existing model.
      newTenantName - The name of the tenant to associate with the new model.
      oldConnectorSpec - The specification of the old connector instance to be replaced.
      newConnectorSpec - The specification of the new connector instance to replace the old one.
      Returns:
      A Response object containing the result of the duplication operation.
      Throws:
      ServiceException - If an error occurs during the duplication process.
      Since:
      4.1.6
    • modReplaceConnector

      @POST @Path("/{modelId}/replace-connector") public jakarta.ws.rs.core.Response modReplaceConnector(@PathParam("modelId") String modelId, @QueryParam("connector") String oldConnectorSpec, @QueryParam("new-connector") String newConnectorSpec) throws ServiceException
      Replaces connector references of a model.

      This method handles a POST request to replace all references to a specified old connector instance with a new connector instance for a given entity model.

      Example usage: curl -X POST \ 'https://pubserver.example.com/EntityDataService/entitymodel/aio/replace-connector?connector=com.priint.pubserver.connector.jpa.api.PublishingHubDBConnector:aio&new-connector=com.priint.pubserver.connector.rest.RestConnector:xyz' \ -H 'Accept: application/xml'

      Parameters:
      modelId - The identifier of the entity model for which the connector references are to be replaced.
      oldConnectorSpec - The specification of the old connector instance to be replaced.
      newConnectorSpec - The specification of the new connector instance to replace the old one.
      Returns:
      A Response object containing the result of the operation.
      Throws:
      ServiceException - If an error occurs during the replacement operation.
      Since:
      4.1.6