Class PushService
- All Implemented Interfaces:
com.priint.pubserver.plugin.interfaces.PluginControl
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
-
Field Summary
Fields 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.ResponseDeprecated.Please use BASIC_AUTH or TOKEN_AUTH authenticationjakarta.ws.rs.core.ResponseDeprecated.Please use BASIC_AUTH or TOKEN_AUTH authentication.getProposedEntities(String source, String instance) Get a list of proposed entities from the connector.com.priint.pubserver.webservice.ServiceResultpostClearCaches(String instance) com.priint.pubserver.webservice.ServiceResultpushData(String instance, String source, String commandStr, String connector, String flattenStructureStr, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) Generic push method on a persistable connector.com.priint.pubserver.webservice.ServiceResultpushData2(String instance, String source, String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) Generic push method on a persistable connector for deployment package purpose.com.priint.pubserver.webservice.ServiceResultpushDelete(String instance, String source, String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) Deletes data from the connector's data source.com.priint.pubserver.webservice.ServiceResultpushInsert(String instance, String source, String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) Will create (insert/persist) all entitydata from the data input that are not already existing in the connector data source.com.priint.pubserver.webservice.ServiceResultReads data from the connector's data source.com.priint.pubserver.webservice.ServiceResultpushUpdate(String instance, String source, String connector, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) Will update (merge) all entitydata from the data input that are already existing in the connector data source.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
-
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
DataMapobject. - Throws:
com.priint.pubserver.exception.PubServerException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerExceptionInfo.
-
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
DataMapobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerExceptionInfo.com.priint.pubserver.exception.PubServerException
-
pushSelect
@Path("/data") @GET public com.priint.pubserver.webservice.ServiceResult pushSelect() throws com.priint.pubserver.exception.PubServerExceptionReads data from the connector's data source.
Currently not supported.URL by example
GET /EntityDataService/push/data
- Returns:
- Returns a
ServiceResultobject. If case of successServiceResult.isSuccess()attribute will be set to true. In case of failureServiceResult.isSuccess()attribute will be set to false andServiceResult.getStatus()andServiceResult.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
DataMapobject. - Throws:
com.priint.pubserver.exception.PubServerException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerExceptionInfo.
-
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
DataMapobject. - Throws:
com.priint.pubserver.exception.PubServerException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerExceptionInfo.
-
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
ProposedEntitiesobject. - 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 authenticationLogin a user by form postreturns 401 if user is already logged in
URL by example
GET /EntityDataService/push/login?user=john&password=*****
- Parameters:
user- login namepassword- plain text secret- Returns:
- SessionID wrapped as value within a ServiceResult object
- Throws:
com.priint.pubserver.exception.PubServerException- when anything fails
-
getLogout
Deprecated.Please use BASIC_AUTH or TOKEN_AUTH authentication.Logout the currently active user by form postreturns 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
-