com.jalios.jcms
Class Workflow

java.lang.Object
  extended by com.jalios.jcms.Workflow
All Implemented Interfaces:
JcmsConstants, WorkflowConstants, JaliosConstants, Comparable

public class Workflow
extends Object
implements WorkflowConstants, JcmsConstants, Comparable

This class represents a Workflow.

Since:
jcms-2.1
Version:
$Revision: 40027 $
Author:
Olivier Dedieu

Field Summary
static int DOCUMENT_DRAFT_PSTATUS
           
static String REVISION
           
 
Fields inherited from interface com.jalios.jcms.WorkflowConstants
ACTION, ACTION_REPEAT, ACTION_TYPE, ACTION_WHEN, ALL_WF, ARCHIVED_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_DESCRIPTION, STATE_DURATION, STATE_LABEL, STATE_PSTATUS, STATE_REMINDER, STATE_TARGETPSTATUS, STATE_TYPE, STATESPE, TRANSITION, TRANSITION_GROUP, TRANSITION_ROLEID, TRANSITION_SOURCE, TRANSITION_TARGET, UNKNOWN_PSTATUS, WF_DEFAULT_ID, WF_DIR, WF_ELT_NAME, WF_ID, WF_INIT, WF_LABEL, WF_TYPE, WF_VERSION, WF_VERSION_VALUE, WFTYPE_PROCESS, WFTYPE_PUBLISH
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
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
 
Constructor Summary
Workflow(org.jdom.Element elt)
          Create a workflow from a JDOM Element
Workflow(Map<String,String> labelMap, Workflow wf, boolean clone)
          Creates a workflow from a given workflow (clone workflow type, states, actions, roles and transitions).
Workflow(String id, String type, Map<String,String> labelMap, boolean createInitState)
          Creates a new empty workflow with the given label and id.
Workflow(Workflow wf)
          Clones a workflow from a given workflow (clone workflow type, states, actions, roles and transitions).
 
Method Summary
 void addRole(WFRole role)
          Adds a WFRole to the workflow
 void addRole(WFRole role, boolean register)
          Adds a WFRole to the workflow
 void addState(WFState state)
          Adds a state in this workflow
 void addTransition(WFState source, WFState target, WFRole role)
          Adds a transition in this workflow
 boolean 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 state
 boolean canChangeState(WFRole role, WFState source, WFState target)
          Checks if a given role can move from a given state in a given state
 boolean canWorkInState(Publication pub, Member member, WFState state)
          Checks if a given member can work in a given state
 void cloneStates(Workflow other)
          Clones all the states of another workflow in this one.
 int compareTo(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 WFRole
 boolean equals(Object obj)
           
 String getId()
           
 Set<WFTransition> getIncomingTransitionSet(WFState state)
          Returns all the transition the given state is the target.
 WFState getInitState()
           
 String getLabel(String lang)
          Returns a localized label.
 Map<String,String> getLabelMap()
           
 Set<WFState> getNextStateSet(Publication pub, Member member)
          Returns all the states a given member can reach for a given publication.
 Set<WFState> getNextStateSet(Publication pub, Member member, WFState state, Workspace ws)
          Returns all the states a given member can reach from a given state
 WFRole getRole(String roleId)
          Returns a WFRole from its id.
 Set<WFRole> getRoleSet()
          Gets the role set for this workflow
 WFState getState(int pstatus)
          Returns the WFState bound to the given pstatus
 String getStateLabel(int pstatus, String lang)
          This convenient returns the label of WFState bound to the given pstatus
 Set<WFState> getStateSet()
          Returns the state set of this workflow
 Set<WFTransition> getTransitionSet()
           
 String getType()
           
 Set<WFState> getWorkStateSet(Group group, Workspace workspace)
          Returns all the state a group can work in, for given Workspace.
 Set<WFState> getWorkStateSet(Publication pub, Member member)
          Returns all the state a member can work in, for all Workspace.
 Set<WFState> getWorkStateSet(Publication pub, Member member, Workspace workspace)
          Returns all the state a member can work in, for given Workspace.
 Set<WFState> getWorkStateSet(WFRole role)
          Returns all the states bound to a given WFRole.
 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 Workflow
 boolean isUpdated()
           
 void removeAllTransitions()
          Removes all the transition of this workflow
 void removeState(WFState state)
          Removes a state in this workflow
 void setId(String id)
           
 void setInitState(WFState v)
           
 void setLabelMap(Map<String,String> labelMap)
           
 void setNew(boolean isNew)
           
 void setType(String type)
           
 void setUpdated(boolean isUpdated)
           
 String toString()
           
 String toXml()
          Returns the XML representation for this workflow.
 String toXml(boolean includeXmlHeader)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DOCUMENT_DRAFT_PSTATUS

public static final int DOCUMENT_DRAFT_PSTATUS
See Also:
Constant Field Values

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

Workflow

public Workflow(String id,
                String type,
                Map<String,String> labelMap,
                boolean createInitState)
Creates a new empty workflow with the given label and id.

Parameters:
labelMap - localized label map
id - the id of the workflow
type - the type of the workflow
createInitState - 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(Map<String,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 map
wf - the workflow to clone
clone - 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

getLabel

public String getLabel(String lang)
Returns a localized label.

Parameters:
lang - the language
Returns:
a localized label.
Since:
jcms-5.7.0

toXml

public String toXml()
Returns the XML representation for this workflow.

Returns:
the XML representation for this workflow.
Since:
jcms-5.7.0

toXml

public String toXml(boolean includeXmlHeader)

toString

public String toString()
Overrides:
toString in class 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(Object obj)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getId

public String getId()

setId

public void setId(String id)

getLabelMap

public Map<String,String> getLabelMap()

setLabelMap

public void setLabelMap(Map<String,String> labelMap)

getType

public String getType()

setType

public void setType(String type)

getInitState

public WFState getInitState()

setInitState

public void setInitState(WFState v)

getTransitionSet

public Set<WFTransition> getTransitionSet()

getStateSet

public 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 String getStateLabel(int pstatus,
                            String lang)
This convenient returns the label of WFState bound to the given pstatus

Parameters:
pstatus - the pstatus of the searched WFState
lang - 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 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 on
member - the member
Returns:
a set of WFState
Since:
jcms-2.1

getWorkStateSet

public 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 on
member - the member
workspace - the Workspace in which to retrieve state
Returns:
a set of WFState

getWorkStateSet

public Set<WFState> getWorkStateSet(Group group,
                                    Workspace workspace)
Returns all the state a group can work in, for given Workspace.

Parameters:
group - the group
workspace - the Workspace in which to retrieve state
Returns:
a set of WFState

getWorkStateSet

public Set<WFState> getWorkStateSet(WFRole role)
Returns all the states bound to a given WFRole.

Parameters:
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 on
member - the member
state - 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

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 role
source - the source state
target - 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 member
pub - the publication
target - 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 member
pub - the publication
source - the source state
target - the target state
Returns:
true if the change can be performed
Since:
jcms-2.1

getNextStateSet

public 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 publication
member - the member
Returns:
a set of WFState
Since:
jcms-2.1

getNextStateSet

public 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 on
member - the member
state - the source state
ws - 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 state
target - the target state
role - the role
Since:
jcms-2.1

removeAllTransitions

public void removeAllTransitions()
Removes all the transition of this workflow

Since:
jcms-2.1

getIncomingTransitionSet

public 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(String roleId)
Returns a WFRole from its id.

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 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 added
register - 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 deleted
member - 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


Copyright © 2001-2010 Jalios SA. All Rights Reserved.