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 isServiceResult.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
Fields Modifier and Type Field Description static java.lang.StringMAPPED_NAMEDefault mapped name of the connector.-
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 Constructor Description PushServicePlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcallPushData(java.util.Map<java.lang.String,java.lang.Object> params)Commit pushdata via business method.com.priint.pubserver.webservice.ServiceResultclearCaches(java.lang.String instance)Clears the cache of the PublishingHubDB connector instance.java.lang.ObjectgetProposedEntities(java.lang.String instance, java.lang.String source)Get a list of proposed entities from the connector.com.priint.pubserver.webservice.ServiceResultpushCommit(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)Will commit all entitydata from the data input that are already existing in the connector data source.com.priint.pubserver.webservice.ServiceResultpushData(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushCommand command, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data, boolean flattenStructure)Generic push method on a persistable connector.com.priint.pubserver.webservice.ServiceResultpushDelete(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)Will delete all entitydata from the data input that are already existing in the connector data source.com.priint.pubserver.webservice.ServiceResultpushInsert(java.lang.String mappedName, java.lang.String instance, java.lang.String source, 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.ServiceResultpushSelect(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)Will read all entitydata from the connector data source.com.priint.pubserver.webservice.ServiceResultpushUpdate(java.lang.String mappedName, java.lang.String instance, java.lang.String source, 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.com.priint.pubserver.webservice.ServiceResultpushUpsert(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)Will create (insert/persist) and update (merge) all entitydata from the data input that are not 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, toPushData
-
Methods inherited from class com.priint.pubserver.plugin.PluginControlDefault
afterCreateConfigurations, afterDeleteConfigurations, afterUpdateConfigurations, createConfiguration, deleteConfigurations, getSession, getSessionId, initInstance, loadServerConfig, ping, readSessionAttribute, updateConfigurations, writeSessionAttribute
-
-
-
-
Field Detail
-
MAPPED_NAME
public static final java.lang.String MAPPED_NAME
Default mapped name of the connector.- See Also:
- Constant Field Values
-
-
Method Detail
-
pushData
public com.priint.pubserver.webservice.ServiceResult pushData(java.lang.String mappedName, java.lang.String instance, java.lang.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.PubServerExceptionGeneric 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.flattenStructure- Is used to flatten the structure of the data. If true, the data will be flattened.- Returns:
- Returns a
ServiceResultobject. - Throws:
com.priint.pubserver.exception.PubServerException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.
-
pushInsert
public com.priint.pubserver.webservice.ServiceResult pushInsert(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill 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
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aServiceException.com.priint.pubserver.exception.PubServerException
-
pushUpdate
public com.priint.pubserver.webservice.ServiceResult pushUpdate(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill 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.source- currently not in use- Returns:
- Returns a
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.com.priint.pubserver.exception.PubServerException
-
pushDelete
public com.priint.pubserver.webservice.ServiceResult pushDelete(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill delete 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 delete all entitydata objects referenced by identifier.source- Name of originator of the data. Currently not in use.- Returns:
- Returns a
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.com.priint.pubserver.exception.PubServerException
-
getProposedEntities
public java.lang.Object getProposedEntities(java.lang.String instance, java.lang.String source) throws com.priint.pubserver.exception.PubServerExceptionGet 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
ProposedEntitiesobject. - Throws:
ServiceException- throwsServiceExceptionif anything fails.com.priint.pubserver.exception.PubServerException
-
callPushData
public java.lang.String callPushData(java.util.Map<java.lang.String,java.lang.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- is a map containing the parameters- Returns:
- Returns a string: either 'ok' or 'error'
-
clearCaches
public com.priint.pubserver.webservice.ServiceResult clearCaches(java.lang.String instance) throws com.priint.pubserver.exception.PubServerExceptionClears the cache of the PublishingHubDB connector instance.The following params are supported.
- "instance": Name of the connector instance. Different instances are typically associated with different data sources.
- Parameters:
instance- Name of the connector instance. Different instances are typically associated with different data sources.- Returns:
- Returns a
ServiceResultobject. - Throws:
com.priint.pubserver.exception.PubServerException- throwsPubServerExceptionif anything fails.
-
pushUpsert
public com.priint.pubserver.webservice.ServiceResult pushUpsert(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill create (insert/persist) and update (merge) 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.data- Data to be processed. Will try to create all entitydata objects referenced by identifier.source- currently not in use- Returns:
- Returns a
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.com.priint.pubserver.exception.PubServerException
-
pushCommit
public com.priint.pubserver.webservice.ServiceResult pushCommit(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill commit 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 commit all entitydata objects referenced by identifier.source- currently not in use Data to be processed. Will try to commit all entitydata objects referenced by identifier.- Returns:
- Returns a
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.com.priint.pubserver.exception.PubServerException
-
pushSelect
public com.priint.pubserver.webservice.ServiceResult pushSelect(java.lang.String mappedName, java.lang.String instance, java.lang.String source, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data) throws com.priint.pubserver.exception.PubServerExceptionWill read all entitydata from 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- Name of originator of the data. Currently not in use.data- Data to be processed. Will try to read all entitydata objects referenced by identifier.- Returns:
- Returns a
ServiceResultobject. - Throws:
ServiceException- If anything fails HTTP error 500 will be send. Exception data will be returned to the client in aPubServerException.com.priint.pubserver.exception.PubServerException
-
-