public class CreateContentFunction extends AbstractContentWorkflowComponent implements com.opensymphony.workflow.FunctionProvider
Modifier and Type | Field and Description |
---|---|
protected ContentTypeExtensionPoint |
_contentTypeEP
The content types handler
|
protected ContentTypesHelper |
_contentTypeHelper
The content types helper
|
protected ObservationManager |
_observationManager
Observation manager available to subclasses.
|
protected AmetysObjectResolver |
_resolver
Ametys object resolver available to subclasses.
|
static String |
CONTENT_LANGUAGE_KEY
Constant for storing the content language to use into the transient variables map.
|
static String |
CONTENT_MIXINS_KEY
Constant for storing the content mixins to use into the transient variables map.
|
static String |
CONTENT_NAME_KEY
Constant for storing the content name to use into the transient variables map.
|
static String |
CONTENT_TITLE_KEY
Constant for storing the content title to use into the transient variables map.
|
static String |
CONTENT_TITLE_VARIANTS_KEY
Constant for storing the content title variants (for multilingual content only) to use into the transient variables map.
|
static String |
CONTENT_TYPES_KEY
Constant for storing the content types to use into the transient variables map.
|
static String |
PARENT_CONTENT_ID_KEY
Constant for storing the parent content to use into the transient variables map.
|
static String |
PARENT_CONTENT_METADATA_PATH_KEY
Constant for storing the parent content metadata path to use into the transient variables map.
|
_contentHelper, CONTENT_KEY
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY
Constructor and Description |
---|
CreateContentFunction() |
Modifier and Type | Method and Description |
---|---|
protected ModifiableWorkflowAwareContent |
_createContent(Map transientVars,
String desiredContentName,
ModifiableTraversableAmetysObject contentsNode)
Create the content object.
|
protected ModifiableTraversableAmetysObject |
_getContentRoot(Map transientVars)
Retrieve the content root.
|
protected String |
_getNonNullVar(Map transientVars,
String name,
String exceptionName)
Get a workflow parameter, throwing an exception if it is null.
|
protected String |
_getObjectType(Map transientVars)
Return the type of the object to be created.
|
protected ModifiableTraversableAmetysObject |
_getSubContentRoot(String parentContentId,
String parentContentMetadataPath)
Get the content root when creating a sub-content.
|
private void |
_initWorkflow(Map transientVars,
ModifiableWorkflowAwareContent content,
Session session,
long workflowId) |
protected boolean |
_isMultilingual(String[] contentTypes)
Determines if the content to create is a multilingual content
|
protected List<Future> |
_notifyContentAdded(Content content,
Map transientVars)
Notify observers that the content has been created
|
protected void |
_populateAdditionalData(Map transientVars,
ModifiableContent content)
Populate the content.
|
protected void |
_populateContent(Map transientVars,
ModifiableContent content)
Populate the content.
|
protected void |
_setTitle(ModifiableContent content,
String[] cTypes,
Map<String,String> titleVariants,
Locale locale)
Set the content's title variants
|
void |
execute(Map transientVars,
Map args,
com.opensymphony.module.propertyset.PropertySet ps) |
protected UserIdentity |
getSystemUser()
Get the user to use when the content is created in a background environment.
|
void |
service(ServiceManager manager) |
getContent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser
public static final String CONTENT_NAME_KEY
public static final String CONTENT_TITLE_KEY
public static final String CONTENT_TITLE_VARIANTS_KEY
public static final String CONTENT_TYPES_KEY
public static final String CONTENT_MIXINS_KEY
public static final String CONTENT_LANGUAGE_KEY
public static final String PARENT_CONTENT_ID_KEY
public static final String PARENT_CONTENT_METADATA_PATH_KEY
protected AmetysObjectResolver _resolver
protected ObservationManager _observationManager
protected ContentTypeExtensionPoint _contentTypeEP
protected ContentTypesHelper _contentTypeHelper
public CreateContentFunction()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class AbstractContentWorkflowComponent
ServiceException
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
execute
in interface com.opensymphony.workflow.FunctionProvider
com.opensymphony.workflow.WorkflowException
private void _initWorkflow(Map transientVars, ModifiableWorkflowAwareContent content, Session session, long workflowId) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
AmetysRepositoryException
com.opensymphony.workflow.WorkflowException
protected void _setTitle(ModifiableContent content, String[] cTypes, Map<String,String> titleVariants, Locale locale) throws AmetysRepositoryException
content
- The contentcTypes
- The content's content typestitleVariants
- The title's variantslocale
- The title's locale. Cannot be null if content is a non-multilingual content.AmetysRepositoryException
- if failed to set titleprotected boolean _isMultilingual(String[] contentTypes)
contentTypes
- The content types of content to createprotected List<Future> _notifyContentAdded(Content content, Map transientVars) throws com.opensymphony.workflow.WorkflowException
content
- The content addedtransientVars
- The workflow varsFuture
objects of the asynchronous observerscom.opensymphony.workflow.WorkflowException
- If an error occurredprotected ModifiableWorkflowAwareContent _createContent(Map transientVars, String desiredContentName, ModifiableTraversableAmetysObject contentsNode)
transientVars
- the workflow parameters.desiredContentName
- the desired content name.contentsNode
- the content root node in the repository.protected String _getObjectType(Map transientVars)
transientVars
- The workflow varsprotected ModifiableTraversableAmetysObject _getContentRoot(Map transientVars) throws com.opensymphony.workflow.WorkflowException
transientVars
- the workflow parameters.com.opensymphony.workflow.WorkflowException
- if an error occursprotected ModifiableTraversableAmetysObject _getSubContentRoot(String parentContentId, String parentContentMetadataPath) throws com.opensymphony.workflow.WorkflowException
parentContentId
- the parent content ID.parentContentMetadataPath
- the path of the metadata in which to create the sub-content.com.opensymphony.workflow.WorkflowException
- if an error occurs.protected String _getNonNullVar(Map transientVars, String name, String exceptionName) throws com.opensymphony.workflow.WorkflowException
transientVars
- the workflow parameters.name
- the variable name.exceptionName
- label of the exception to throw if the variable is null.com.opensymphony.workflow.WorkflowException
- If an error occurredprotected void _populateContent(Map transientVars, ModifiableContent content) throws com.opensymphony.workflow.WorkflowException
transientVars
- the transient variables.content
- the content.com.opensymphony.workflow.WorkflowException
- if an error occurs.protected UserIdentity getSystemUser()
protected void _populateAdditionalData(Map transientVars, ModifiableContent content) throws com.opensymphony.workflow.WorkflowException
transientVars
- the transient variables.content
- the content.com.opensymphony.workflow.WorkflowException
- if an error occurs.