Class CreateContentFunction

    • 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
        Throws:
        com.opensymphony.workflow.WorkflowException
      • _initWorkflow

        protected void _initWorkflow​(Map transientVars,
                                     ModifiableWorkflowAwareContent content,
                                     Session session,
                                     long workflowId)
                              throws AmetysRepositoryException,
                                     com.opensymphony.workflow.WorkflowException
        Initialize the workflow of the added content.
        Parameters:
        transientVars - The workflow vars
        content - The added content
        session - The session
        workflowId - The workflow ID
        Throws:
        AmetysRepositoryException - if a repository error occured
        com.opensymphony.workflow.WorkflowException - if a workflow error occured
      • _isMultilingual

        protected boolean _isMultilingual​(String[] contentTypes)
        Determines if the content to create is a multilingual content
        Parameters:
        contentTypes - The content types of content to create
        Returns:
        true if multilingual
      • _notifyContentAdded

        protected List<Future_notifyContentAdded​(Content content,
                                                   Map transientVars)
                                            throws com.opensymphony.workflow.WorkflowException
        Notify observers that the content has been created
        Parameters:
        content - The content added
        transientVars - The workflow vars
        Returns:
        The Future objects of the asynchronous observers
        Throws:
        com.opensymphony.workflow.WorkflowException - If an error occurred
      • _getObjectType

        protected String _getObjectType​(Map transientVars)
        Return the type of the object to be created. Ex: ametys:defaultContent.
        Parameters:
        transientVars - The workflow vars
        Returns:
        The type of the object to be used during content creation.
      • _getContentRoot

        protected ModifiableTraversableAmetysObject _getContentRoot​(Map transientVars)
                                                             throws com.opensymphony.workflow.WorkflowException
        Retrieve the content root.
        Parameters:
        transientVars - the workflow parameters.
        Returns:
        the content root node.
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs
      • _getSubContentRoot

        protected ModifiableTraversableAmetysObject _getSubContentRoot​(String parentContentId,
                                                                       String parentContentMetadataPath)
                                                                throws com.opensymphony.workflow.WorkflowException
        Get the content root when creating a sub-content.
        Parameters:
        parentContentId - the parent content ID.
        parentContentMetadataPath - the path of the metadata in which to create the sub-content.
        Returns:
        the content collection metadata.
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs.
      • _getNonNullVar

        protected String _getNonNullVar​(Map transientVars,
                                        String name,
                                        String exceptionName)
                                 throws com.opensymphony.workflow.WorkflowException
        Get a workflow parameter, throwing an exception if it is null.
        Parameters:
        transientVars - the workflow parameters.
        name - the variable name.
        exceptionName - label of the exception to throw if the variable is null.
        Returns:
        the variable value.
        Throws:
        com.opensymphony.workflow.WorkflowException - If an error occurred
      • _populateContent

        protected void _populateContent​(Map transientVars,
                                        ModifiableContent content)
                                 throws com.opensymphony.workflow.WorkflowException
        Populate the content.
        Parameters:
        transientVars - the transient variables.
        content - the content.
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs.
      • getSystemUser

        protected UserIdentity getSystemUser()
        Get the user to use when the content is created in a background environment.
        Returns:
        The anonymous user
      • _populateAdditionalData

        protected void _populateAdditionalData​(Map transientVars,
                                               ModifiableContent content)
                                        throws com.opensymphony.workflow.WorkflowException
        Populate the content.
        Parameters:
        transientVars - the transient variables.
        content - the content.
        Throws:
        com.opensymphony.workflow.WorkflowException - if an error occurs.