Package org.ametys.cms.content.autosave
Class ContentBackupClientInteraction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.content.autosave.ContentBackupClientInteraction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class ContentBackupClientInteraction
extends AbstractLogEnabled
implements Serviceable, Component
Component for manipulating auto-backup on contents
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondeleteContentBackup
(String contentId) Delete an automatic backup for a content.getBackupData
(ModelAwareDataHolder dataHolder) Retrieves the content backup informationgetContentBackup
(String contentId) Get the content backup informationprotected ModelAwareJCRAmetysObject
getContentNode
(String contentId, boolean createNew) Get the storage node for a content in the automatic backup space, or create it if it doesn't exist.protected ModifiableTraversableAmetysObject
Get the temporary backup root, or create it if it doesn't exist.getRepeatersBackupData
(ModelAwareDataHolder dataHolder) Retrieves the repeaters backup informationgetValuesBackupData
(ModelAwareDataHolder dataHolder, String valuesRepeaterPath) Retrieves the values backup informationprotected void
Remove all the repeater entries of a given data holder.void
service
(ServiceManager manager) setContentBackup
(String contentId, Map<String, Object> values, Map<String, Object> invalidValues, String comments, Collection<Map<String, String>> repeaters) Store an automatic backup for a content.protected void
storeRepeaters
(ModifiableModelAwareDataHolder dataHolder, Collection<Map<String, String>> repeaters) Store the repeater item counts to be able to re-initialize themprotected void
storeValues
(ModifiableModelAwareDataHolder dataHolder, String valuesRepeaterPath, Map<String, Object> values) Store the attribute valuesMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
ContentBackupClientInteraction
public ContentBackupClientInteraction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getContentBackup
Get the content backup information- Parameters:
contentId
- The content id- Returns:
- The saved data
-
getBackupData
Retrieves the content backup information- Parameters:
dataHolder
- the content backup data holder- Returns:
- the content backup information
-
getValuesBackupData
protected List<Map<String,Object>> getValuesBackupData(ModelAwareDataHolder dataHolder, String valuesRepeaterPath) Retrieves the values backup information- Parameters:
dataHolder
- the content backup data holdervaluesRepeaterPath
- the path of the values attribute- Returns:
- the values backup information
-
getRepeatersBackupData
Retrieves the repeaters backup information- Parameters:
dataHolder
- the content backup data holder- Returns:
- the repeaters backup information
-
deleteContentBackup
Delete an automatic backup for a content.- Parameters:
contentId
- The content id- Returns:
- A empty map
-
setContentBackup
public Map<String,Object> setContentBackup(String contentId, Map<String, Object> values, Map<String, Object> invalidValues, String comments, Collection<Map<String, String>> repeaters) Store an automatic backup for a content.- Parameters:
contentId
- The content idvalues
- The valid values to storeinvalidValues
- The invalid values to storecomments
- The comments as JSON stringrepeaters
- The repeaters to store- Returns:
- A empty Map
-
storeValues
protected void storeValues(ModifiableModelAwareDataHolder dataHolder, String valuesRepeaterPath, Map<String, Object> values) Store the attribute values- Parameters:
dataHolder
- the content backup data holdervaluesRepeaterPath
- the path of the values attributevalues
- the values to store, as a Map of values, indexed by name.
-
storeRepeaters
protected void storeRepeaters(ModifiableModelAwareDataHolder dataHolder, Collection<Map<String, String>> repeaters) Store the repeater item counts to be able to re-initialize them- Parameters:
dataHolder
- the content backup data holderrepeaters
- the repeaters data
-
removeAllRepeaterEntries
Remove all the repeater entries of a given data holder.- Parameters:
dataHolder
- the data holder to clear.
-
getContentNode
Get the storage node for a content in the automatic backup space, or create it if it doesn't exist.- Parameters:
contentId
- the content ID.createNew
-true
to create automatically the node when missing.- Returns:
- the content backup storage node.
-
getOrCreateTempRoot
Get the temporary backup root, or create it if it doesn't exist.- Returns:
- the temporary backup root.
-