Class EditSynchronizedContentFunction
- java.lang.Object
-
- org.ametys.plugins.workflow.AbstractWorkflowComponent
-
- org.ametys.cms.workflow.AbstractContentWorkflowComponent
-
- org.ametys.cms.workflow.EditContentFunction
-
- org.ametys.plugins.contentio.synchronize.workflow.EditSynchronizedContentFunction
-
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider,Initializable,LogEnabled,Serviceable
public class EditSynchronizedContentFunction extends EditContentFunction
OSWorkflow function to edit (import or synchronize) a synchronized content.
-
-
Field Summary
Fields Modifier and Type Field Description static StringADDITIONAL_PARAMS_KEYConstant for storing the import parameters into the transient variables map.static intDEFAULT_INVERT_EDIT_ACTION_IDDefault action id of editing revert relations.static intDEFAULT_SYNCHRO_INVERT_EDIT_ACTION_IDDefault action id of editing invert relations on synchronized contents.static StringIMPORTImport mode parameter.static StringINVERT_EDIT_ACTION_ID_KEYConstant for storing the action id for editing invert relations.static StringNOT_SYNCHRONIZED_RELATED_CONTENT_IDS_KEYConstant for storing the ids of the contents related to the current content but that are not part of the synchronizationstatic StringSCC_KEYConstant for storing the scc into the transient variables map.static StringSCC_LOGGER_KEYConstant for storing the scc logger into the transient variables map.static StringSYNCHRO_INVERT_EDIT_ACTION_ID_KEYConstant for storing the action id for editing invert relations on synchronized contents.-
Fields inherited from class org.ametys.cms.workflow.EditContentFunction
_contentDataHelper, _contentTypeExtensionPoint, _contentTypesHelper, _externalizableDataProviderEP, _observationManager, _outgoingReferencesExtractor, _userManager, _workflowHelper, FALLBACK_VIEW_NAME, FORM_ELEMENTS_PREFIX, FORM_RAW_COMMENTS, FORM_RAW_VALUES, GLOBAL_ERROR_KEY, INTERNAL_FORM_ELEMENTS_PREFIX, INVERT_EDIT_ACTION_ID, INVERT_RELATION_EDIT_WORKFLOW_ACTION_ID, LOCAL_ONLY, QUIT, SYNCHRONIZATION_RESULT, VALUES_KEY, VIEW, VIEW_ITEMS, VIEW_NAME
-
Fields inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
_contentHelper, CONTENT_KEY, HAS_CHANGED_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 EditSynchronizedContentFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object_convertValue(ElementDefinition definition, Object value, Map transientVars)Converts the given value according to the given definition If the value is multiple, an array is retrieved with each value converted to the right typeprotected ContentSynchronizationResultadditionalOperations(ModifiableContent content, Map transientVars)Allow to do some other modifications on the given content before saving changesprotected voidextractOutgoingReferences(ModifiableContent content, SynchronizationResult synchronizationResult)Analyze the content to extract outgoing references and store themprotected Map<String,Object>getAdditionalParameters(Map transientVars)Retrieve the synchronization additional parametersprotected intgetInvertEditActionId(Map transientVars, Content referencedContent)Get the identifier of the invert edit actionprotected org.slf4j.LoggergetLogger(Map transientVars)Retrieve the scc loggerprotected Optional<SynchronizableContentsCollection>getSynchronizableContentsCollection(Map transientVars)Retrieve the scc associated with the workflow.protected ContentSynchronizationContextgetSynchronizationContext(Map transientVars)Retrieves the synchronization contextprotected ExternalizableDataProvider.ExternalizableDataStatusgetValueExternalizableDataStatus(Content content, ModelItem definition, Map transientVars)Get the status of the value to modifyprotected voidglobalValidate(View view, Content content, Map<String,Object> values, AllErrors allErrors)Performs a global validation of the Content, based on declaredContentValidators.protected booleanisImportMode(Map transientVars)Determine if the content is being imported or synchronizedprotected voidnotifyContentModified(Content content, Map transientVars, SynchronizationResult synchronizationResult)Notify observers that the content has been modifiedprotected voidnotifyContentModifying(Content content, Map<String,Object> values, Map transientVars)Notify observers that the content is being modifiedprotected voidupdateCommonMetadata(ModifiableContent content, UserIdentity user, SynchronizationResult synchronizationResult)Updates common metadata (last contributor, last modification date, ...).protected voidvalidateValues(View view, ModifiableContent content, Map<String,Object> values, AllErrors allErrors, Map transientVars)Validates all input values.-
Methods inherited from class org.ametys.cms.workflow.EditContentFunction
execute, getValues, getView, initialize, invertRelationEnabled, prepareSynchronize, synchronize, triggerInvertWorkflowAction, validateRepeaterValue, validateValue
-
Methods inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent
getContent, service
-
Methods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser
-
-
-
-
Field Detail
-
SYNCHRO_INVERT_EDIT_ACTION_ID_KEY
public static final String SYNCHRO_INVERT_EDIT_ACTION_ID_KEY
Constant for storing the action id for editing invert relations on synchronized contents.
-
INVERT_EDIT_ACTION_ID_KEY
public static final String INVERT_EDIT_ACTION_ID_KEY
Constant for storing the action id for editing invert relations.
-
NOT_SYNCHRONIZED_RELATED_CONTENT_IDS_KEY
public static final String NOT_SYNCHRONIZED_RELATED_CONTENT_IDS_KEY
Constant for storing the ids of the contents related to the current content but that are not part of the synchronization
-
SCC_KEY
public static final String SCC_KEY
Constant for storing the scc into the transient variables map.
-
SCC_LOGGER_KEY
public static final String SCC_LOGGER_KEY
Constant for storing the scc logger into the transient variables map.
-
ADDITIONAL_PARAMS_KEY
public static final String ADDITIONAL_PARAMS_KEY
Constant for storing the import parameters into the transient variables map.
-
DEFAULT_SYNCHRO_INVERT_EDIT_ACTION_ID
public static final int DEFAULT_SYNCHRO_INVERT_EDIT_ACTION_ID
Default action id of editing invert relations on synchronized contents.- See Also:
- Constant Field Values
-
DEFAULT_INVERT_EDIT_ACTION_ID
public static final int DEFAULT_INVERT_EDIT_ACTION_ID
Default action id of editing revert relations.- See Also:
- Constant Field Values
-
IMPORT
public static final String IMPORT
Import mode parameter. If the parameter is present and set totrue, the content is considered as imported. Otherwise, it is considered as synchronized.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EditSynchronizedContentFunction
public EditSynchronizedContentFunction()
-
-
Method Detail
-
getValueExternalizableDataStatus
protected ExternalizableDataProvider.ExternalizableDataStatus getValueExternalizableDataStatus(Content content, ModelItem definition, Map transientVars)
Description copied from class:EditContentFunctionGet the status of the value to modify- Overrides:
getValueExternalizableDataStatusin classEditContentFunction- Parameters:
content- the contentdefinition- the definition of the valuetransientVars- the parameters from the call- Returns:
- the status of the value
-
getSynchronizationContext
protected ContentSynchronizationContext getSynchronizationContext(Map transientVars)
Description copied from class:EditContentFunctionRetrieves the synchronization context- Overrides:
getSynchronizationContextin classEditContentFunction- Parameters:
transientVars- the parameters from the call- Returns:
- the synchronization context
-
_convertValue
protected Object _convertValue(ElementDefinition definition, Object value, Map transientVars)
Description copied from class:EditContentFunctionConverts the given value according to the given definition If the value is multiple, an array is retrieved with each value converted to the right type- Overrides:
_convertValuein classEditContentFunction- Parameters:
definition- the definitionvalue- the value to converttransientVars- the parameters from the call.- Returns:
- the converted value
-
validateValues
protected void validateValues(View view, ModifiableContent content, Map<String,Object> values, AllErrors allErrors, Map transientVars) throws com.opensymphony.workflow.WorkflowException
Description copied from class:EditContentFunctionValidates all input values.- Overrides:
validateValuesin classEditContentFunction- Parameters:
view- the model's view corresponding to the valuescontent- the current contentvalues- the actual input valuesallErrors- object to be populated with validation errorstransientVars- the parameters from the call- Throws:
com.opensymphony.workflow.WorkflowException- If an error occurred
-
globalValidate
protected void globalValidate(View view, Content content, Map<String,Object> values, AllErrors allErrors)
Description copied from class:EditContentFunctionPerforms a global validation of the Content, based on declaredContentValidators.- Overrides:
globalValidatein classEditContentFunction- Parameters:
view- the currentViewcontent- the currentContent.values- the values being setallErrors- object to be populated with validation errors
-
additionalOperations
protected ContentSynchronizationResult additionalOperations(ModifiableContent content, Map transientVars) throws com.opensymphony.workflow.WorkflowException
Description copied from class:EditContentFunctionAllow to do some other modifications on the given content before saving changes- Overrides:
additionalOperationsin classEditContentFunction- Parameters:
content- the contenttransientVars- the parameters from the call- Returns:
- The synchronization result od additional operations
- Throws:
com.opensymphony.workflow.WorkflowException- If an error occurred
-
isImportMode
protected boolean isImportMode(Map transientVars) throws com.opensymphony.workflow.WorkflowException
Determine if the content is being imported or synchronized- Parameters:
transientVars- the parameters from the call.- Returns:
trueif the content is being imported,falseotherwise- Throws:
com.opensymphony.workflow.WorkflowException- if the object model or the request is not present
-
getSynchronizableContentsCollection
protected Optional<SynchronizableContentsCollection> getSynchronizableContentsCollection(Map transientVars)
Retrieve the scc associated with the workflow.- Parameters:
transientVars- the parameters from the call.- Returns:
- the scc.
-
getLogger
protected org.slf4j.Logger getLogger(Map transientVars)
Retrieve the scc logger- Parameters:
transientVars- the parameters from the call.- Returns:
- the scc logger
-
getAdditionalParameters
protected Map<String,Object> getAdditionalParameters(Map transientVars)
Retrieve the synchronization additional parameters- Parameters:
transientVars- the parameters from the call.- Returns:
- the synchronization additional parameters
-
getInvertEditActionId
protected int getInvertEditActionId(Map transientVars, Content referencedContent)
Description copied from class:EditContentFunctionGet the identifier of the invert edit action- Overrides:
getInvertEditActionIdin classEditContentFunction- Parameters:
transientVars- The workflow varsreferencedContent- the content concerned by the invert relation- Returns:
- the identifier of the invert edit action
-
notifyContentModifying
protected void notifyContentModifying(Content content, Map<String,Object> values, Map transientVars) throws com.opensymphony.workflow.WorkflowException
Description copied from class:EditContentFunctionNotify observers that the content is being modified- Overrides:
notifyContentModifyingin classEditContentFunction- Parameters:
content- The content being modifiedvalues- the new values being set to the contenttransientVars- The workflow vars- Throws:
com.opensymphony.workflow.WorkflowException- If an error occurred
-
updateCommonMetadata
protected void updateCommonMetadata(ModifiableContent content, UserIdentity user, SynchronizationResult synchronizationResult) throws com.opensymphony.workflow.WorkflowException
Description copied from class:EditContentFunctionUpdates common metadata (last contributor, last modification date, ...).- Overrides:
updateCommonMetadatain classEditContentFunction- Parameters:
content- the content.user- the user.synchronizationResult- The result of the content values synchronization- Throws:
com.opensymphony.workflow.WorkflowException- if an error occurs.
-
extractOutgoingReferences
protected void extractOutgoingReferences(ModifiableContent content, SynchronizationResult synchronizationResult)
Description copied from class:EditContentFunctionAnalyze the content to extract outgoing references and store them- Overrides:
extractOutgoingReferencesin classEditContentFunction- Parameters:
content- The content to analyzesynchronizationResult- The result of the content values synchronization
-
notifyContentModified
protected void notifyContentModified(Content content, Map transientVars, SynchronizationResult synchronizationResult) throws com.opensymphony.workflow.WorkflowException
Description copied from class:EditContentFunctionNotify observers that the content has been modified- Overrides:
notifyContentModifiedin classEditContentFunction- Parameters:
content- The content modifiedtransientVars- The workflow varssynchronizationResult- The result of the content values synchronization- Throws:
com.opensymphony.workflow.WorkflowException- If an error occurred
-
-