Class AbstractService

java.lang.Object
com.priint.pubserver.plugin.PluginControlDefault
com.priint.pubserver.entitydata.service.AbstractService
All Implemented Interfaces:
com.priint.pubserver.plugin.interfaces.PluginControl
Direct Known Subclasses:
ConnectorService, DataProviderService, EntityManagerService, EntityModelService, PushService, PushServicePlugin

public abstract class AbstractService extends com.priint.pubserver.plugin.PluginControlDefault
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Intentionally using the HTTP equivalent code 409 (Conflict).
    static final int
    Intentionally using the HTTP equivalent code 404 (Not Found).
    protected jakarta.servlet.http.HttpServletRequest
     
    protected jakarta.servlet.http.HttpServletResponse
     
    protected static org.slf4j.Logger
     
    protected PluginLib
     
    protected static final String
     
    static final String
    Used as wildcard character for ConnectorEntityId and ResultType.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    clean(com.priint.pubserver.plugin.entitydata.EntityData item)
     
    protected void
    clean(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> items)
     
    protected String
    connectorEntityFromRequest(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity)
     
    protected com.priint.pubserver.plugin.entitydata.ConnectorEntity
    connectorEntityFromRequest(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity, String instance, String parentIdentifier)
     
    protected String
     
    protected com.priint.pubserver.plugin.entitydata.ConnectorEntity
    connectorEntityFromRequest(String connectorEntityId, String instance, String parentIdentifier)
     
    protected com.priint.pubserver.plugin.entitydata.Context
     
    protected static com.priint.pubserver.plugin.entitydata.Context
    contextFromListField(jakarta.servlet.http.HttpServletRequest httpServletRequest)
    Example
    ?context=language:deu&context=country:DE&context=assortment:0815
    protected static com.priint.pubserver.plugin.entitydata.EntityItem
    fillUpdateItem(com.priint.pubserver.plugin.entitydata.EntityData expectedItem, List<? extends com.priint.pubserver.plugin.entitydata.EntityData> actualItems)
     
    protected static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update
    fillUpdateRecords(String instance, com.priint.pubserver.plugin.entitydata.EntityData expectedItem, List<? extends com.priint.pubserver.plugin.entitydata.EntityData> actualItems)
     
    static Method
    findMethod(Class<? extends com.priint.pubserver.plugin.entitydata.EntityData> clazz, String property)
     
    static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData
    fromEntityDataList(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> list)
    Converts a list of EntityData to a push data object.
    static com.priint.pubserver.plugin.entitydata.Data
    fromEntityDataList(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> list, com.priint.pubserver.plugin.entitydata.Data data)
    Converts a list of EntityData to a push data object.
    protected <T> T
    lookupBean(String jndiName, Class<T> clazz)
     
    protected com.priint.pubserver.plugin.interfaces.ConnectorRemote
    lookupConnector(String mappedName, String instanceName)
     
    protected com.priint.pubserver.plugin.interfaces.EntityManagerRemote
     
    protected com.priint.pubserver.plugin.interfaces.ConnectorPersistLocal
    lookupPersistConnector(String mappedName, String instanceName)
     
    protected <T> T
    lookupPlugin(String mappedName, String instanceName, Class<T> type)
     
    protected static <T> T
    lookupPluginByJndi(String jndiName, String mappedName, String instanceName, Class<T> clazz)
     
    protected <T> T
    lookupPluginByPluginManager(String sessionId, String mappedName, String instanceName, Class<T> clazz)
     
    protected Object
     
    protected com.priint.pubserver.plugin.interfaces.PublishingManagementConnector
     
    static void
    preProcessData(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)
    Process data object with all embedded entitydata recursively. Add origin (if missing).
    static void
    setConnectorEntity(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity, com.priint.pubserver.plugin.entitydata.EntityData entityData)
     
    static void
    setConnectorEntity(String instance, com.priint.pubserver.plugin.entitydata.EntityData entityData)
     
    static List<com.priint.pubserver.plugin.entitydata.EntityData>
    toEntityDataList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Converts the current PushData object into a list if EntityData (for later update).
    static Map<String,com.priint.pubserver.plugin.entitydata.EntityData>
    toEntityDataMap(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Create a map of entity data identified by key [className+identifier].
    static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord
    toEntityDataRecord(com.priint.pubserver.plugin.entitydata.EntityData item)
    Creates an EntityDataRecord (for delete) from an EntityData item (like Bucket, Cord, etc).
    static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update
    toEntityDataRecord4Update(com.priint.pubserver.plugin.entitydata.EntityData entityData)
     
    static List<com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update>
    toEntityDataRecord4UpdateList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Converts the current PushData object into a list if EntityDataRecord4Update.
    static List<com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord>
    toEntityDataRecordList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Converts the current PushData object into a list if EntityDataRecord (for delete).
    static com.priint.pubserver.plugin.entitydata.EntityItem
    toEntityItem(com.priint.pubserver.plugin.entitydata.EntityData entityData, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushCommand command)
    Creates an EntityDataRecord (for delete) from an EntityData item (like Bucket, Cord, etc).
    static List<com.priint.pubserver.plugin.entitydata.EntityItem>
    toEntityItem4UpdateList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Converts the current PushData object into a list if EntityDataRecord4Update.
    static com.priint.pubserver.plugin.entitydata.EntityItem
    toEntityItemForUpdate(com.priint.pubserver.plugin.entitydata.EntityData entityData)
     
    static List<com.priint.pubserver.plugin.entitydata.EntityItem>
    toEntityItemList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
    Converts the current PushData object into a list if EntityDataRecord (for delete).
    static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData
    toPushData(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData insertData, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData intoData)
     

    Methods inherited from class com.priint.pubserver.plugin.PluginControlDefault

    afterCreateConfigurations, afterDeleteConfigurations, afterUpdateConfigurations, createConfiguration, deleteConfigurations, getSession, getSessionId, initInstance, loadServerConfig, ping, readSessionAttribute, updateConfigurations, writeSessionAttribute

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.priint.pubserver.plugin.interfaces.PluginControl

    validateConfigurations
  • Field Details

    • WILDCARD

      public static final String WILDCARD
      Used as wildcard character for ConnectorEntityId and ResultType. Will be replaced by null in connector queries.
      See Also:
    • ERR_OBJECT_ALREADY_EXISTS

      public static final int ERR_OBJECT_ALREADY_EXISTS
      Intentionally using the HTTP equivalent code 409 (Conflict).
      This will generate a 422 (Unprocessable Entity) on a rest service.
      This is indicating that client should not retry the request until data have been fixed.
      See Also:
    • ERR_OBJECT_DOES_NOT_EXIST

      public static final int ERR_OBJECT_DOES_NOT_EXIST
      Intentionally using the HTTP equivalent code 404 (Not Found).
      This will generate a 422 (Unprocessable Entity) on a rest service.
      This is indicating that client should not retry the request until data have been fixed.
      See Also:
    • logger

      protected static org.slf4j.Logger logger
    • PUBLISHINGHUBDB_MAPPED_NAME

      protected static final String PUBLISHINGHUBDB_MAPPED_NAME
      See Also:
    • httpServletRequest

      @Context protected jakarta.servlet.http.HttpServletRequest httpServletRequest
    • httpServletResponse

      @Context protected jakarta.servlet.http.HttpServletResponse httpServletResponse
    • pluginLibrary

      protected PluginLib pluginLibrary
  • Constructor Details

    • AbstractService

      public AbstractService()
  • Method Details

    • fillUpdateItem

      protected static com.priint.pubserver.plugin.entitydata.EntityItem fillUpdateItem(com.priint.pubserver.plugin.entitydata.EntityData expectedItem, List<? extends com.priint.pubserver.plugin.entitydata.EntityData> actualItems) throws com.priint.pubserver.plugin.exception.ConnectorException
      Throws:
      com.priint.pubserver.plugin.exception.ConnectorException
    • fillUpdateRecords

      protected static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update fillUpdateRecords(String instance, com.priint.pubserver.plugin.entitydata.EntityData expectedItem, List<? extends com.priint.pubserver.plugin.entitydata.EntityData> actualItems) throws com.priint.pubserver.plugin.exception.ConnectorException, ServiceException
      Throws:
      com.priint.pubserver.plugin.exception.ConnectorException
      ServiceException
    • findMethod

      public static Method findMethod(Class<? extends com.priint.pubserver.plugin.entitydata.EntityData> clazz, String property) throws NoSuchMethodException
      Throws:
      NoSuchMethodException
    • fromEntityDataList

      public static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData fromEntityDataList(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> list)
      Converts a list of EntityData to a push data object.
      Parameters:
      list - of any EntityData
      Returns:
    • fromEntityDataList

      public static com.priint.pubserver.plugin.entitydata.Data fromEntityDataList(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> list, com.priint.pubserver.plugin.entitydata.Data data)
      Converts a list of EntityData to a push data object.
      Parameters:
      list - of any EntityData
      data - target object to take the EntityData items (should not be null)
      Returns:
      Since:
      4.1.0 planning supported
    • lookupPluginByJndi

      protected static <T> T lookupPluginByJndi(String jndiName, String mappedName, String instanceName, Class<T> clazz) throws NamingException, com.priint.pubserver.exception.PubServerException
      Throws:
      NamingException
      com.priint.pubserver.exception.PubServerException
    • preProcessData

      public static void preProcessData(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData data)
      Process data object with all embedded entitydata recursively.
      • Add origin (if missing).
      • Set context and context identifier (if missing).
      Parameters:
      data -
      Since:
      4.1.0 plannings attribute supported
    • toEntityDataList

      public static List<com.priint.pubserver.plugin.entitydata.EntityData> toEntityDataList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Converts the current PushData object into a list if EntityData (for later update).
      Returns:
      Since:
      4.1.0 plannings attribute supported
    • toEntityDataMap

      public static Map<String,com.priint.pubserver.plugin.entitydata.EntityData> toEntityDataMap(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Create a map of entity data identified by key [className+identifier]. Creation order of the entries reflects proposed insertion order.

      Entries with key but empty value are expected to already exist in the data target.

      Returns:
      Since:
      4.1.0 plannings attribute supported
    • toEntityItem

      public static com.priint.pubserver.plugin.entitydata.EntityItem toEntityItem(com.priint.pubserver.plugin.entitydata.EntityData entityData, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushCommand command)
      Creates an EntityDataRecord (for delete) from an EntityData item (like Bucket, Cord, etc).
      Parameters:
      entityData -
      command -
      Returns:
      EntityItem
    • toEntityDataRecord

      public static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord toEntityDataRecord(com.priint.pubserver.plugin.entitydata.EntityData item)
      Creates an EntityDataRecord (for delete) from an EntityData item (like Bucket, Cord, etc).
      Parameters:
      item -
      Returns:
    • toEntityItemForUpdate

      public static com.priint.pubserver.plugin.entitydata.EntityItem toEntityItemForUpdate(com.priint.pubserver.plugin.entitydata.EntityData entityData)
      Parameters:
      entityData -
      Returns:
    • toEntityDataRecord4Update

      public static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update toEntityDataRecord4Update(com.priint.pubserver.plugin.entitydata.EntityData entityData)
      Parameters:
      entityData -
      Returns:
    • toEntityItem4UpdateList

      public static List<com.priint.pubserver.plugin.entitydata.EntityItem> toEntityItem4UpdateList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Converts the current PushData object into a list if EntityDataRecord4Update.
      Returns:
    • toEntityDataRecord4UpdateList

      public static List<com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord4Update> toEntityDataRecord4UpdateList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Converts the current PushData object into a list if EntityDataRecord4Update.
      Returns:
    • toEntityItemList

      public static List<com.priint.pubserver.plugin.entitydata.EntityItem> toEntityItemList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Converts the current PushData object into a list if EntityDataRecord (for delete).
      Parameters:
      pushData -
      Returns:
      List of EntityItem
    • toEntityDataRecordList

      public static List<com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.EntityDataRecord> toEntityDataRecordList(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData pushData)
      Converts the current PushData object into a list if EntityDataRecord (for delete).
      Returns:
    • toPushData

      public static com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData toPushData(com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData insertData, com.priint.pubserver.plugin.interfaces.ConnectorPersistRemote.PushData intoData)
      Returns:
      Since:
      4.1.0 plannings attribute supported
    • connectorEntityFromRequest

      protected com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntityFromRequest(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity, String instance, String parentIdentifier)
    • connectorEntityFromRequest

      protected com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntityFromRequest(String connectorEntityId, String instance, String parentIdentifier)
    • connectorEntityFromRequest

      protected String connectorEntityFromRequest(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity)
    • connectorEntityFromRequest

      protected String connectorEntityFromRequest(String connectorEntity)
    • contextFromListField

      protected com.priint.pubserver.plugin.entitydata.Context contextFromListField()
    • contextFromListField

      protected static com.priint.pubserver.plugin.entitydata.Context contextFromListField(jakarta.servlet.http.HttpServletRequest httpServletRequest)
      Example
      ?context=language:deu&context=country:DE&context=assortment:0815
      Returns:
    • lookupConnector

      protected com.priint.pubserver.plugin.interfaces.ConnectorRemote lookupConnector(String mappedName, String instanceName) throws ServiceException
      Throws:
      ServiceException
    • lookupEntityManager

      protected com.priint.pubserver.plugin.interfaces.EntityManagerRemote lookupEntityManager() throws ServiceException
      Throws:
      ServiceException
    • lookupPublishingManagementConnector

      protected com.priint.pubserver.plugin.interfaces.PublishingManagementConnector lookupPublishingManagementConnector(String mappedName, String instanceName) throws ServiceException
      Throws:
      ServiceException
    • lookupPersistConnector

      protected com.priint.pubserver.plugin.interfaces.ConnectorPersistLocal lookupPersistConnector(String mappedName, String instanceName) throws ServiceException
      Throws:
      ServiceException
    • lookupBean

      protected <T> T lookupBean(String jndiName, Class<T> clazz) throws ServiceException
      Throws:
      ServiceException
    • lookupPlugin

      protected <T> T lookupPlugin(String mappedName, String instanceName, Class<T> type) throws ServiceException
      Throws:
      ServiceException
    • lookupPluginByPluginManager

      protected <T> T lookupPluginByPluginManager(String sessionId, String mappedName, String instanceName, Class<T> clazz) throws com.priint.pubserver.exception.PubServerException
      Throws:
      com.priint.pubserver.exception.PubServerException
    • lookupPublishingHubDBConnector

      protected Object lookupPublishingHubDBConnector() throws ServiceException
      Throws:
      ServiceException
    • setConnectorEntity

      public static void setConnectorEntity(String instance, com.priint.pubserver.plugin.entitydata.EntityData entityData)
    • setConnectorEntity

      public static void setConnectorEntity(com.priint.pubserver.plugin.entitydata.ConnectorEntity connectorEntity, com.priint.pubserver.plugin.entitydata.EntityData entityData)
    • clean

      protected void clean(List<? extends com.priint.pubserver.plugin.entitydata.EntityData> items)
    • clean

      protected void clean(com.priint.pubserver.plugin.entitydata.EntityData item)