Package com.jalios.jcms
Class Workflow
java.lang.Object
com.jalios.jcms.Workflow
- All Implemented Interfaces:
JcmsConstants,WorkflowConstants,JaliosConstants,Comparable
This class represents a Workflow.
- Since:
- jcms-2.1
- Author:
- Olivier Dedieu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWorkflow.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_YEARFields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, 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, GENERATIONAL_STORE_DIRECTORY, 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, PHOTO_XLARGE, PHOTO_XLARGE_HEIGHT, PHOTO_XLARGE_PROP_PREFIX, PHOTO_XLARGE_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_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, SVGSPRITE_ICON_PREFIX, TEMPLATE_TAB, THEME_DIR, 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, TYPES_UNKNOWN_CLASS_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_XMLFields inherited from interface com.jalios.jcms.WorkflowConstants
ACTION, ACTION_REPEAT, ACTION_TYPE, ACTION_WHEN, ALL_WF, ARCHIVED_PSTATUS, DEFAULT_DRAFT_PSTATUS, EXPIRED_PSTATUS, INHERIT_WORKFLOW, 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
ConstructorsConstructorDescriptionClones a workflow from a given workflow (clone workflow type, states, actions, roles and transitions).Creates a new empty workflow with the given label and id.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
Modifier and TypeMethodDescriptionvoidAdds a WFRole to the workflowvoidAdds a WFRole to the workflowvoidAdds a state in this workflowvoidaddTransition(WFState source, WFState target, WFRole role) Adds a transition in this workflowbooleancanChangeState(Member member, Publication pub, WFState target) Checks if a given member can move a given publication in a given state.booleancanChangeState(Member member, Publication pub, WFState source, WFState target) Checks if a given member can move from a given state in a given statebooleancanChangeState(WFRole role, WFState source, WFState target) Checks if a given role can move from a given state in a given statebooleancanWorkInState(Publication pub, Member member, WFState state) Checks if a given member can work in a given statebooleancanWorkInState(Publication pub, Member member, WFState state, Member newAuthor) Checks if a given member can work in a given statevoidcloneStates(Workflow other) Clones all the states of another workflow in this one.intvoidConvert this (publish) workflow to a process workflow.voidConvert this (process) workflow to a publish workflow.voiddeleteRole(WFRole wfRole, Member member) Deletes the given WFRolebooleangetId()getIncomingTransitionSet(WFState state) Returns all the transition the given state is the target.Returns a localized label.getMdate()getNextStateSet(Publication pub, Member member) Returns all the states a given member can reach for a given publication.getNextStateSet(Publication pub, Member member, WFState state, Workspace ws) Returns all the states a given member can reach from a given stateReturns the plugin providing this Workflow.Returns a WFRole from its unique id (eg "basic-validators").getRoleByRoleId(String roleId) Returns a WFRole from its role id (eg "validators").Gets the role set for this workflowgetState(int pstatus) Returns the WFState bound to the given pstatusgetStateLabel(int pstatus, String lang) This convenient returns the label of WFState bound to the given pstatusReturns the state set of this workflowgetType()intgetWorkStateSet(Group group, Workspace workspace) Returns all the state a group can work in, for given Workspace.getWorkStateSet(Publication pub, Member member) Returns all the state a member can work in, for all Workspace.getWorkStateSet(Publication pub, Member member, Workspace workspace) Returns all the state a member can work in, for given Workspace.getWorkStateSet(WFRole role) Returns all the states bound to a given WFRole.booleanisActive()booleanisEmpty()Check if the workflow is empty.booleanisNew()booleanReturns true if this workflow is a process workflow.booleanReturns true if this workflow is a publish workflow.booleanisRoleInvolved(WFRole role) Returns true if the given role is involved in this WorkflowbooleanvoidReload all I18N informations for this workflow.voidRemoves all the transition of this workflowvoidremoveState(WFState state) Removes a state in this workflowvoidvoidvoidsetLabelMap(Map<String, String> labelMap) voidvoidsetNew(boolean isNew) voidvoidsetUpdated(boolean isUpdated) voidsetVersion(int version) toString()toXml()Returns the XML representation for this workflow.toXml(boolean includeXmlHeader)
-
Constructor Details
-
Workflow
Creates a new empty workflow with the given label and id.- Parameters:
id- the id of the workflowtype- the type of the workflowlabelMap- localized label mapcreateInitState- if true creates a new state and uses it as initState- Since:
- jcms-5.5.0
-
Workflow
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
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 Details
-
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
Returns a localized label.- Parameters:
lang- the language- Returns:
- a localized label.
- Since:
- jcms-5.7.0
-
toXml
Returns the XML representation for this workflow.- Returns:
- the XML representation for this workflow.
- Since:
- jcms-5.7.0
-
toXml
-
toString
-
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
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
- Specified by:
compareToin interfaceComparable
-
equals
-
getId
-
setId
-
getLabelMap
-
setLabelMap
-
getType
-
setType
-
getInitState
-
setInitState
-
getVersion
public int getVersion() -
setVersion
public void setVersion(int version) -
getMdate
- Returns:
- the last modification date of this workflow
- Since:
- jcms-10.0.7
-
setMdate
- Parameters:
mdate- the last modification date of this workflow.- Since:
- jcms-10.0.7
-
getTransitionSet
-
getStateSet
Returns the state set of this workflow- Returns:
- the state set of this workflow.
- Since:
- jcms-2.1
-
getState
Returns the WFState bound to the given pstatus- Parameters:
pstatus- the pstatus of the searched WFState- Returns:
- a WFState
- Since:
- jcms-2.1
-
getStateLabel
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
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
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
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
Returns all the states bound to a given WFRole.- Parameters:
role- the role- Returns:
- all the state bound to a given WFRole.
-
canWorkInState
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
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
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
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
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
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
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
Adds a state in this workflow- Parameters:
state- the state to add- Since:
- jcms-2.1
-
removeState
Removes a state in this workflow- Parameters:
state- the state to remove- Since:
- jcms-2.1
-
addTransition
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
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
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
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
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
Gets the role set for this workflow- Returns:
- the role set for this workflow
-
addRole
Adds a WFRole to the workflow- Parameters:
role- the role to be added- Since:
- jcms-4.0.2
-
addRole
Adds a WFRole to the workflow- Parameters:
role- the role to be addedregister- should register role to channel- Since:
- jcms-5.5.0
-
deleteRole
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
Returns the plugin providing this Workflow.- Returns:
- the plugin providing this Workflow.
- Since:
- jcms-10.0.0
-
isActive
public boolean isActive()
-