Package org.ametys.cms.workflow
Class RestoreRevisionFunction
- java.lang.Object
-
- org.ametys.plugins.workflow.AbstractWorkflowComponent
-
- org.ametys.cms.workflow.AbstractContentWorkflowComponent
-
- org.ametys.cms.workflow.AbstractContentFunction
-
- org.ametys.cms.workflow.RestoreRevisionFunction
-
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider,Initializable,LogEnabled,Serviceable
public class RestoreRevisionFunction extends AbstractContentFunction
OSWorkflow function to restore an old revision of a content. Builds a Map with the old content's metadata values, and passes it to theEditContentFunction, which does the real job.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint_cTypeEPThe content type extension point.protected ContentTypesHelper_cTypeHelperThe content type helper.protected JSONUtils_jsonUtilsThe JSON conversion utilities.protected AmetysObjectResolver_resolverThe ametys object resolver.-
Fields inherited from class org.ametys.cms.workflow.AbstractContentFunction
_observationManager, _workflowProvider
-
Fields inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
_contentHelper, CONTENT_KEY
-
Fields inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY
-
-
Constructor Summary
Constructors Constructor Description RestoreRevisionFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps)protected voidprocessBinaryMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a binary old content metadata and put it in the new values map.protected voidprocessCompositeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)Get the value from a Composite old content metadata and put it in the new values map.protected voidprocessContentMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)Get the value from a Content old content metadata and put it in the new values map.protected voidprocessDateMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a Date old content metadata and put it in the new values map.protected voidprocessDatetimeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a DateTime old content metadata and put it in the new values map.protected voidprocessFileMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a File old content metadata and put it in the new values map.protected voidprocessGeocodeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a geocode old content metadata and put it in the new values map.protected voidprocessMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)Process a metadata from the old content.protected voidprocessMetadatas(Content content, Content oldContent, Map<String,Object> newValues, Map<String,Object> brokenReferences)Process the old content metadatas.protected voidprocessMetadatas(CompositeMetadata metaHolder, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)Process the old content metadatas.protected voidprocessMultilingualStringMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from aMultilingualStringold content metadata and put it in the new values map.protected voidprocessReferenceMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)Get the value from a Reference old content metadata and put it in the new values map.protected voidprocessRichtextMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a RichText old content metadata and put it in the new values map.protected voidprocessStringMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a String old content metadata and put it in the new values map.protected voidprocessUserMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)Get the value from a user old content metadata and put it in the new values map.voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.cms.workflow.AbstractContentFunction
_addLabel, _addLockToken, _createVersion, _setCurrentStepId, _setCurrentStepIdAndNotify, initialize
-
Methods inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
getContent
-
Methods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content type helper.
-
_jsonUtils
protected JSONUtils _jsonUtils
The JSON conversion utilities.
-
-
Constructor Detail
-
RestoreRevisionFunction
public RestoreRevisionFunction()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractContentWorkflowComponent- Throws:
ServiceException
-
execute
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
- Throws:
com.opensymphony.workflow.WorkflowException
-
processMetadatas
protected void processMetadatas(Content content, Content oldContent, Map<String,Object> newValues, Map<String,Object> brokenReferences) throws com.opensymphony.workflow.WorkflowException
Process the old content metadatas.- Parameters:
content- the current content (the one being modified).oldContent- the old content.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
processMetadatas
protected void processMetadatas(CompositeMetadata metaHolder, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences) throws com.opensymphony.workflow.WorkflowException
Process the old content metadatas.- Parameters:
metaHolder- the source metadata holder.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
processMetadata
protected void processMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences) throws com.opensymphony.workflow.WorkflowException
Process a metadata from the old content.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
processStringMetadata
protected void processStringMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a String old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processDateMetadata
protected void processDateMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a Date old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processDatetimeMetadata
protected void processDatetimeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a DateTime old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processGeocodeMetadata
protected void processGeocodeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a geocode old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processUserMetadata
protected void processUserMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a user old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processMultilingualStringMetadata
protected void processMultilingualStringMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from aMultilingualStringold content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processRichtextMetadata
protected void processRichtextMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues) throws com.opensymphony.workflow.WorkflowException
Get the value from a RichText old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
processBinaryMetadata
protected void processBinaryMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a binary old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processFileMetadata
protected void processFileMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues)
Get the value from a File old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.
-
processReferenceMetadata
protected void processReferenceMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)
Get the value from a Reference old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).
-
processContentMetadata
protected void processContentMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences)
Get the value from a Content old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).
-
processCompositeMetadata
protected void processCompositeMetadata(CompositeMetadata metaHolder, String metaName, MetadataDefinition metaDef, String metaPath, Map<String,Object> newValues, Map<String,Object> brokenReferences) throws com.opensymphony.workflow.WorkflowException
Get the value from a Composite old content metadata and put it in the new values map.- Parameters:
metaHolder- the source metadata holder.metaName- the metadata name.metaDef- the metadata definition.metaPath- the metadata path.newValues- the Map to fill with the old content's values.brokenReferences- the Map of broken references (which could not be restored).- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
-