Class PushServicePlugin

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

public class PushServicePlugin extends AbstractService
RESTful service interface for persist interface of PublishingHubDB connector.

Data input format is ConnectorPersistRemote.PushData, output format is ServiceResult.

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

  • Constructor Details

    • PushServicePlugin

      public PushServicePlugin()
  • Method Details

    • pushData

      public com.priint.pubserver.webservice.ServiceResult pushData(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushCommand command, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data, boolean flattenStructure) throws com.priint.pubserver.exception.PubServerException
      Generic push method on a persistable connector.
      Parameters:
      mappedName - Mapped name of the connector.
      instance - Name of the connector instance. Different instances are typically associated with different data sources.
      source - Name of originator of the data. Currently not in use.
      command - Specifies the request as either create, read, update or delete operation.
      data - Data to be processed. Will try to process all entitydata objects referenced by identifier as specified by the command parameter.
      Returns:
      Returns a DataMap object.
      Throws:
      com.priint.pubserver.exception.PubServerException - If anything fails HTTP error 500 will be send. Exception data will be returned to the client in a PubServerExceptionInfo.
    • pushInsert

      public com.priint.pubserver.webservice.ServiceResult pushInsert(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Will create (insert/persist) all entitydata from the data input that are not already existing in the connector data source.
      Parameters:
      mappedName - connector mappedName (defaults to PublishingHubDbConnector)
      instance - Name of the connector instance. Different instances are typically associated with different data sources.
      source - ,
      data - Data to be processed. Will try to create all entitydata objects referenced by identifier.
      Returns:
      Returns a DataMap object.
      Throws:
      ServiceException - If anything fails HTTP error 500 will be send. Exception data will be returned to the client in a PubServerExceptionInfo.
      com.priint.pubserver.exception.PubServerException
    • pushUpdate

      public com.priint.pubserver.webservice.ServiceResult pushUpdate(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Will update (merge) all entitydata from the data input that are already existing in the connector data source.
      Parameters:
      mappedName - connector mappedName (defaults to PublishingHubDbConnector)
      instance - Name of the connector instance. Different instances are typically associated with different data sources.
      data - Data to be processed. Will try to update all entitydata objects referenced by identifier.
      Returns:
      Returns a DataMap object.
      Throws:
      ServiceException - If anything fails HTTP error 500 will be send. Exception data will be returned to the client in a PubServerExceptionInfo.
      com.priint.pubserver.exception.PubServerException
    • pushDelete

      public com.priint.pubserver.webservice.ServiceResult pushDelete(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Deletes data from the connector's data source.
       http://server:port/EntityDataService/connector/{instance}
       
      Parameters:
      mappedName - connector mappedName (defaults to PublishingHubDbConnector)
      instance - Name of the connector instance. Different instances are typically associated with different data sources.
      data - Data to be processed. Will try to delete all entitydata objects referenced by identifier.
      Returns:
      Returns a PushData2 object. If case of success PushData2#isSuccess() attribute will be set to true. In case of failure PushData2#isSuccess() attribute will be set to false and PushData2#getErrorCode() and PushData2#getErrorMessage() attributes will contain information about the exception.
      Throws:
      ServiceException
      com.priint.pubserver.exception.PubServerException
    • getProposedEntities

      public Object getProposedEntities(String instance, String source) throws com.priint.pubserver.exception.PubServerException
      Get a list of proposed entities from the connector.
      GET http://server:port/EntityDataService/push/model
      Sample output:

      <proposedEntities>
      <proposedEntity>
      <entityType>Bucket</entityType>
      <entityId>product</entityId>
      <parentBucketEntityId>category</parentBucketEntityId>
      <targetEntityId></targetEntityId>
      <contentEntityId></contentEntityId>
      <entityClass>com.priint.pubserver.entity.EntityBucket</entityClass>
      </proposedEntity>
      <proposedEntity>
      <entityType>Cord</entityType>
      <entityId>accessory</entityId>
      <parentBucketEntityId>product</parentBucketEntityId>
      <targetEntityId>product</targetEntityId>
      <contentEntityId>accessory-content</contentEntityId>
      <entityClass>com.priint.pubserver.entity.EntityCord</entityClass>
      </proposedEntity>
      </proposedEntities>

      Parameters:
      instance - Name of the connector instance. Different instances are typically associated with different data sources.
      source - String identifying the origin of the data.
      Returns:
      Returns a ProposedEntities object.
      Throws:
      ServiceException
      com.priint.pubserver.exception.PubServerException
    • callPushData

      public String callPushData(Map<String,Object> params)
      Commit pushdata via business method.

      The following params are supported.

      • "connector": mappedName (defaults to PublishingHubDbConnector)
      • "instance": Name of the connector instance. Different instances are typically associated with different data sources.
      • "source": Name of originator of the data. Currently not in use.
      • "command": Specifies the request as either create, read, update or delete operation. ConnectorPersistRemote.PushCommand.
      • "data": Data to be processed. Will try to create all entitydata objects referenced by identifier.
      Parameters:
      params -
      Returns:
    • clearCaches

      public com.priint.pubserver.webservice.ServiceResult clearCaches(String instance) throws com.priint.pubserver.exception.PubServerException
      Clear cache of PUBLISHINGHUBDB.

      Other connectors are not supported.

      Parameters:
      instance -
      Returns:
      Throws:
      com.priint.pubserver.exception.PubServerException
    • pushUpsert

      public com.priint.pubserver.webservice.ServiceResult pushUpsert(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Throws:
      com.priint.pubserver.exception.PubServerException
    • pushCommit

      public com.priint.pubserver.webservice.ServiceResult pushCommit(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Throws:
      com.priint.pubserver.exception.PubServerException
    • pushSelect

      public com.priint.pubserver.webservice.ServiceResult pushSelect(String mappedName, String instance, String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Throws:
      com.priint.pubserver.exception.PubServerException