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
,LogEnabled
,Serviceable
- Direct Known Subclasses:
AbstractCreateODFContentByCopyFunction
,CreateContentByCopyFunction
public class CreateContentByCopyFunction extends CreateContentFunction
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_METADATASET_NAME is used
-
-
Field Summary
Fields Modifier and Type Field Description protected CopyContentMetadataComponent
_copyContentMetadataHelper
The metadata copy componentprotected ContentTypesHelper
_cTypesHelper
The content type helperprotected I18nUtils
_i18nUtils
I18n Utilsstatic String
BASE_CONTENT_ID
Constant for storing the id of base content used for the duplication into the transient variables map.static String
BASE_CONTENT_KEY
Constant for storing the base content used for the duplication into the transient variables map.static String
COPY_FALLBACK_METADATASET_NAME
Constant for storing the name of fallback metadata set to use for copy.static String
COPY_MAP_KEY
Constant for storing the map containing the duplication info into the transient variables map.static String
COPY_METADATASET_NAME
Constant for storing the name of metadata set to use for copy.static String
COPY_METADATASET_TYPE
Constant for storing the type of metadata set to use for copy.static String
COPY_REPORT_KEY
Constant for storing the copy report object into the transient variables map.-
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, PARENT_CONTENT_ID_KEY, PARENT_CONTENT_METADATA_PATH_KEY
-
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 CreateContentByCopyFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
_buildCopyMap(Map transientVars, Content baseContent, String metadataSetName, String fallbackMetadataSetName, String metadataSetType)
Get the builded copy mapprotected void
_populateAdditionalData(Map transientVars, ModifiableContent content)
Populate the content.void
execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps)
protected Content
getBaseContentForCopy(Map transientVars)
Get the contentvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.cms.workflow.CreateContentFunction
_createContent, _eventParamsForContentAdded, _getContentRoot, _getNonNullVar, _getObjectType, _getSubContentRoot, _initWorkflow, _isMultilingual, _notifyContentAdded, _populateContent, _setTitle, getSystemUser
-
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
-
BASE_CONTENT_KEY
public static final String BASE_CONTENT_KEY
Constant for storing the base content used for the duplication into the transient variables map.
-
BASE_CONTENT_ID
public static final String BASE_CONTENT_ID
Constant for storing the id of base content used for the duplication into the transient variables map.
-
COPY_MAP_KEY
public static final String COPY_MAP_KEY
Constant for storing the map containing the duplication info into the transient variables map. Can be null.
-
COPY_REPORT_KEY
public static final String COPY_REPORT_KEY
Constant for storing the copy report object into the transient variables map. Can be null.
-
COPY_METADATASET_NAME
public static final String COPY_METADATASET_NAME
Constant for storing the name of metadata set to use for copy.
-
COPY_FALLBACK_METADATASET_NAME
public static final String COPY_FALLBACK_METADATASET_NAME
Constant for storing the name of fallback metadata set to use for copy.
-
COPY_METADATASET_TYPE
public static final String COPY_METADATASET_TYPE
Constant for storing the type of metadata set to use for copy.
-
_copyContentMetadataHelper
protected CopyContentMetadataComponent _copyContentMetadataHelper
The metadata copy component
-
_cTypesHelper
protected ContentTypesHelper _cTypesHelper
The content type helper
-
_i18nUtils
protected I18nUtils _i18nUtils
I18n Utils
-
-
Constructor Detail
-
CreateContentByCopyFunction
public CreateContentByCopyFunction()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classCreateContentFunction
- Throws:
ServiceException
-
execute
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
- Specified by:
execute
in interfacecom.opensymphony.workflow.FunctionProvider
- Overrides:
execute
in classCreateContentFunction
- Throws:
com.opensymphony.workflow.WorkflowException
-
getBaseContentForCopy
protected Content getBaseContentForCopy(Map transientVars)
Get the content- Parameters:
transientVars
- The workflow transiant 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
-
_populateAdditionalData
protected void _populateAdditionalData(Map transientVars, ModifiableContent content) throws com.opensymphony.workflow.WorkflowException
Description copied from class:CreateContentFunction
Populate the content.- Overrides:
_populateAdditionalData
in classCreateContentFunction
- Parameters:
transientVars
- the transient variables.content
- the content.- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurs.
-
_buildCopyMap
protected Map<String,Object> _buildCopyMap(Map transientVars, Content baseContent, String metadataSetName, String fallbackMetadataSetName, String metadataSetType)
Get the builded copy map- Parameters:
transientVars
- the varsbaseContent
- the base content to be copiedmetadataSetName
- the metadata set namefallbackMetadataSetName
- the fallbacl metadata set name, if required metadata set does not existmetadataSetType
- the metadata set type- Returns:
- the builded copy map
-
-