Class EntityModelService
- All Implemented Interfaces:
com.priint.pubserver.plugin.interfaces.PluginControl
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 Summary
FieldsFields inherited from class com.priint.pubserver.entitydata.service.AbstractService
ERR_OBJECT_ALREADY_EXISTS, ERR_OBJECT_DOES_NOT_EXIST, httpServletRequest, httpServletResponse, logger, pluginLibrary, PUBLISHINGHUBDB_MAPPED_NAME, WILDCARD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsemodDuplicateModel(String oldModelId, String newModelId, String oldTenantName, String newTenantName, String oldConnectorSpec, String newConnectorSpec) Duplicates an existing entity model.com.priint.pubserver.webservice.ServiceResultRetrieves the entity model identifiers.jakarta.ws.rs.core.ResponsemodExportModelConfiguration(String entityModelIdentifier) Exports the model configuration for a specific entity model.com.priint.pubserver.entity.EntityModelmodExportModelToXML(String entityModelIdentifier) Exports the model as XML.jakarta.ws.rs.core.ResponsemodImportModelConfiguration(String entityModelIdentifier, String mode, String connectorIdentifier, String connectorInstance, com.priint.pubserver.webservice.ServiceResult serviceRequest) Imports a model configuration for a specific entity model.com.priint.pubserver.entity.EntitymodModelEntity(String entityModelIdentifier, String entityType, String identifier) Get entity by model and entity type.com.priint.pubserver.entity.EntitymodModelEntityByConnectorEntity(String entityModelIdentifier, String entityType, String identifier) Get entity by connector entity.jakarta.ws.rs.core.ResponsemodReplaceConnector(String modelId, String oldConnectorSpec, String newConnectorSpec) Replaces connector references of a model.Methods inherited from class com.priint.pubserver.entitydata.service.AbstractService
clean, clean, connectorEntityFromRequest, connectorEntityFromRequest, connectorEntityFromRequest, connectorEntityFromRequest, contextFromListField, contextFromListField, fillUpdateItem, fillUpdateRecords, findMethod, fromEntityDataList, fromEntityDataList, lookupBean, lookupConnector, lookupEntityManager, lookupPersistConnector, lookupPlugin, lookupPluginByJndi, lookupPluginByPluginManager, lookupPublishingHubDBConnector, lookupPublishingManagementConnector, preProcessData, setConnectorEntity, setConnectorEntity, toEntityDataList, toEntityDataMap, toEntityDataRecord, toEntityDataRecord4Update, toEntityDataRecord4UpdateList, toEntityDataRecordList, toEntityItem, toEntityItem4UpdateList, toEntityItemForUpdate, toEntityItemList, toPushDataMethods inherited from class com.priint.pubserver.plugin.PluginControlDefault
afterCreateConfigurations, afterDeleteConfigurations, afterUpdateConfigurations, createConfiguration, deleteConfigurations, getSession, getSessionId, initInstance, loadServerConfig, ping, readSessionAttribute, updateConfigurations, writeSessionAttributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.priint.pubserver.plugin.interfaces.PluginControl
validateConfigurations
-
Field Details
-
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.PubServerExceptionRetrieves 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
ServiceResultobject 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
Entityobject. - 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
Entityobject. - 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
EntityModelobject 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
Responseobject 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- TheServiceResultobject containing the configuration data to be imported.- Returns:
- A
Responseobject 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
Responseobject 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
Responseobject containing the result of the operation. - Throws:
ServiceException- If an error occurs during the replacement operation.- Since:
- 4.1.6
-