Package com.jalios.jcms
Class Workflow
- java.lang.Object
-
- com.jalios.jcms.Workflow
-
- All Implemented Interfaces:
JcmsConstants
,WorkflowConstants
,JaliosConstants
,java.lang.Comparable
public class Workflow extends java.lang.Object implements WorkflowConstants, JcmsConstants, java.lang.Comparable
This class represents a Workflow.- Since:
- jcms-2.1
- Author:
- Olivier Dedieu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Workflow.WorkflowNameComparator<T extends Workflow>
-
Field Summary
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_DIR, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
Fields inherited from interface com.jalios.jcms.WorkflowConstants
ACTION, ACTION_REPEAT, ACTION_TYPE, ACTION_WHEN, ALL_WF, ARCHIVED_PSTATUS, DEFAULT_DRAFT_PSTATUS, EXPIRED_PSTATUS, PUBLISHED_PSTATUS, ROLE, ROLE_DESCRIPTION, ROLE_GROUP, ROLE_GRPID, ROLE_ID, ROLE_MBRID, ROLE_MEMBER, ROLE_NAME, ROLE_TYPE, ROLE_WEIGHT, SCHEDULED_PSTATUS, STATE, STATE_COLOR, STATE_DESCRIPTION, STATE_DURATION, STATE_LABEL, STATE_PSTATUS, STATE_REMINDER, STATE_TARGETPSTATUS, STATE_TYPE, STATESPE, TRANSITION, TRANSITION_GROUP, TRANSITION_ROLEID, TRANSITION_SOURCE, TRANSITION_TARGET, TRASHED_PSTATUS, UNKNOWN_PSTATUS, WF_ATTACHMENT_ID, WF_BASIC_ID, WF_DEFAULT_ID, WF_DIR, WF_ELT_NAME, WF_ID, WF_INIT, WF_LABEL, WF_MDATE, WF_MODERATION_ID, WF_TYPE, WF_VERSION, WF_VERSION_VALUE, WFTYPE_PROCESS, WFTYPE_PUBLISH
-
-
Constructor Summary
Constructors Constructor Description Workflow(Workflow wf)
Clones a workflow from a given workflow (clone workflow type, states, actions, roles and transitions).Workflow(java.lang.String id, java.lang.String type, java.util.Map<java.lang.String,java.lang.String> labelMap, boolean createInitState)
Creates a new empty workflow with the given label and id.Workflow(java.util.Map<java.lang.String,java.lang.String> labelMap, Workflow wf, boolean clone)
Creates a workflow from a given workflow (clone workflow type, states, actions, roles and transitions).Workflow(org.jdom.Element elt)
Create a workflow from a JDOM Element
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRole(WFRole role)
Adds a WFRole to the workflowvoid
addRole(WFRole role, boolean register)
Adds a WFRole to the workflowvoid
addState(WFState state)
Adds a state in this workflowvoid
addTransition(WFState source, WFState target, WFRole role)
Adds a transition in this workflowboolean
canChangeState(Member member, Publication pub, WFState target)
Checks if a given member can move a given publication in a given state.boolean
canChangeState(Member member, Publication pub, WFState source, WFState target)
Checks if a given member can move from a given state in a given stateboolean
canChangeState(WFRole role, WFState source, WFState target)
Checks if a given role can move from a given state in a given stateboolean
canWorkInState(Publication pub, Member member, WFState state)
Checks if a given member can work in a given stateboolean
canWorkInState(Publication pub, Member member, WFState state, Member newAuthor)
Checks if a given member can work in a given statevoid
cloneStates(Workflow other)
Clones all the states of another workflow in this one.int
compareTo(java.lang.Object obj)
void
convertToProcessWorkflow()
Convert this (publish) workflow to a process workflow.void
convertToPublishWorkflow()
Convert this (process) workflow to a publish workflow.void
deleteRole(WFRole wfRole, Member member)
Deletes the given WFRoleboolean
equals(java.lang.Object obj)
java.lang.String
getId()
java.util.Set<WFTransition>
getIncomingTransitionSet(WFState state)
Returns all the transition the given state is the target.WFState
getInitState()
java.lang.String
getLabel(java.lang.String lang)
Returns a localized label.java.util.Map<java.lang.String,java.lang.String>
getLabelMap()
java.util.Date
getMdate()
java.util.Set<WFState>
getNextStateSet(Publication pub, Member member)
Returns all the states a given member can reach for a given publication.java.util.Set<WFState>
getNextStateSet(Publication pub, Member member, WFState state, Workspace ws)
Returns all the states a given member can reach from a given statePlugin
getPlugin()
Returns the plugin providing this Workflow.WFRole
getRole(java.lang.String roleUid)
Returns a WFRole from its unique id (eg "basic-validators").WFRole
getRoleByRoleId(java.lang.String roleId)
Returns a WFRole from its role id (eg "validators").java.util.Set<WFRole>
getRoleSet()
Gets the role set for this workflowWFState
getState(int pstatus)
Returns the WFState bound to the given pstatusjava.lang.String
getStateLabel(int pstatus, java.lang.String lang)
This convenient returns the label of WFState bound to the given pstatusjava.util.Set<WFState>
getStateSet()
Returns the state set of this workflowjava.util.Set<WFTransition>
getTransitionSet()
java.lang.String
getType()
int
getVersion()
java.util.Set<WFState>
getWorkStateSet(Group group, Workspace workspace)
Returns all the state a group can work in, for given Workspace.java.util.Set<WFState>
getWorkStateSet(Publication pub, Member member)
Returns all the state a member can work in, for all Workspace.java.util.Set<WFState>
getWorkStateSet(Publication pub, Member member, Workspace workspace)
Returns all the state a member can work in, for given Workspace.java.util.Set<WFState>
getWorkStateSet(WFRole role)
Returns all the states bound to a given WFRole.boolean
isActive()
boolean
isEmpty()
Check if the workflow is empty.boolean
isNew()
boolean
isProcessWorkflow()
Returns true if this workflow is a process workflow.boolean
isPublishWorkflow()
Returns true if this workflow is a publish workflow.boolean
isRoleInvolved(WFRole role)
Returns true if the given role is involved in this Workflowboolean
isUpdated()
void
reloadI18N()
Reload all I18N informations for this workflow.void
removeAllTransitions()
Removes all the transition of this workflowvoid
removeState(WFState state)
Removes a state in this workflowvoid
setId(java.lang.String id)
void
setInitState(WFState v)
void
setLabelMap(java.util.Map<java.lang.String,java.lang.String> labelMap)
void
setMdate(java.util.Date mdate)
void
setNew(boolean isNew)
void
setType(java.lang.String type)
void
setUpdated(boolean isUpdated)
void
setVersion(int version)
java.lang.String
toString()
java.lang.String
toXml()
Returns the XML representation for this workflow.java.lang.String
toXml(boolean includeXmlHeader)
-
-
-
Constructor Detail
-
Workflow
public Workflow(java.lang.String id, java.lang.String type, java.util.Map<java.lang.String,java.lang.String> labelMap, boolean createInitState)
Creates a new empty workflow with the given label and id.- Parameters:
labelMap
- localized label mapid
- the id of the workflowtype
- the type of the workflowcreateInitState
- if true creates a new state and uses it as initState- Since:
- jcms-5.5.0
-
Workflow
public Workflow(Workflow wf)
Clones a workflow from a given workflow (clone workflow type, states, actions, roles and transitions). The workflow's id is automaticaly generated.- Parameters:
wf
- the workflow to clone- Since:
- jcms-5.7.0
-
Workflow
public Workflow(java.util.Map<java.lang.String,java.lang.String> labelMap, Workflow wf, boolean clone)
Creates a workflow from a given workflow (clone workflow type, states, actions, roles and transitions). The workflow's id is automaticaly generated.- Parameters:
labelMap
- localized label mapwf
- the workflow to cloneclone
- if true do generate a new id nor new wfrole id- Since:
- jcms-5.5.0
-
Workflow
public Workflow(org.jdom.Element elt)
Create a workflow from a JDOM Element- Parameters:
elt
- the Element- Since:
- jcms-5.7.0
-
-
Method Detail
-
convertToPublishWorkflow
public void convertToPublishWorkflow()
Convert this (process) workflow to a publish workflow.- Since:
- jcms-5.5.0
-
convertToProcessWorkflow
public void convertToProcessWorkflow()
Convert this (publish) workflow to a process workflow.- Since:
- jcms-5.5.0
-
reloadI18N
public void reloadI18N()
Reload all I18N informations for this workflow. This includes : label, states label & description, roles label and description- Since:
- jcms-8.0.2
-
getLabel
public java.lang.String getLabel(java.lang.String lang)
Returns a localized label.- Parameters:
lang
- the language- Returns:
- a localized label.
- Since:
- jcms-5.7.0
-
toXml
public java.lang.String toXml()
Returns the XML representation for this workflow.- Returns:
- the XML representation for this workflow.
- Since:
- jcms-5.7.0
-
toXml
public java.lang.String toXml(boolean includeXmlHeader)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isEmpty
public boolean isEmpty()
Check if the workflow is empty. A workflow is empty if it contains none transition.- Returns:
- true if workflow is empty, false otherwise
- Since:
- jcms-2.1
-
isPublishWorkflow
public boolean isPublishWorkflow()
Returns true if this workflow is a publish workflow.- Returns:
- true if this workflow is a publish workflow.
- Since:
- jcms-5.5.0
-
isProcessWorkflow
public boolean isProcessWorkflow()
Returns true if this workflow is a process workflow.- Returns:
- true if this workflow is a process workflow.
- Since:
- jcms-5.5.0
-
isRoleInvolved
public boolean isRoleInvolved(WFRole role)
Returns true if the given role is involved in this Workflow- Parameters:
role
- the tested Role- Returns:
- true if the given role is involved in this Workflow
- Since:
- JCMS 4.0.2
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getId
public java.lang.String getId()
-
setId
public void setId(java.lang.String id)
-
getLabelMap
public java.util.Map<java.lang.String,java.lang.String> getLabelMap()
-
setLabelMap
public void setLabelMap(java.util.Map<java.lang.String,java.lang.String> labelMap)
-
getType
public java.lang.String getType()
-
setType
public void setType(java.lang.String type)
-
getInitState
public WFState getInitState()
-
setInitState
public void setInitState(WFState v)
-
getVersion
public int getVersion()
-
setVersion
public void setVersion(int version)
-
getMdate
public java.util.Date getMdate()
- Returns:
- the last modification date of this workflow
- Since:
- jcms-10.0.7
-
setMdate
public void setMdate(java.util.Date mdate)
- Parameters:
mdate
- the last modification date of this workflow.- Since:
- jcms-10.0.7
-
getTransitionSet
public java.util.Set<WFTransition> getTransitionSet()
-
getStateSet
public java.util.Set<WFState> getStateSet()
Returns the state set of this workflow- Returns:
- the state set of this workflow.
- Since:
- jcms-2.1
-
getState
public WFState getState(int pstatus)
Returns the WFState bound to the given pstatus- Parameters:
pstatus
- the pstatus of the searched WFState- Returns:
- a WFState
- Since:
- jcms-2.1
-
getStateLabel
public java.lang.String getStateLabel(int pstatus, java.lang.String lang)
This convenient returns the label of WFState bound to the given pstatus- Parameters:
pstatus
- the pstatus of the searched WFStatelang
- the language code in which to retrieve the label- Returns:
- the String of the lable of the WFState bound to the current pstatus or "???" if unknown state.
- Since:
- jcms-4.0
-
getWorkStateSet
public java.util.Set<WFState> getWorkStateSet(Publication pub, Member member)
Returns all the state a member can work in, for all Workspace.- Parameters:
pub
- the publication to work onmember
- the member- Returns:
- a set of WFState
- Since:
- jcms-2.1
-
getWorkStateSet
public java.util.Set<WFState> getWorkStateSet(Publication pub, Member member, Workspace workspace)
Returns all the state a member can work in, for given Workspace.- Parameters:
pub
- the publication to work onmember
- the memberworkspace
- the Workspace in which to retrieve state- Returns:
- a set of WFState
-
getWorkStateSet
public java.util.Set<WFState> getWorkStateSet(Group group, Workspace workspace)
Returns all the state a group can work in, for given Workspace.- Parameters:
group
- the groupworkspace
- the Workspace in which to retrieve state- Returns:
- a set of WFState
-
getWorkStateSet
public java.util.Set<WFState> getWorkStateSet(WFRole role)
Returns all the states bound to a given WFRole.- Parameters:
role
- the role- Returns:
- all the state bound to a given WFRole.
-
canWorkInState
public boolean canWorkInState(Publication pub, Member member, WFState state)
Checks if a given member can work in a given state- Parameters:
pub
- the publication to work onmember
- the memberstate
- the state- Returns:
- true if this member can work in this state (always true if state is the init state or member is admin).
- Since:
- jcms-2.1
-
canWorkInState
public boolean canWorkInState(Publication pub, Member member, WFState state, Member newAuthor)
Checks if a given member can work in a given state- Parameters:
pub
- the publication to work onmember
- the memberstate
- the statenewAuthor
- member used as author to execute the check (can be null, in this case original author is kept). This parameter is used to check rights before creating a copy of a publication with a different author.- Returns:
- true if this member can work in this state (always true if state is the init state or member is admin).
- Since:
- jcms-9.0.4
-
canChangeState
public boolean canChangeState(WFRole role, WFState source, WFState target)
Checks if a given role can move from a given state in a given state- Parameters:
role
- the rolesource
- the source statetarget
- the target state- Returns:
- true if the change can be performed
- Since:
- jcms-4.0.2
-
canChangeState
public boolean canChangeState(Member member, Publication pub, WFState target)
Checks if a given member can move a given publication in a given state. If the publication is null, check from the init state.- Parameters:
member
- the memberpub
- the publicationtarget
- the target state- Returns:
- true if the change can be performed
- Since:
- jcms-2.1
-
canChangeState
public boolean canChangeState(Member member, Publication pub, WFState source, WFState target)
Checks if a given member can move from a given state in a given state- Parameters:
member
- the memberpub
- the publicationsource
- the source statetarget
- the target state- Returns:
- true if the change can be performed
- Since:
- jcms-2.1
-
getNextStateSet
public java.util.Set<WFState> getNextStateSet(Publication pub, Member member)
Returns all the states a given member can reach for a given publication. If the publication is null, return all the states reachable from the init state.- Parameters:
pub
- the publicationmember
- the member- Returns:
- a set of WFState
- Since:
- jcms-2.1
-
getNextStateSet
public java.util.Set<WFState> getNextStateSet(Publication pub, Member member, WFState state, Workspace ws)
Returns all the states a given member can reach from a given state- Parameters:
pub
- the publication to work onmember
- the memberstate
- the source statews
- the current workspace- Returns:
- a set of WFState
- Since:
- jcms-2.1
-
addState
public void addState(WFState state)
Adds a state in this workflow- Parameters:
state
- the state to add- Since:
- jcms-2.1
-
removeState
public void removeState(WFState state)
Removes a state in this workflow- Parameters:
state
- the state to remove- Since:
- jcms-2.1
-
addTransition
public void addTransition(WFState source, WFState target, WFRole role)
Adds a transition in this workflow- Parameters:
source
- the source statetarget
- the target staterole
- the role- Since:
- jcms-2.1
-
removeAllTransitions
public void removeAllTransitions()
Removes all the transition of this workflow- Since:
- jcms-2.1
-
getIncomingTransitionSet
public java.util.Set<WFTransition> getIncomingTransitionSet(WFState state)
Returns all the transition the given state is the target.- Parameters:
state
- the state- Returns:
- an (never null) set of WFTransition
- Since:
- jcms-2.1
-
cloneStates
public void cloneStates(Workflow other)
Clones all the states of another workflow in this one. Clones are created with WFState.clone() method (i.e. only label and pstatus are cloned).- Parameters:
other
- the other workflow to clone the state- Since:
- jcms-2.1
-
getRole
public WFRole getRole(java.lang.String roleUid)
Returns a WFRole from its unique id (eg "basic-validators").- Parameters:
roleUid
- the role unique id- Returns:
- the WFRole bound to the given unique id or null if it doesn't exist
- Since:
- jcms-4.0.2
-
getRoleByRoleId
public WFRole getRoleByRoleId(java.lang.String roleId)
Returns a WFRole from its role id (eg "validators").- Parameters:
roleId
- the role id- Returns:
- the WFRole bound to the given id or null if it doesn't exist
- Since:
- jcms-4.0.2
-
getRoleSet
public java.util.Set<WFRole> getRoleSet()
Gets the role set for this workflow- Returns:
- the role set for this workflow
-
addRole
public void addRole(WFRole role)
Adds a WFRole to the workflow- Parameters:
role
- the role to be added- Since:
- jcms-4.0.2
-
addRole
public void addRole(WFRole role, boolean register)
Adds a WFRole to the workflow- Parameters:
role
- the role to be addedregister
- should register role to channel- Since:
- jcms-5.5.0
-
deleteRole
public void deleteRole(WFRole wfRole, Member member)
Deletes the given WFRole- Parameters:
wfRole
- the WFRole to be deletedmember
- the member which perform this action- Since:
- jcms-4.0.2
-
isNew
public boolean isNew()
- Returns:
- Returns the isNew.
- Since:
- jcms-5.5.0
-
setNew
public void setNew(boolean isNew)
- Parameters:
isNew
- The isNew to set.- Since:
- jcms-5.5.0
-
isUpdated
public boolean isUpdated()
- Returns:
- Returns the isUpdated.
- Since:
- jcms-5.5.0
-
setUpdated
public void setUpdated(boolean isUpdated)
- Parameters:
isUpdated
- The isUpdated to set.- Since:
- jcms-5.5.0
-
getPlugin
public Plugin getPlugin()
Returns the plugin providing this Workflow.- Returns:
- the plugin providing this Workflow.
- Since:
- jcms-10.0.0
-
isActive
public boolean isActive()
-
-