Package org.ametys.cms.workflow.copy
Class CreateContentByCopyFunction
java.lang.Object
org.ametys.plugins.workflow.AbstractWorkflowComponent
org.ametys.cms.workflow.AbstractContentWorkflowComponent
org.ametys.cms.workflow.CreateContentFunction
org.ametys.cms.workflow.copy.CreateContentByCopyFunction
- All Implemented Interfaces:
- com.opensymphony.workflow.FunctionProvider,- EnhancedFunction,- LogEnabled,- Serviceable
- Direct Known Subclasses:
- AbstractCreateODFContentByCopyFunction,- CreateContentByCopyFunction
OSWorkflow function to create a content by copy of another
 
 The required transient variables:
 - CreateContentByCopyFunction.BASE_CONTENT_KEY - Content The content that will be used for duplication.
 - or CreateContentByCopyFunction.BASE_CONTENT_ID - String The id of content The content that will be used for duplication.
 
 - CreateContentByCopyFunction.COPY_MAP_KEY - Map<String, Object> The map of properties to copy. Can be null if CreateContentByCopyFunction.COPY_VIEW_NAME is used
- 
Nested Class SummaryNested classes/interfaces inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponentAbstractWorkflowComponent.ConditionFailureNested classes/interfaces inherited from interface org.ametys.plugins.workflow.EnhancedFunctionEnhancedFunction.FunctionType
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected CopyContentComponentThe content copy componentprotected ContentTypesHelperThe content type helperprotected I18nUtilsI18n Utilsstatic final StringConstant for storing the id of base content used for the duplication into the transient variables map.static final StringConstant for storing the base content used for the duplication into the transient variables map.static final StringConstant for storing the name of fallback view to use for copy.static final StringConstant for storing the map containing the duplication info into the transient variables map.static final StringConstant for storing the copy report object into the transient variables map.static final StringConstant for storing the name of view use for copy.Fields inherited from class org.ametys.cms.workflow.CreateContentFunction_contentTypeEP, _contentTypeHelper, _observationManager, _resolver, CONTENT_LANGUAGE_KEY, CONTENT_MIXINS_KEY, CONTENT_NAME_KEY, CONTENT_TITLE_KEY, CONTENT_TITLE_VARIANTS_KEY, CONTENT_TYPES_KEY, INITIAL_VALUE_SUPPLIER, PARENT_CONTEXT_VALUE, ROOT_CONTENT_PATH_KEYFields inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponent_contentHelper, CONTENT_KEY, HAS_CHANGED_KEYFields inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponent_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_VALIDATION_KEY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidgetAdditionalCopyMap(Map transientVars, Content content, String viewName, String fallbackViewName) Get an additional copy map, if any.protected ContentgetBaseContentForCopy(Map transientVars) Get the contentgetLabel()Get the label for this functionprotected voidprocessValues(Map transientVars, ModifiableContent targetContent, Map<String, Object> values) Called after creation and before execution of theEditContentFunctionto allow subclasses to add/remove/modify the values.voidservice(ServiceManager manager) Methods inherited from class org.ametys.cms.workflow.CreateContentFunction_createContent, _eventParamsForContentAdded, _getContentRoot, _getDefaultNameComputationMode, _getNameComputationMode, _getNonNullVar, _getObjectType, _initWorkflow, _isMultilingual, _notifyContentAdded, _populateAdditionalData, _populateContent, _setTitle, getFunctionExecType, getSystemUserMethods inherited from class org.ametys.cms.workflow.AbstractContentWorkflowComponentgetContentMethods inherited from class org.ametys.plugins.workflow.AbstractWorkflowComponentaddWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUserMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.workflow.EnhancedFunctiongetArguments, getFullLabel, getVisibilities
- 
Field Details- 
BASE_CONTENT_KEYConstant for storing the base content used for the duplication into the transient variables map.
- 
BASE_CONTENT_IDConstant for storing the id of base content used for the duplication into the transient variables map.
- 
COPY_MAP_KEYConstant for storing the map containing the duplication info into the transient variables map. Can be null.
- 
COPY_REPORT_KEYConstant for storing the copy report object into the transient variables map. Can be null.
- 
COPY_VIEW_NAMEConstant for storing the name of view use for copy.
- 
COPY_FALLBACK_VIEW_NAMEConstant for storing the name of fallback view to use for copy.
- 
_copyContentComponentThe content copy component
- 
_cTypesHelperThe content type helper
- 
_i18nUtilsI18n Utils
 
- 
- 
Constructor Details- 
CreateContentByCopyFunctionpublic CreateContentByCopyFunction()
 
- 
- 
Method Details- 
service- Specified by:
- servicein interface- Serviceable
- Overrides:
- servicein class- CreateContentFunction
- Throws:
- ServiceException
 
- 
executepublic void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException - Specified by:
- executein interface- com.opensymphony.workflow.FunctionProvider
- Overrides:
- executein class- CreateContentFunction
- Throws:
- com.opensymphony.workflow.WorkflowException
 
- 
processValuesprotected void processValues(Map transientVars, ModifiableContent targetContent, Map<String, Object> values) throws com.opensymphony.workflow.WorkflowExceptionCalled after creation and before execution of theEditContentFunctionto allow subclasses to add/remove/modify the values.- Parameters:
- transientVars- The workflow transient vars
- targetContent- The newly created content
- values- the values computed from the copyMap and to be given to the EditContentFunction.
- Throws:
- com.opensymphony.workflow.WorkflowException- if an error occurs
 
- 
getBaseContentForCopyGet the content- Parameters:
- transientVars- The workflow transient vars with BASE_CONTENT_KEY (the content itself) or BASE_CONTENT_ID (the id of the content)
- Returns:
- the content or null if the object cannot be found
 
- 
getAdditionalCopyMapprotected Map<String,Object> getAdditionalCopyMap(Map transientVars, Content content, String viewName, String fallbackViewName) throws com.opensymphony.workflow.WorkflowException Get an additional copy map, if any. It allows subclasses to provide additional data to copy. This map is concatenated to the initial copy map.- Parameters:
- transientVars- the workflow parameters
- content- the source content to be copied
- viewName- the view name
- fallbackViewName- the fallback view name, if required view does not exist
- Returns:
- the additional copy map, or null if none.
- Throws:
- com.opensymphony.workflow.WorkflowException- if an error occurs
 
- 
getLabelDescription copied from interface:EnhancedFunctionGet the label for this function- Specified by:
- getLabelin interface- EnhancedFunction
- Overrides:
- getLabelin class- CreateContentFunction
- Returns:
- the label
 
 
-