Class CreateContentFunction

All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider, EnhancedFunction, LogEnabled, Serviceable
Direct Known Subclasses:
AbstractCreateODFContentFunction, CreateContentByCopyFunction, CreateContentFunction, CreateExtractionDescriptionFunction, CreateReferenceTableContentFunction, CreateSynchronizedContentFunction

OSWorkflow function for creating a content.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class AbstractContentWorkflowComponent
      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 interface com.opensymphony.workflow.FunctionProvider
      Throws:
      com.opensymphony.workflow.WorkflowException
    • _initWorkflow

      protected void _initWorkflow(Map transientVars, ModifiableWorkflowAwareContent content, javax.jcr.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
    • _setTitle

      protected void _setTitle(ModifiableContent content, String[] cTypes, Map<String,String> titleVariants, Locale locale) throws AmetysRepositoryException
      Set the content's title variants
      Parameters:
      content - The content
      cTypes - The content's content types
      titleVariants - The title's variants
      locale - The title's locale. Cannot be null if content is a non-multilingual content.
      Throws:
      AmetysRepositoryException - if failed to set title
    • _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
    • _eventParamsForContentAdded

      Gets the event parameters sent in method _notifyContentAdded(Content, Map)
      Parameters:
      content - The content added
      Returns:
      the event parameters
    • _createContent

      protected ModifiableWorkflowAwareContent _createContent(Map transientVars, Map args, String desiredContentName, ModifiableTraversableAmetysObject contentsNode)
      Create the content object.
      Parameters:
      transientVars - the workflow parameters.
      args - The workflow function arguments
      desiredContentName - the desired content name.
      contentsNode - the content root node in the repository.
      Returns:
      the created Content.
    • _getObjectType

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

      Return the mode to compute the name if not unique. Ex: ametys:defaultContent.
      Parameters:
      transientVars - The workflow vars
      args - The workflow function arguments
      Returns:
      The unique name to be used during content creation.
    • _getDefaultNameComputationMode

      Define the default computation mode
      Returns:
      the default computation mode
    • _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
    • _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

      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.
    • getFunctionExecType

      Description copied from interface: EnhancedFunction
      Return the type for the function
      Specified by:
      getFunctionExecType in interface EnhancedFunction
      Returns:
      the type 's code
    • getLabel

      Description copied from interface: EnhancedFunction
      Get the label for this function
      Specified by:
      getLabel in interface EnhancedFunction
      Returns:
      the label