public class ContentWorkflowHelper extends AbstractLogEnabled implements Serviceable, Contextualizable, Component
Modifier and Type | Field and Description |
---|---|
private Context |
_context |
protected CurrentUserProvider |
_userProvider
Component to get the current user
|
protected WorkflowProvider |
_workflowProvider
Workflow instance.
|
static String |
ROLE
The component role
|
Constructor and Description |
---|
ContentWorkflowHelper() |
Modifier and Type | Method and Description |
---|---|
private UserIdentity |
_getUser() |
void |
contextualize(Context context) |
Map<String,Object> |
createContent(String workflowName,
int initialActionId,
String contentName,
String contentTitle,
String[] contentTypes,
String[] mixins,
String languageCode)
Creates a content using the workflow (with the CreateContentFunction).
|
Map<String,Object> |
createContent(String workflowName,
int initialActionId,
String contentName,
String contentTitle,
String[] contentTypes,
String[] mixins,
String languageCode,
String parentContentId,
String parentContentMetadatapath)
Creates a content using the workflow (with the CreateContentFunction).
|
Map<String,Object> |
createContent(String workflowName,
int initialActionId,
String contentName,
String contentTitle,
String[] contentTypes,
String[] mixins,
String languageCode,
String parentContentId,
String parentContentMetadatapath,
Map<String,Object> inputs)
Creates a content using the workflow (with the CreateContentFunction).
|
Map<String,Object> |
doAction(WorkflowAwareContent content,
int actionId)
Do a workflow action on a content.
|
Map<String,Object> |
doAction(WorkflowAwareContent content,
int actionId,
Map<String,Object> inputs)
Do a workflow action on a content.
|
int[] |
getAvailableActions(WorkflowAwareContent content)
Get the available workflow actions for the content
|
int[] |
getAvailableActions(WorkflowAwareContent content,
Map<String,Object> inputs)
Get the available workflow actions for the content
|
void |
service(ServiceManager manager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected CurrentUserProvider _userProvider
protected WorkflowProvider _workflowProvider
public ContentWorkflowHelper()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public Map<String,Object> createContent(String workflowName, int initialActionId, String contentName, String contentTitle, String[] contentTypes, String[] mixins, String languageCode) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
workflowName
- The name of the workflow to createinitialActionId
- The workflow action id that creates contentcontentName
- The new namecontentTitle
- The new titlecontentTypes
- The new content types. Cannot be null. Cannot be empty.mixins
- The new mixins. Can be null. Can be empty.languageCode
- The language code of the new content (such as 'fr', 'en'...)com.opensymphony.workflow.WorkflowException
- If an error occurred while doing the action on the workflowAmetysRepositoryException
- If cannot get the workflow identifier of the contentpublic Map<String,Object> createContent(String workflowName, int initialActionId, String contentName, String contentTitle, String[] contentTypes, String[] mixins, String languageCode, String parentContentId, String parentContentMetadatapath) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
workflowName
- The name of the workflow to createinitialActionId
- The workflow action id that creates contentcontentName
- The new namecontentTitle
- The new titlecontentTypes
- The new content types. Cannot be null. Cannot be empty.mixins
- The new mixins. Can be null. Can be empty.languageCode
- The language code of the new content (such as 'fr', 'en'...)parentContentId
- If the new content is a subcontent, the parent content identifier.parentContentMetadatapath
- If the new content is a subcontent, the path of the metadata where the new content will take place in its parentcom.opensymphony.workflow.WorkflowException
- If an error occurred while doing the action on the workflowAmetysRepositoryException
- If cannot get the workflow identifier of the contentpublic Map<String,Object> createContent(String workflowName, int initialActionId, String contentName, String contentTitle, String[] contentTypes, String[] mixins, String languageCode, String parentContentId, String parentContentMetadatapath, Map<String,Object> inputs) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
workflowName
- The name of the workflow to createinitialActionId
- The workflow action id that creates contentcontentName
- The new namecontentTitle
- The new titlecontentTypes
- The new content types. Cannot be null. Cannot be empty.mixins
- The new mixins. Can be null. Can be empty.languageCode
- The language code of the new content (such as 'fr', 'en'...)parentContentId
- If the new content is a subcontent, the parent content identifier.parentContentMetadatapath
- If the new content is a subcontent, the path of the metadata where the new content will take place in its parentinputs
- The parameters to transmit to the workflow functions. Cannot be null.com.opensymphony.workflow.WorkflowException
- If an error occurred while doing the action on the workflowAmetysRepositoryException
- If cannot get the workflow identifier of the contentpublic int[] getAvailableActions(WorkflowAwareContent content)
content
- The content to consider. Cannot be null.public int[] getAvailableActions(WorkflowAwareContent content, Map<String,Object> inputs)
content
- The content to consider. Cannot be null.inputs
- The parameters to transmit to the workflow functions. Cannot be null.public Map<String,Object> doAction(WorkflowAwareContent content, int actionId) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
content
- The content to act on. Cannot be null.actionId
- The id of the workflow action to docom.opensymphony.workflow.WorkflowException
- If an error occurred while doing the action on the workflowAmetysRepositoryException
- If cannot get the workflow identifier of the contentpublic Map<String,Object> doAction(WorkflowAwareContent content, int actionId, Map<String,Object> inputs) throws AmetysRepositoryException, com.opensymphony.workflow.WorkflowException
content
- The content to act on. Cannot be null.actionId
- The id of the workflow action to doinputs
- The parameters to transmit to the workflow functions. Cannot be null. The special key AbstractWorkflowComponent.CONTEXT_PARAMETERS_KEY will be filled with the parent context if null (this means that if your are in a request dispatched, you will automatically get the js parameters).com.opensymphony.workflow.WorkflowException
- If an error occurred while doing the action on the workflowAmetysRepositoryException
- If cannot get the workflow identifier of the contentprivate UserIdentity _getUser()