Class 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_VIEW_NAME is used
    • Method Detail

      • execute

        public void execute​(Map transientVars,
                            Map args,
                            com.opensymphony.module.propertyset.PropertySet ps)
                     throws com.opensymphony.workflow.WorkflowException
        Specified by:
        execute in interface com.opensymphony.workflow.FunctionProvider
        Overrides:
        execute in class CreateContentFunction
        Throws:
        com.opensymphony.workflow.WorkflowException
      • processValues

        protected void processValues​(Map transientVars,
                                     ModifiableContent targetContent,
                                     Map<String,​Object> values)
                              throws com.opensymphony.workflow.WorkflowException
        Called after creation and before execution of the EditContentFunction to 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
      • getBaseContentForCopy

        protected Content getBaseContentForCopy​(Map transientVars)
        Get 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
      • getAdditionalCopyMap

        protected Map<String,​ObjectgetAdditionalCopyMap​(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