com.jalios.jcms
Class WorkflowManager

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

public class WorkflowManager
extends Object
implements JcmsConstants, WorkflowConstants

This class manages JCMS workflows.

Since:
jcms-5.5.0
Version:
$Revision: 40147 $
Author:
Olivier Dedieu

Field Summary
static Workflow DEFAULT_WORKFLOW
           
static String REVISION
           
protected static Map<String,WFRole> wfRoleMap
           
 
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
 
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
 
Method Summary
protected static void addRole(WFRole role)
           
static void addWFExpressAlarm(Publication pub)
          Adds a WFReminder alarm for the given publication (only for main leader replica).
static void addWFReminderAlarm(Publication pub)
          Adds a WFReminder alarm for the given publication (only for main leader replica).
static void addWorkflow(String id, Workflow wf)
          Binds a Workflow to a given class
static void convertFromVersion3()
          Converts old JCMS (<= 5.6) workflow.xml to new (>=5.7) workflow structure.
static Comparator<Workflow> getAlphabeticalComparator()
           
static Workflow getCopyWorkflow(String id)
          Returns the workflow bound to the given id in copyWorkflowMap
static Map<String,Workflow> getCopyWorkflowMap()
          Returns the copy of the workflow map (used to perform changes with no effect until the workflows are saved)
static Workflow getDefaultWorkflow()
           
static WorkflowManager getInstance()
           
static WFNote getLastWFNote(Publication pub)
          Returns the last WFNote created for this publication.
static String getUnknownWFStateLabel(int pstatus)
          Returns the label of an unknown pstatus.
static List<WFNote> getWFNoteList(Publication pub)
          Returns the list of WFNote bound to the given publication.
static WFRole getWFRole(String wfRoleId)
           
static Set<String> getWFRoleIdSet()
          Returns a Set of workflow role's ids (String) as defined by the tag <role...
static String getWFStateStateLabel(Publication pub, int pstatus, String userLang)
          Returns the label of the given pstatus.
static String getWFStateStateLabel(Workflow wf, int pstatus, String userLang)
          Returns the label of the given pstatus.
static String getWFStateStateLabelHtml(Publication pub, int pstatus, String userLang)
          Returns the HTML code for the label of the given pstatus.
static String getWFStateStateLabelHtml(Workflow wf, int pstatus, String userLang)
          Returns the HTML code for the label of the given pstatus.
static WKRole getWKRole(String wkRoleId)
           
static Set<WKRole> getWKRoles(WFRole wfRole)
           
static Workflow getWorkflow(Publication pub)
          Returns the workflow bound to a given publication (general workflow, not instance one if any is set.
static Workflow getWorkflow(String wfId)
          Return a Workflow from a given Id
static Set<String> getWorkflowIdSet()
          Return the set of Workflow id from the workflow Map
static Set<String> getWorkflowIdSet(Class typeClass)
          Return the set of workflow id from the workflow Map compatible with the typeClass
static Map<String,Workflow> getWorkflowMap()
          Returns the workflow map.
static Map<String,Workflow> getWorkflowMap(boolean copy)
          Returns the workflow map or the copy of the workflow map (without the default workflow)
static Set<Workflow> getWorkflowSet()
          Return the set of workflow from the workflow Map
static Set<Workflow> getWorkflowSet(Class typeClass)
          Return the set of workflow from the workflow Map compatible with the typeClass
static boolean hasAlreadyVoted(Publication pub, Member mbr)
          Check if the given member has already voted for the given publication.
static void initWorkflow()
          Initialize the workflows
static void initWorkflowAlarms()
           
static boolean isCompatibleWorkflow(Workflow workflow, Class typeClass)
          indicates if the Workflow is compatible with the type Class
static boolean isUpdated()
          Returns true if at least one workflow is new, has been updated or has been deleted.
static Map<String,Workflow> parseAllWorkflows()
          Parse all workflows contains in JCMS workflows directory.
static void removeAllWFNotes(Publication pub)
          Removes all the WFNote bound to the given publication.
protected static void removeRole(WFRole role)
           
static void removeWFExpressAlarm(Publication pub)
          Removes the WFExpress alarm for the given publication.
static void removeWFReminderAlarm(Publication pub)
          Removes the WFExpress alarm for the given publication.
static void removeWorkflow(String id)
          Unbinds a Workflow to a given wfId
static void revertAllWorkflows()
          Revert all the workflow
static void saveAllWorkflows()
          Save the Workflow on disk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

DEFAULT_WORKFLOW

public static Workflow DEFAULT_WORKFLOW

wfRoleMap

protected static final Map<String,WFRole> wfRoleMap
Method Detail

getInstance

public static WorkflowManager getInstance()

convertFromVersion3

public static void convertFromVersion3()
                                throws IOException,
                                       org.jdom.JDOMException
Converts old JCMS (<= 5.6) workflow.xml to new (>=5.7) workflow structure.

Throws:
IOException
org.jdom.JDOMException
Since:
jcms-5.7.0

parseAllWorkflows

public static Map<String,Workflow> parseAllWorkflows()
                                              throws org.jdom.JDOMException,
                                                     IOException
Parse all workflows contains in JCMS workflows directory.

Returns:
the Map {id, Workflow}
Throws:
org.jdom.JDOMException
IOException
Since:
jcms-5.7.0

initWorkflowAlarms

public static void initWorkflowAlarms()

getWorkflow

public static Workflow getWorkflow(String wfId)
Return a Workflow from a given Id

Parameters:
wfId - the WOrkflow Id
Returns:
a Workflow

getWorkflowSet

public static Set<Workflow> getWorkflowSet()
Return the set of workflow from the workflow Map

Returns:
the workflowSet

getWorkflowIdSet

public static Set<String> getWorkflowIdSet()
Return the set of Workflow id from the workflow Map

Returns:
the workflowSet of Workflow id

getWorkflowSet

public static Set<Workflow> getWorkflowSet(Class typeClass)
Return the set of workflow from the workflow Map compatible with the typeClass

Parameters:
typeClass - the Class with wich the workflow should be compatible
Returns:
the workflowSet compatible with the typeClass

isCompatibleWorkflow

public static boolean isCompatibleWorkflow(Workflow workflow,
                                           Class typeClass)
indicates if the Workflow is compatible with the type Class

Parameters:
workflow - the Workflow
typeClass - the type Class
Returns:
true if the Workflow can be used with this type class, false otherwise (null parameter always return false)

getWorkflowIdSet

public static Set<String> getWorkflowIdSet(Class typeClass)
Return the set of workflow id from the workflow Map compatible with the typeClass

Parameters:
typeClass - the Class with wich the workflow should be compatible
Returns:
the Set of Workflow id compatible with the typeClass

getWorkflowMap

public static Map<String,Workflow> getWorkflowMap()
Returns the workflow map. Keys are the workflow ids, values are the workflows.

Returns:
the workflow map
Since:
jcms-2.1

getCopyWorkflowMap

public static Map<String,Workflow> getCopyWorkflowMap()
Returns the copy of the workflow map (used to perform changes with no effect until the workflows are saved)

Returns:
the copy of the workflow map
Since:
jcms-5.5.0

getWorkflowMap

public static Map<String,Workflow> getWorkflowMap(boolean copy)
Returns the workflow map or the copy of the workflow map (without the default workflow)

Parameters:
copy - if true returns the copy of the workflow map
Returns:
the workflow map or the copy of the workflow map
Since:
jcms-5.5.0

addWorkflow

public static void addWorkflow(String id,
                               Workflow wf)
Binds a Workflow to a given class

Parameters:
id - the workflow id
wf - the workflow
Since:
jcms-2.1

removeWorkflow

public static void removeWorkflow(String id)
Unbinds a Workflow to a given wfId

Parameters:
id - the workflow id
Since:
jcms-2.1

getCopyWorkflow

public static Workflow getCopyWorkflow(String id)
Returns the workflow bound to the given id in copyWorkflowMap

Parameters:
id - the workflow id
Returns:
the workflow bound to the given id in copyWorkflowMap
Since:
jcms-5.5.0

getWorkflow

public static Workflow getWorkflow(Publication pub)
Returns the workflow bound to a given publication (general workflow, not instance one if any is set. Publication.getWorkflow() will give it if any is set.

Parameters:
pub - the publication
Returns:
the bound Workflow (or null if none)
Since:
jcms-2.1

saveAllWorkflows

public static void saveAllWorkflows()
Save the Workflow on disk

Since:
jcms-2.1

revertAllWorkflows

public static void revertAllWorkflows()
Revert all the workflow

Since:
jcms-5.5.0

initWorkflow

public static void initWorkflow()
                         throws Exception
Initialize the workflows

Throws:
Exception - if the initialization failed
Since:
jcms-5.5.0

getDefaultWorkflow

public static Workflow getDefaultWorkflow()

isUpdated

public static boolean isUpdated()
Returns true if at least one workflow is new, has been updated or has been deleted.

Returns:
true if at least one workflow is new, has been updated or has been deleted.
Since:
jcms-5.5.0

addRole

protected static void addRole(WFRole role)

removeRole

protected static void removeRole(WFRole role)

getWFRoleIdSet

public static Set<String> getWFRoleIdSet()
Returns a Set of workflow role's ids (String) as defined by the tag <role... > in the workflow.xml file of this JCMS site.

Returns:
Set of String

getWFRole

public static WFRole getWFRole(String wfRoleId)

getWKRole

public static WKRole getWKRole(String wkRoleId)

getWKRoles

public static Set<WKRole> getWKRoles(WFRole wfRole)

getWFStateStateLabel

public static String getWFStateStateLabel(Publication pub,
                                          int pstatus,
                                          String userLang)
Returns the label of the given pstatus.

Parameters:
pub - the publication to be used to get the workflow.
pstatus - the pstatus
userLang - the user language
Returns:
the label of the given pstatus.
Since:
jcms-5.7.0

getWFStateStateLabel

public static String getWFStateStateLabel(Workflow wf,
                                          int pstatus,
                                          String userLang)
Returns the label of the given pstatus.

Parameters:
wf - the workflow.
pstatus - the pstatus
userLang - the user language
Returns:
the label of the given pstatus.
Since:
jcms-5.7.0

getWFStateStateLabelHtml

public static String getWFStateStateLabelHtml(Publication pub,
                                              int pstatus,
                                              String userLang)
Returns the HTML code for the label of the given pstatus.

Parameters:
pub - the publication to be used to get the workflow.
pstatus - the pstatus
userLang - the user language
Returns:
the HTML code for the label of the given pstatus.
Since:
jcms-7.0.0

getWFStateStateLabelHtml

public static String getWFStateStateLabelHtml(Workflow wf,
                                              int pstatus,
                                              String userLang)
Returns the HTML code for the label of the given pstatus.

Parameters:
wf - the workflow.
pstatus - the pstatus
userLang - the user language
Returns:
the HTML code for the label of the given pstatus.
Since:
jcms-7.0.0

getUnknownWFStateLabel

public static String getUnknownWFStateLabel(int pstatus)
Returns the label of an unknown pstatus.

Parameters:
pstatus -
Returns:
the label of an unknown pstatus.
Since:
jcms-5.7.0

getWFNoteList

public static List<WFNote> getWFNoteList(Publication pub)
Returns the list of WFNote bound to the given publication.

Parameters:
pub - the publication
Returns:
the list of WFNote bound to the given publication.
Since:
jcms-6.0.0

getLastWFNote

public static WFNote getLastWFNote(Publication pub)
Returns the last WFNote created for this publication.

Parameters:
pub - the publication
Returns:
the last WFNote created for this publication.
Since:
jcms-6.0.0

hasAlreadyVoted

public static boolean hasAlreadyVoted(Publication pub,
                                      Member mbr)
Check if the given member has already voted for the given publication.

Parameters:
pub - the publication
mbr - the member
Returns:
true if the given member has already voted (ie add a WFNote) in the workflow for the given publication.
Since:
jcms-6.0.0

removeAllWFNotes

public static void removeAllWFNotes(Publication pub)
Removes all the WFNote bound to the given publication.

Parameters:
pub - the publication
Since:
jcms-6.0.0

addWFReminderAlarm

public static void addWFReminderAlarm(Publication pub)
Adds a WFReminder alarm for the given publication (only for main leader replica).

Parameters:
pub - the publication
Since:
jcms-6.0.0

removeWFReminderAlarm

public static void removeWFReminderAlarm(Publication pub)
Removes the WFExpress alarm for the given publication.

Parameters:
pub - the publication
Since:
jcms-6.0.0

addWFExpressAlarm

public static void addWFExpressAlarm(Publication pub)
Adds a WFReminder alarm for the given publication (only for main leader replica).

Parameters:
pub - the publication
Since:
jcms-6.0.0

removeWFExpressAlarm

public static void removeWFExpressAlarm(Publication pub)
Removes the WFExpress alarm for the given publication.

Parameters:
pub - the publication
Since:
jcms-6.0.0

getAlphabeticalComparator

public static Comparator<Workflow> getAlphabeticalComparator()


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