Class WFState

  • All Implemented Interfaces:
    java.lang.Comparable

    public class WFState
    extends java.lang.Object
    implements java.lang.Comparable
    This class represents a state in a Workflow
    Since:
    jcms-2.1
    Version:
    $Revision: 128539 $
    Author:
    Olivier Dedieu
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String REVISION  
    • Constructor Summary

      Constructors 
      Constructor Description
      WFState​(int pstatus, int duration, int targetPstatus, int reminderDuration, java.lang.String color)  
      WFState​(int pstatus, java.util.Map<java.lang.String,​java.lang.String> labelMap, java.util.Map<java.lang.String,​java.lang.String> descriptionMap)  
      WFState​(int pstatus, java.util.Map<java.lang.String,​java.lang.String> labelMap, java.util.Map<java.lang.String,​java.lang.String> descriptionMap, int duration, int targetPstatus, int reminderDuration, java.lang.String color, java.lang.String wfId)  
    • Constructor Detail

      • WFState

        public WFState​(int pstatus,
                       java.util.Map<java.lang.String,​java.lang.String> labelMap,
                       java.util.Map<java.lang.String,​java.lang.String> descriptionMap)
      • WFState

        public WFState​(int pstatus,
                       java.util.Map<java.lang.String,​java.lang.String> labelMap,
                       java.util.Map<java.lang.String,​java.lang.String> descriptionMap,
                       int duration,
                       int targetPstatus,
                       int reminderDuration,
                       java.lang.String color,
                       java.lang.String wfId)
      • WFState

        public WFState​(int pstatus,
                       int duration,
                       int targetPstatus,
                       int reminderDuration,
                       java.lang.String color)
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • reloadI18N

        public void reloadI18N()
        Reload all I18N informations for this WFState. This includes : 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
      • getLabelHtml

        public java.lang.String getLabelHtml​(java.lang.String lang)
        Returns the HTML code for the localized label
        Parameters:
        lang - the language
        Returns:
        an HTML code for the label
        Since:
        jcms-7.0.0
      • getDescription

        public java.lang.String getDescription​(java.lang.String lang)
        Returns a localized description.
        Parameters:
        lang - the language
        Returns:
        a localized description.
        Since:
        jcms-5.7.0
      • isSpecialState

        public boolean isSpecialState()
        Returns:
        true if this state is a special state (i.e. SCHEDULED, PUBLISHED or EXPIRED)
        Since:
        jcms-2.1
      • addTransition

        public void addTransition​(WFState target,
                                  WFRole role)
        Adds an outgoing transition from this state
        Parameters:
        target - the target state
        role - the role that can perform this transition
        Since:
        jcms-4.0.2
      • removeTransition

        public void removeTransition​(WFState target,
                                     WFRole role)
        Remove an outgoing transition from this state
        Parameters:
        target - the target state
        role - the role that can perform this transition
        Since:
        jcms-5.5.0
      • getTransitionSet

        public java.util.Set<WFTransition> getTransitionSet()
        Returns:
        the set of outgoing transition from this state
        Since:
        jcms-2.1
      • removeAllTransitions

        public void removeAllTransitions()
        Removes all the transitions of this state
        Since:
        jcms-2.1
      • checkTransition

        public boolean checkTransition​(int targetPstatus,
                                       ObjectIntTreeMap grpVoteMap,
                                       java.util.TreeSet<Member> mbrVoteSet,
                                       Publication pub,
                                       Member mbr)
        Check if there exists at least one transition matching the given criteria and which can be performed
        Parameters:
        targetPstatus - the target pstatus
        grpVoteMap - the group vote map
        mbrVoteSet - the member vote set
        pub - the publication
        mbr - the member who performs this transition
        Returns:
        true if the transition exists
        Since:
        jcms-5.5.0
      • getRoleSet

        public java.util.TreeSet<WFRole> getRoleSet()
        Returns:
        the set of role bound to this state
        Since:
        jcms-5.5.0
      • hasOpenRole

        public boolean hasOpenRole​(Workspace ws)
        Parameters:
        ws - the current workspace
        Returns:
        true if there is at least one open role in the role set for this workspace
        Since:
        jcms-6.1.2
      • addActionIn

        public void addActionIn​(WFAction action)
        Adds an incoming action (ie an action triggered when a publication comes in this state)
        Parameters:
        action - the incomming action
        Since:
        jcms-2.1
      • getActionInSet

        public java.util.Set<WFAction> getActionInSet()
        Returns:
        the set of incoming actions
        Since:
        jcms-2.1
      • addActionOut

        public void addActionOut​(WFAction action)
        Adds an outgoing action (ie an action triggered when a publication leaves this state)
        Parameters:
        action - the outgoing action
        Since:
        jcms-2.1
      • getActionOutSet

        public java.util.Set<WFAction> getActionOutSet()
        Returns:
        the set of outgoing actions
        Since:
        jcms-2.1
      • removeAllActions

        public void removeAllActions()
        Removes all the incoming and outgoind action of this state
        Since:
        jcms-2.1
      • performActionIn

        public void performActionIn​(Publication pub,
                                    boolean isReminder)
        Triggers all the incoming actions for a given publication
        Parameters:
        pub - the publication that triggers the alarm
        isReminder - indicates if this is a reminder
        Since:
        jcms-2.1
      • performActionOut

        public void performActionOut​(Publication pub)
        Triggers all the outgoing actions for a given publication
        Parameters:
        pub - the publication that triggers the alarm
        Since:
        jcms-2.1
      • getActionIn

        public WFAction getActionIn​(java.lang.String type)
        Get the incoming action of a given type
        Parameters:
        type - the action type
        Returns:
        the action looked for.
        Since:
        jcms-2.1
      • getActionOut

        public WFAction getActionOut​(java.lang.String type)
        Get the outgoing action of a given type
        Parameters:
        type - the action type
        Returns:
        the action looked for.
        Since:
        jcms-2.1
      • isActionIn

        public boolean isActionIn​(java.lang.String type)
        Checks if an incoming action of a given type exists.
        Parameters:
        type - the action type
        Returns:
        true if the action exists.
        Since:
        jcms-2.1
      • isActionOut

        public boolean isActionOut​(java.lang.String type)
        Checks if an outgoing action of a given type exists.
        Parameters:
        type - the action type
        Returns:
        true if the action exists.
        Since:
        jcms-2.1
      • isVisible

        public boolean isVisible()
        Returns true if publications in this state are visible in front-office.
        Returns:
        true if publications in this state are visible in front-office.
        Since:
        jcms-9.0.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(java.lang.Object obj)
        Specified by:
        compareTo in interface java.lang.Comparable
      • getLabelMap

        public java.util.Map<java.lang.String,​java.lang.String> getLabelMap()
        Returns the map of localized label.
        Returns:
        the map of localized label.
        Since:
        jcms-5.7.0
      • setLabelMap

        public void setLabelMap​(java.util.Map<java.lang.String,​java.lang.String> labelMap)
        Sets the map of localized label.
        Parameters:
        labelMap - the map of localized label.
        Since:
        jcms-5.7.0
      • getPstatus

        public int getPstatus()
        Get the value of pstatus.
        Returns:
        Value of pstatus.
        Since:
        jcms-2.1
      • setPstatus

        public void setPstatus​(int v)
        Set the value of pstatus.
        Parameters:
        v - Value to assign to pstatus.
        Since:
        jcms-2.1
      • getDescriptionMap

        public java.util.Map<java.lang.String,​java.lang.String> getDescriptionMap()
        Returns the map of localized description.
        Returns:
        the map of localized description.
        Since:
        jcms-5.7.0
      • setDescriptionMap

        public void setDescriptionMap​(java.util.Map<java.lang.String,​java.lang.String> descriptionMap)
        Sets the map of localized description.
        Parameters:
        descriptionMap - the map of localized description.
        Since:
        jcms-5.7.0
      • isExpress

        public boolean isExpress()
        Returns:
        true if this State has a WorkFlow Express
        Since:
        jcms-4.0.2
      • setDuration

        public void setDuration​(int duration)
        Parameters:
        duration - define the duration in minute of the Workflow Express (in minutes)
        Since:
        jcms-4.0.2
      • getDuration

        public int getDuration()
        Returns:
        the duration in minutes of the workflow Express (in minutes)
        Since:
        jcms-4.0.2
      • setTargetPstatus

        public void setTargetPstatus​(int targetPstatus)
        Parameters:
        targetPstatus - the target Pstatus value
        Since:
        jcms-4.0.2
      • getTargetPstatus

        public int getTargetPstatus()
        Returns:
        the target Pstatus value
        Since:
        jcms-4.0.2
      • getReminder

        public int getReminder()
        Returns the reminder duration (in seconds).
        Returns:
        the reminder duration (in seconds).
        Since:
        jcms-5.5.0
      • setReminder

        public void setReminder​(int reminder)
        Set the reminder.
        Parameters:
        reminder - the reminder duration (in seconds).
        Since:
        jcms-5.5.0
      • hasReminder

        public boolean hasReminder()
        Returns true if a reminder has been set for this state.
        Returns:
        true if a reminder has been set for this state.
        Since:
        jcms-5.5.0
      • getColor

        public java.lang.String getColor()
        Returns:
        the color (or null if default color)
        Since:
        jcms-10.0.5
      • setColor

        public void setColor​(java.lang.String color)
        Set the color.
        Parameters:
        color - the color
        Since:
        jcms-10.0.5
      • 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