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
,EnhancedFunction
,Initializable
,LogEnabled
,Serviceable
OSWorkflow function to edit (import or synchronize) a synchronized content.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent
AbstractWorkflowComponent.ConditionFailure
Nested classes/interfaces inherited from interface org.ametys.plugins.workflow.EnhancedFunction
EnhancedFunction.FunctionType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant for storing the import parameters into the transient variables map.static final int
Default action id of editing revert relations.static final int
Default action id of editing invert relations on synchronized contents.static final String
Import mode parameter.static final String
Constant for storing the action id for editing invert relations.static final String
Constant for storing the ids of the contents related to the current content but that are not part of the synchronizationstatic final String
Constant for storing the scc into the transient variables map.static final String
Constant for storing the scc logger into the transient variables map.static final String
Constant for storing the action id for editing invert relations on synchronized contents.Fields inherited from class org.ametys.cms.workflow.EditContentFunction
_contentDataHelper, _contentTypeExtensionPoint, _contentTypesHelper, _disableConditionsEvaluator, _externalizableDataProviderEP, _i18nUtils, _observationManager, _outgoingReferencesExtractor, _userManager, _workflowHelper, FALLBACK_VIEW_NAME, FORM_ELEMENTS_PREFIX, FORM_RAW_COMMENTS, FORM_RAW_VALUES, FORM_RAW_VERSION, GLOBAL_VALIDATION, GLOBAL_VALIDATION_RESULT_KEY, IGNORE_WARNINGS, INTERNAL_FORM_ELEMENTS_PREFIX, INVERT_EDIT_ACTION_ID, INVERT_RELATION_EDIT_WORKFLOW_ACTION_ID, KEY_NOTIFY_ARGUMENTS, LOCAL_ONLY, QUIT, RESULT_STATE_KEY, RESULT_STATE_OK, SYNCHRONIZATION_RESULT, VALIDATION_RESULTS_FIELD_LABEL_KEY, VALIDATION_RESULTS_FIELD_PATH_KEY, VALIDATION_RESULTS_FIELD_RESULT_KEY, 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_VALIDATION_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_canWriteModelItem
(ModelItem modelItem, Content content, Map transientVars) Returnstrue
if the current model item is writable for this content in the current context._convertValues
(ModifiableContent content, View view, Map<String, Object> values, Map transientVars) Converts the given values according to the definitions in the givenViewItemAccessor
protected ContentSynchronizationResult
additionalOperations
(ModifiableContent content, Map transientVars) Allow to do some other modifications on the given content before saving changesprotected void
extractOutgoingReferences
(ModifiableContent content, SynchronizationResult synchronizationResult) Analyze the content to extract outgoing references and store themgetAdditionalParameters
(Map transientVars) Retrieve the synchronization additional parametersprotected int
getInvertEditActionId
(Map transientVars, Content referencedContent) Get the identifier of the invert edit actiongetLabel()
Get the label for this functionprotected Logger
Retrieve the scc loggerprotected Optional<SynchronizableContentsCollection>
getSynchronizableContentsCollection
(Map transientVars) Retrieve the scc associated with the workflow.protected ContentSynchronizationContext
getSynchronizationContext
(Map transientVars) Retrieves the synchronization contextprotected ValidationResult
Performs a global validation of the Content, based on declaredContentValidator
s.protected boolean
isImportMode
(Map transientVars) Determine if the content is being imported or synchronizedprotected void
Notify observers that the content is being modifiedprotected void
prepareOrNotifyContentModified
(Content content, Map transientVars, Map args, SynchronizationResult synchronizationResult) Prepare or notify observers that the content has been modifiedprotected void
updateCommonMetadata
(ModifiableContent content, UserIdentity user, SynchronizationResult synchronizationResult) Updates common metadata (last contributor, last modification date, ...).protected ValidationResults
validateValues
(View view, ModifiableContent content, Map<String, Object> values, Map transientVars) Validates all input values.Methods inherited from class org.ametys.cms.workflow.EditContentFunction
execute, getFunctionExecType, getValues, getView, initialize, invertRelationEnabled, prepareSynchronize, processDisableConditions, processDisableConditionsOnComposite, processDisableConditionsOnElement, processDisableConditionsOnRepeater, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.plugins.workflow.EnhancedFunction
getArguments, getFullLabel, getVisibilities
-
Field Details
-
SYNCHRO_INVERT_EDIT_ACTION_ID_KEY
Constant for storing the action id for editing invert relations on synchronized contents. -
INVERT_EDIT_ACTION_ID_KEY
Constant for storing the action id for editing invert relations. -
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
Constant for storing the scc into the transient variables map. -
SCC_LOGGER_KEY
Constant for storing the scc logger into the transient variables map. -
ADDITIONAL_PARAMS_KEY
Constant for storing the import parameters into the transient variables map. -
DEFAULT_SYNCHRO_INVERT_EDIT_ACTION_ID
Default action id of editing invert relations on synchronized contents.- See Also:
-
DEFAULT_INVERT_EDIT_ACTION_ID
Default action id of editing revert relations.- See Also:
-
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:
-
-
Constructor Details
-
EditSynchronizedContentFunction
public EditSynchronizedContentFunction()
-
-
Method Details
-
getSynchronizationContext
Description copied from class:EditContentFunction
Retrieves the synchronization context- Overrides:
getSynchronizationContext
in classEditContentFunction
- Parameters:
transientVars
- the parameters from the call- Returns:
- the synchronization context
-
_convertValues
protected Map<String,Object> _convertValues(ModifiableContent content, View view, Map<String, Object> values, Map transientVars) Description copied from class:EditContentFunction
Converts the given values according to the definitions in the givenViewItemAccessor
- Overrides:
_convertValues
in classEditContentFunction
- Parameters:
content
- the current contentview
- the current viewvalues
- the values to converttransientVars
- the parameters from the call- Returns:
- the converted values
-
validateValues
protected ValidationResults validateValues(View view, ModifiableContent content, Map<String, Object> values, Map transientVars) throws com.opensymphony.workflow.WorkflowExceptionDescription copied from class:EditContentFunction
Validates all input values.- Overrides:
validateValues
in classEditContentFunction
- Parameters:
view
- the model's view corresponding to the valuescontent
- the current contentvalues
- the actual input valuestransientVars
- the parameters from the call- Returns:
- the validation results
- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred
-
globalValidate
Description copied from class:EditContentFunction
Performs a global validation of the Content, based on declaredContentValidator
s.- Overrides:
globalValidate
in classEditContentFunction
- Parameters:
view
- the currentView
content
- the currentContent
.values
- the values being set- Returns:
- the validation results
-
additionalOperations
protected ContentSynchronizationResult additionalOperations(ModifiableContent content, Map transientVars) throws com.opensymphony.workflow.WorkflowException Description copied from class:EditContentFunction
Allow to do some other modifications on the given content before saving changes- Overrides:
additionalOperations
in classEditContentFunction
- Parameters:
content
- the contenttransientVars
- the parameters from the call- Returns:
- The synchronization result of 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:
true
if the content is being imported,false
otherwise- 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
Retrieve the scc logger- Parameters:
transientVars
- the parameters from the call.- Returns:
- the scc logger
-
getAdditionalParameters
Retrieve the synchronization additional parameters- Parameters:
transientVars
- the parameters from the call.- Returns:
- the synchronization additional parameters
-
getInvertEditActionId
Description copied from class:EditContentFunction
Get the identifier of the invert edit action- Overrides:
getInvertEditActionId
in 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.WorkflowExceptionDescription copied from class:EditContentFunction
Notify observers that the content is being modified- Overrides:
notifyContentModifying
in 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:EditContentFunction
Updates common metadata (last contributor, last modification date, ...).- Overrides:
updateCommonMetadata
in 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:EditContentFunction
Analyze the content to extract outgoing references and store them- Overrides:
extractOutgoingReferences
in classEditContentFunction
- Parameters:
content
- The content to analyzesynchronizationResult
- The result of the content values synchronization
-
prepareOrNotifyContentModified
protected void prepareOrNotifyContentModified(Content content, Map transientVars, Map args, SynchronizationResult synchronizationResult) throws com.opensymphony.workflow.WorkflowException Description copied from class:EditContentFunction
Prepare or notify observers that the content has been modified- Overrides:
prepareOrNotifyContentModified
in classEditContentFunction
- Parameters:
content
- The content modifiedtransientVars
- The workflow varsargs
- the workflow argssynchronizationResult
- The result of the content values synchronization- Throws:
com.opensymphony.workflow.WorkflowException
- If an error occurred
-
_canWriteModelItem
Description copied from class:EditContentFunction
Returnstrue
if the current model item is writable for this content in the current context.- Overrides:
_canWriteModelItem
in classEditContentFunction
- Parameters:
modelItem
- The model item to checkcontent
- The contenttransientVars
- The parameters from the call- Returns:
true
if the current model item is writable
-
getLabel
Description copied from interface:EnhancedFunction
Get the label for this function- Specified by:
getLabel
in interfaceEnhancedFunction
- Overrides:
getLabel
in classEditContentFunction
- Returns:
- the label
-