Class PushService

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

@Consumes({"application/json","application/xml"}) @Produces({"application/json","application/xml"}) @Path("/push") public class PushService extends AbstractService
RESTful service interface for persist interface of PublishingHubDB connector.

Data modifications methods use the following formats from PubServerSDK:
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.

Base URL by example:

http://pubserver:40080/EntityDataService/push

Authentication can either by BASIC_AUTH or by session id. User has to have a valid user account within publishing server.
For session id use methods getLogin(String, String) and getLogout() together with cookie named 'PubServSessID' (see Constants.PUBSERVER_SESSSION_NAME).

Since:
4.0.5
  • Constructor Details

    • PushService

      public PushService()
  • Method Details

    • pushData

      @Path("/command") @POST public com.priint.pubserver.webservice.ServiceResult pushData(@QueryParam("instance") String instance, @QueryParam("source") String source, @QueryParam("command") String commandStr, @QueryParam("connector") String connector, @QueryParam("flattenStructure") String flattenStructureStr, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Generic push method on a persistable connector.

      URL by example

       POST /EntityDataService/push/command?instance=default&source=MegaMarket&command=INSERT
       
      Parameters:
      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.
      commandStr - Specifies the request as either INSERT, UPDATE, or DELETE operation.
      connector - mappedName (defaults to PublishingHubDbConnector)
      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.
    • pushData2

      @Path("command2") @POST public com.priint.pubserver.webservice.ServiceResult pushData2(@QueryParam("instance") String instance, @QueryParam("source") String source, @QueryParam("connector") String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Generic push method on a persistable connector for deployment package purpose. It does not have command query parameter, it takes it from a data object (PushData).

      URL by example

       POST /EntityDataService/push/command?instance=default&source=MegaMarket&command=INSERT
       
      Parameters:
      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.
      connector - mappedName (defaults to PublishingHubDbConnector)
      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:
      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
    • pushSelect

      @Path("/data") @GET public com.priint.pubserver.webservice.ServiceResult pushSelect() throws com.priint.pubserver.exception.PubServerException
      Reads data from the connector's data source.
      Currently not supported.

      URL by example

      GET /EntityDataService/push/data
       
      Returns:
      Returns a ServiceResult object. If case of success ServiceResult.isSuccess() attribute will be set to true. In case of failure ServiceResult.isSuccess() attribute will be set to false and ServiceResult.getStatus() and ServiceResult.getValue() attributes will contain information about the exception.
      Throws:
      com.priint.pubserver.exception.PubServerException
    • pushInsert

      @Path("/data") @POST public com.priint.pubserver.webservice.ServiceResult pushInsert(@QueryParam("instance") String instance, @QueryParam("source") String source, @QueryParam("connector") String connector, 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.

      URL by example

      POST /EntityDataService/push/data?instance=default&source=MegaMarket
       

      Request body is a push data object serialized as XML or JSON.

      Parameters:
      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.
      connector - mappedName (defaults to PublishingHubDbConnector)
      data - Data to be processed. Will try to create all entitydata objects referenced by identifier.
      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.
    • pushUpdate

      @Path("/data") @PUT public com.priint.pubserver.webservice.ServiceResult pushUpdate(@QueryParam("instance") String instance, @QueryParam("source") String source, @QueryParam("connector") String connector, 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.

      URL by example

      PUT /EntityDataService/push/data?instance=default&source=MegaMarket
       

      Request body is a push data object serialized as XML or JSON.

      Parameters:
      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.
      connector - mappedName (defaults to PublishingHubDbConnector)
      data - Data to be processed. Will try to update all entitydata objects referenced by identifier.
      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.
    • pushDelete

      @Path("/data") @DELETE public com.priint.pubserver.webservice.ServiceResult pushDelete(@QueryParam("instance") String instance, @QueryParam("source") String source, @QueryParam("connector") String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerException
      Deletes data from the connector's data source.

      URL by example

      DELETE /EntityDataService/push/data?instance=default&source=MegaMarket
       

      Request body is a push data object serialized as XML or JSON. Serialized form can be sparse - only identifier attributes of buckets, texts, etc must be specified.

      Parameters:
      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.
      connector - mappedName (defaults to PublishingHubDbConnector)
      data - Data to be processed. Will try to delete all entitydata objects referenced by identifier.
      Returns:
      deleted data
      Throws:
      com.priint.pubserver.exception.PubServerException - when anything fails
    • getProposedEntities

      @Path("/model") @GET public Object getProposedEntities(@QueryParam("source") String source, @QueryParam("instance") String instance) throws com.priint.pubserver.exception.PubServerException
      Get a list of proposed entities from the connector.
      GET /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:
      com.priint.pubserver.exception.PubServerException - when anything fails
    • getLogin

      @GET @Path("/login") @Deprecated public jakarta.ws.rs.core.Response getLogin(@DefaultValue("") @QueryParam("user") String user, @DefaultValue("") @QueryParam("password") String password) throws com.priint.pubserver.exception.PubServerException
      Deprecated.
      Please use BASIC_AUTH or TOKEN_AUTH authentication
      Login a user by form post

      returns 401 if user is already logged in

      URL by example

      GET /EntityDataService/push/login?user=john&password=*****
       
      Parameters:
      user - login name
      password - plain text secret
      Returns:
      SessionID wrapped as value within a ServiceResult object
      Throws:
      com.priint.pubserver.exception.PubServerException - when anything fails
    • getLogout

      @GET @Path("/logout") @Deprecated public jakarta.ws.rs.core.Response getLogout()
      Deprecated.
      Please use BASIC_AUTH or TOKEN_AUTH authentication.
      Logout the currently active user by form post

      returns HTTP 401 if user is not logged in

      URL by example

      GET /EntityDataService/push/logout
       
      Returns:
      sessionid (now invalidated)
    • postClearCaches

      @Path("/clear-caches") @POST public com.priint.pubserver.webservice.ServiceResult postClearCaches(@QueryParam("instance") String instance) throws com.priint.pubserver.exception.PubServerException
      Throws:
      com.priint.pubserver.exception.PubServerException