Class SynchronizableContentsCollectionHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollectionHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class SynchronizableContentsCollectionHelper
extends AbstractLogEnabled
implements Serviceable, Component
Helper for Synchronizable Contents Collections.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The content type extension pointprotected CurrentUserProvider
The current user providerprotected AmetysObjectResolver
The Ametys resolverprotected SynchronizableContentsCollectionDAO
SCC DAOstatic final String
The Avalon Role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCollectionExpression
(String collectionId) Retrieves a query expression testing the collectiongetSCCFromModelId
(String modelId) Get the firstSynchronizableContentsCollection
found for the given SCC model id.getSyncCode
(String contentId, String collectionId) Get the value of the synchronization field.getSynchronizableCollectionIds
(Content content) Retrieves the synchronizable collection identifiersImport the content specified by the id in the specified collection.organizeRemoteValuesByAttribute
(Map<String, Map<String, Object>> searchResult, Map<String, List<String>> mapping) Transform results to be organized by content attribute, and remove the null values.void
removeSCCProperty
(Content content, String collectionId) Remove the synchronizable collection id from the SCC propertyvoid
service
(ServiceManager smanager) boolean
synchronizeContent
(String collectionId, String contentId, String syncCode) Synchronize the content on the given collection with the given synchronization code.void
Update the given content's synchronization propertiesvoid
updateSCCProperty
(Content content, String collectionId) Add the given synchronizable collection id to the existing onesMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon Role -
_sccDAO
SCC DAO -
_contentTypeEP
The content type extension point -
_currentUserProvider
The current user provider -
_resolver
The Ametys resolver
-
-
Constructor Details
-
SynchronizableContentsCollectionHelper
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSCCFromModelId
Get the firstSynchronizableContentsCollection
found for the given SCC model id.- Parameters:
modelId
- Id of the SCC model- Returns:
- The first SCC found or null
-
organizeRemoteValuesByAttribute
public Map<String,Map<String, organizeRemoteValuesByAttributeList<Object>>> (Map<String, Map<String, Object>> searchResult, Map<String, List<String>> mapping) Transform results to be organized by content attribute, and remove the null values.- Parameters:
searchResult
- Remote values from a search by content and column or attributemapping
- Mapping between content attribute and columns/attributes- Returns:
- A
Map
of possible attribute values organized by content synchronization key and attribute name
-
updateSCCProperty
Add the given synchronizable collection id to the existing ones- Parameters:
content
- The synchronized contentcollectionId
- The ID of the collection to add
-
removeSCCProperty
Remove the synchronizable collection id from the SCC property- Parameters:
content
- The synchronized contentcollectionId
- The ID of the collection to remove
-
updateLastSynchronizationProperties
Update the given content's synchronization properties- Parameters:
content
- the synchronized content
-
getSynchronizableCollectionIds
Retrieves the synchronizable collection identifiers- Parameters:
content
- the content- Returns:
- the synchronizable collection identifiers
- Throws:
AmetysRepositoryException
- if an error occurs while reading SCC info on the given content
-
getCollectionExpression
Retrieves a query expression testing the collection- Parameters:
collectionId
- the identifier of the collection to test- Returns:
- the query expression
-
importContent
public Map<String,Object> importContent(String collectionId, String id, Map<String, Object> additionalParameters) Import the content specified by the id in the specified collection.- Parameters:
collectionId
- Collection IDid
- Synchronization ID of the contentadditionalParameters
- Additional parameters- Returns:
- Imported contents
-
synchronizeContent
Synchronize the content on the given collection with the given synchronization code.- Parameters:
collectionId
- Collection IDcontentId
- Content IDsyncCode
- Synchronization code- Returns:
- true if an error occurred
-
getSyncCode
Get the value of the synchronization field.- Parameters:
contentId
- Content IDcollectionId
- Collection ID- Returns:
- The value of the synchronization field
-