Class AbstractSynchronizableContentsCollection

java.lang.Object
org.ametys.plugins.contentio.synchronize.AbstractStaticSynchronizableContentsCollection
org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection
All Implemented Interfaces:
SynchronizableContentsCollection, Configurable, Serviceable
Direct Known Subclasses:
AbstractCDMFrSynchronizableContentsCollection, AbstractSimpleSynchronizableContentsCollection

Abstract implementation of SynchronizableContentsCollection.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class AbstractStaticSynchronizableContentsCollection
      Throws:
      ServiceException
    • populate

      public List<ModifiableContent> populate(org.slf4j.Logger logger, ContainerProgressionTracker progressionTracker)
      Description copied from interface: SynchronizableContentsCollection
      Populates contents
      Parameters:
      logger - The logger
      progressionTracker - A progression tracker
      Returns:
      Return the populated contents (imported or synchronized)
    • _internalPopulate

      protected List<ModifiableContent> _internalPopulate(org.slf4j.Logger logger)
      Parameters:
      logger - The logger
      Returns:
      The list of created/synchronized contents
    • _internalPopulate

      protected abstract List<ModifiableContent> _internalPopulate(org.slf4j.Logger logger, ContainerProgressionTracker progressionTracker)
      Parameters:
      logger - The logger
      progressionTracker - The progression tracker
      Returns:
      The list of created/synchronized contents
    • empty

      public void empty(org.slf4j.Logger logger)
      Description copied from interface: SynchronizableContentsCollection
      Empty the collection of its synchronized contents
      Parameters:
      logger - The logger
    • deleteUnexistingContents

      protected void deleteUnexistingContents(org.slf4j.Logger logger)
      Delete contents created by a previous synchronization which does not exist anymore in remote source. If the content belongs to several SCC, only the current SCC reference will be deleted.
      Parameters:
      logger - The logger
    • _getContentsToRemove

      Filter the contents to remove.
      Parameters:
      contents - The list of all the available contents
      Returns:
      The List of Content to remove.
    • _removeSCCOrDeleteContents

      protected int _removeSCCOrDeleteContents(List<ModifiableContent> contents, org.slf4j.Logger logger)
      For each content, if the content has only this SCC, try to delete it, but if it has several SCC, remove the current collection from the SCC property.
      Parameters:
      contents - The contents to delete or to remove the SCC
      logger - The logger
      Returns:
      the number of really deleted contents
    • _deleteContents

      protected int _deleteContents(List<Content> contentsToRemove, org.slf4j.Logger logger)
      Delete contents.
      Parameters:
      contentsToRemove - List of contents to remove
      logger - The logger
      Returns:
      the number of deleted contents
    • _logSynchronizationResult

      protected void _logSynchronizationResult(org.slf4j.Logger logger)
      Logs the result of the synchronization, containing
      • The number of created contents
      • The number of synchronized contents
      • The number of unchanged contents
      • The number of deleted contents
      Parameters:
      logger - the logger
    • _hasSomethingChanged

      protected boolean _hasSomethingChanged()
      Checks if some content have changed during the synchronization
      Returns:
      true if some contents have changed, false otherwise
    • sendErrorMail

      protected void sendErrorMail(int nbError) throws jakarta.mail.MessagingException, IOException
      Sends the report mails
      Parameters:
      nbError - The number of error
      Throws:
      jakarta.mail.MessagingException - if a messaging error occurred
      IOException - if an error occurred building the message
    • validateContent

      protected void validateContent(WorkflowAwareContent content, int validationActionId, org.slf4j.Logger logger)
      Validates a content after import
      Parameters:
      content - The content to validate
      validationActionId - Validation action ID to use for this content
      logger - The logger
    • createContentAction

      protected ModifiableContent createContentAction(String contentType, String workflowName, int initialActionId, String lang, String contentTitle, org.slf4j.Logger logger)
      Creates content action with result from request
      Parameters:
      contentType - Type of the content to create
      workflowName - Workflow to use for this content
      initialActionId - Action ID for initialization
      lang - The language
      contentTitle - The content title
      logger - The logger
      Returns:
      The content id, or null of a workflow error occured
    • _getAdditionalInputsForContentCreation

      Retrieves additional inputs for content creation
      Returns:
      the additional inputs for content creation
    • _getExpressionsList

      protected List<Expression> _getExpressionsList(String lang, String idValue, String contentType, boolean forceStrictCheck)
      Construct the query to retrieve the content.
      Parameters:
      lang - Lang
      idValue - Synchronization value
      contentType - Content type
      forceStrictCheck - true to force strict mode to check the collection, otherwise it read the "checkCollection" option
      Returns:
      The List of Expression
    • _getContentPathQuery

      protected String _getContentPathQuery(String lang, String idValue, String contentType, boolean forceStrictCheck)
      Construct the query to retrieve the content.
      Parameters:
      lang - Lang
      idValue - Synchronization value
      contentType - Content type
      forceStrictCheck - true to force strict mode to check the collection, otherwise it read the "checkCollection" option
      Returns:
      The XPATH query
    • _removeEmptyParameters

      protected Map<String,Object> _removeEmptyParameters(Map<String,Object> searchParameters)
      Remove empty parameters to the map
      Parameters:
      searchParameters - the parameters
      Returns:
      the map of none empty parameters
    • _isParamNotEmpty

      protected boolean _isParamNotEmpty(Object parameterValue)
      Check if the parameter value is empty
      Parameters:
      parameterValue - the parameter value
      Returns:
      true if the parameter value is empty
    • getSynchronizationResult

      Description copied from interface: SynchronizableContentsCollection
      Retrieves the result of the synchronization as a map of key / content count containing
      • The number of created contents
      • The number of synchronized contents
      • The number of unchanged contents
      • The number of deleted contents
      Returns:
      the result of the synchronization