Class AbstractSynchronizableContentsCollection

    • Method Detail

      • 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
        Parameters:
        logger - The logger
      • _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
      • sendErrorMail

        protected void sendErrorMail​(int nbError)
                              throws javax.mail.MessagingException
        Sends the report mails
        Parameters:
        nbError - The number of error
        Throws:
        javax.mail.MessagingException - if a messaging error occurred
      • 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
      • applyChanges

        protected boolean applyChanges​(ModifiableDefaultContent content,
                                       org.slf4j.Logger logger)
                                throws RepositoryException
        Does workflow action
        Parameters:
        content - The synchronized content
        logger - The logger
        Returns:
        true if the content is considered as synchronized (the apply succeeded), false otherwise.
        Throws:
        RepositoryException - if an error occurs when trying to rollback pending changes in the repository.
      • applyChanges

        protected boolean applyChanges​(ModifiableDefaultContent content,
                                       Integer actionId,
                                       String event,
                                       org.slf4j.Logger logger)
                                throws RepositoryException
        Does workflow action
        Parameters:
        content - The synchronized content
        actionId - Workflow action
        event - Type of event
        logger - The logger
        Returns:
        true if the content is considered as synchronized (the apply succeeded), false otherwise.
        Throws:
        RepositoryException - if an error occurs when trying to rollback pending changes in the repository.
      • createContentAction

        protected ModifiableDefaultContent 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
      • _getContentPathQuery

        protected String _getContentPathQuery​(String lang,
                                              String idValue,
                                              String contentType)
        Construct the query to retrieve the content.
        Parameters:
        lang - Lang
        idValue - Synchronization value
        contentType - Content type
        Returns:
        The XPATH query
      • _synchronizeMetadata

        protected boolean _synchronizeMetadata​(ModifiableDefaultContent content,
                                               ContentType contentType,
                                               String logicalMetadataPath,
                                               String completeMetadataPath,
                                               List<Object> remoteValue,
                                               boolean synchronize,
                                               boolean create,
                                               org.slf4j.Logger logger)
        Fill the metadata with remove value.
        Parameters:
        content - The content to synchronize
        contentType - The content type
        logicalMetadataPath - The logical metadata path without the entries
        completeMetadataPath - The complete metadata path from the root of the content
        remoteValue - The remote value
        synchronize - true if synchronizable
        create - true if content is creating, false if it is updated
        logger - The logger
        Returns:
        true if changes were made
      • _removeMetadataIfExists

        protected boolean _removeMetadataIfExists​(ModifiableCompositeMetadata metadataHolder,
                                                  String metadataName,
                                                  boolean synchronize)
        Remove the metadata if exists
        Parameters:
        metadataHolder - The metadata holder
        metadataName - The name of the metadata
        synchronize - true if the data is synchronize
        Returns:
        true if the metadata have been removed
      • _updateRelation

        protected boolean _updateRelation​(ModifiableCompositeMetadata metadataToEdit,
                                          String metadataName,
                                          Content content)
        Update the invert relation by adding the new value (Content) to the old values.
        Parameters:
        metadataToEdit - Metadata holder to edit
        metadataName - Metadata name to set
        content - The content to add or remove
        Returns:
        true if there are changes
      • _updateRelation

        protected boolean _updateRelation​(ModifiableCompositeMetadata metadataToEdit,
                                          String metadataName,
                                          Content content,
                                          boolean remove)
        Update the invert relation by adding/removing the content to/from the old values.
        Parameters:
        metadataToEdit - Metadata holder to edit
        metadataName - Metadata name to set
        content - The content to add or remove
        remove - true if we wan't to remove the content from the relation
        Returns:
        true if there are changes
      • _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