Class ProcessManagerSessionController

  • All Implemented Interfaces:
    Serializable, org.silverpeas.core.web.mvc.controller.ComponentSessionController, org.silverpeas.core.web.session.SessionCloseable

    public class ProcessManagerSessionController
    extends org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController
    The ProcessManager Session controller
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

        context
    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessManagerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext context)
      Builds and init a new session controller
      ProcessManagerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl, org.silverpeas.core.web.mvc.controller.ComponentContext context, ProcessManagerException fatal)
      Builds a ill session controller.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearFilter()  
      String createProcessInstance​(org.silverpeas.core.contribution.content.form.DataRecord data, boolean isDraft, boolean firstTimeSaved)
      Create a new process instance with the filled form.
      org.silverpeas.core.web.export.ExportCSVBuilder exportListAsCSV()  
      boolean filterHistory()
      L'historique peut être filtré.
      org.silverpeas.core.workflow.api.model.Action getAction​(String actionName)
      Get the named action
      org.silverpeas.core.contribution.content.form.Form getActionForm​(String actionName)
      Returns the form associated to the named action.
      org.silverpeas.core.contribution.content.form.DataRecord getActionRecord​(String actionName)
      Returns a new DataRecord filled whith the folder data and which will be be completed by the action form.
      List<CurrentState> getActiveStates()
      Get the active states.
      org.silverpeas.core.contribution.content.form.Form getAssignForm()
      Get assign form (for the re-affectations)
      org.silverpeas.core.contribution.content.form.DataRecord getAssignRecord()
      Get assign data (for the re-affectations)
      NamedValue[] getComponentInstanceRoleLabels()
      Returns the component instance roles as a list of (name, label) pair.
      org.silverpeas.core.contribution.content.form.Form getCreationForm()
      Returns the form which starts a new instance.
      boolean getCreationRights()
      Get the creation rights
      List<org.silverpeas.core.workflow.api.user.Replacement> getCurrentAndNextUserReplacementsAsIncumbent()
      Gets current and next replacements at date of day in which the current user can be replaced in the workflow.
      ProcessFilter getCurrentFilter()
      Returns the current ProcessFilter.
      org.silverpeas.core.workflow.api.instance.ProcessInstance getCurrentProcessInstance()
      Get the current process instance
      List<org.silverpeas.core.contribution.content.form.DataRecord> getCurrentProcessList()
      Returns the current process instance list.
      org.silverpeas.core.workflow.api.user.Replacement getCurrentReplacement()  
      String getCurrentRole()  
      String getCurrentRoleLabel()  
      String getCurrentTokenId()
      Get the current tokenId.
      String[] getDeleteAction()
      Search for an hypothetic action of kind "delete", allowed for the current user with the given role
      org.silverpeas.core.contribution.content.form.DataRecord getEmptyCreationRecord()
      Returns the an empty creation record which will be filled with the creation form.
      org.silverpeas.core.contribution.content.form.DataRecord getEmptyQuestionRecord()
      Returns the an empty question record which will be filled with the question form.
      org.silverpeas.core.contribution.content.form.DataRecord getEmptyUserSettingsRecord()
      Returns the an empty date record which will be filled with the user settings form.
      ProcessManagerException getFatalException()
      Returns the last fatal exception
      org.silverpeas.core.workflow.api.model.Item[] getFolderItems()  
      org.silverpeas.core.contribution.content.form.DataRecord getFolderRecord()
      Returns the folder data of the current process instance.
      List<LockVO> getLockingUsers()
      Get locking users list
      int getNbEntriesAboutQuestions()  
      org.silverpeas.core.contribution.content.form.Form getPresentationForm()
      Returns the form presenting the folder of the current process instance.
      org.silverpeas.core.contribution.content.form.Form getPresentationForm​(String name)
      Returns the named form (Read only).
      org.silverpeas.core.workflow.api.error.WorkflowError[] getProcessInstanceErrors​(String processId)
      Get all the errors occured while processing the current process instance
      String getProcessInstanceIdFromExternalTodoId​(String externalTodoId)
      Get the process instance Id referred by the todo with the given todo id
      org.silverpeas.core.contribution.content.form.RecordTemplate getProcessListHeaders()
      Returns the current instance list rows template.
      org.silverpeas.core.workflow.api.model.ProcessModel getProcessModel​(String modelId)
      Returns the process model having the given id.
      org.silverpeas.core.workflow.api.instance.Question getQuestion​(String questionId)
      get the question with the given id
      org.silverpeas.core.contribution.content.form.Form getQuestionForm​(boolean readonly)
      Returns the form to ask a question
      org.silverpeas.core.contribution.content.form.DataRecord getQuestionRecord​(String questionId)
      Returns the an empty question record which will be filled with the question form.
      String getRoleNameFromExternalTodoId​(String externalTodoId)
      Get the role name of task referred by the todo with the given todo id
      org.silverpeas.core.workflow.api.instance.HistoryStep getSavedStep()
      Get step saved by given user id.
      org.silverpeas.core.contribution.content.form.DataRecord getSavedStepRecord​(org.silverpeas.core.workflow.api.instance.HistoryStep savedStep)
      Get step data record saved.
      org.silverpeas.core.workflow.api.instance.HistoryStep[] getSortedHistorySteps​(boolean ascending)  
      org.silverpeas.core.workflow.api.model.State getState​(String stateName)
      Get the state with the given name
      org.silverpeas.core.workflow.api.instance.HistoryStep getStep​(String stepId)
      Returns the required step
      String getStepAction​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
      Get the list of actions in History Step of current process instance
      String getStepActor​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
      Get the list of actors in History Step of current process instance
      org.silverpeas.core.contribution.content.form.Form getStepForm​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
      Returns the form used to display the i-th step.
      List<StepVO> getSteps​(String strEnlightedStep)  
      String getStepSubstitute​(org.silverpeas.core.workflow.api.instance.HistoryStep step)  
      org.silverpeas.core.workflow.api.task.Task getTask​(String stateName)
      Returns the named task.
      org.silverpeas.core.workflow.api.task.Task[] getTasks()
      Get all tasks assigned for current user on current process instance
      org.silverpeas.core.workflow.api.user.User getUser​(String userId)
      Returns the workflow user having the given id.
      NamedValue[] getUserRoleLabels()
      Returns the user roles as a list of (name, label) pair.
      org.silverpeas.core.contribution.content.form.Form getUserSettingsForm()
      Returns the form to fill user settings
      org.silverpeas.core.contribution.content.form.DataRecord getUserSettingsRecord()
      Returns the an empty data record which will be filled with the user settings form.
      boolean hasPendingQuestions()
      Tests if there is some question for current user in current processInstance
      boolean hasUserSettings()
      Returns true if : the model has any user settings.
      boolean isAttachmentTabEnabled()  
      boolean isCSVExportEnabled()  
      boolean isCurrentUserIsLockingUser()
      Is current user is part of the locking users for current process instance ?
      boolean isHistoryTabVisible()  
      boolean isPrintButtonEnabled()
      Print button on an action can be disabled.
      boolean isProcessIdVisible()  
      boolean isResumingInstance()  
      boolean isSaveButtonEnabled()
      Save button on an action can be disabled.
      boolean isUserAllowedOnActiveStates()  
      boolean isUserSettingsOK()
      Returns true if : the user settings are correct
      boolean isVersionControlled()  
      boolean isViewReturn()  
      void lock​(String stateName)
      Lock the current instance for current user and given state
      void processAction​(String stateName, String actionName, org.silverpeas.core.contribution.content.form.DataRecord data, boolean isDraft, boolean isFirstTimeSaved)
      Create a new history step instance with the filled form.
      void processQuestion​(String stepId, String state, org.silverpeas.core.contribution.content.form.DataRecord data)
      Send the question as a QuestionEvent to the workflowEngine.
      void processResponse​(String questionId, org.silverpeas.core.contribution.content.form.DataRecord data)
      Send the answer as a ResponseEvent to the workflowEngine.
      void reAssign​(org.silverpeas.core.contribution.content.form.DataRecord data)
      Get assign data (for the re-affectations)
      void removeProcess​(String processId)
      Remove process instance with given id
      void resetCreationRights()
      Compute the creation rights set creationRight to true if user can do the "Creation" action
      void resetCurrentProcessInstance()
      Set current Process instance to null
      org.silverpeas.core.workflow.api.instance.ProcessInstance resetCurrentProcessInstance​(String instanceId)
      Updates the current process instance from the given id and returns the associated ProcessInstance object.
      List<org.silverpeas.core.contribution.content.form.DataRecord> resetCurrentProcessList​(boolean doAPause)
      Updates the current process instance list with current filter and returns this list.
      void resetCurrentProcessListHeaders()
      Reset the current instance list rows template.
      void resetCurrentRole​(String role)
      Returns the current role name.
      void resetCurrentRoleAsSubstitute​(String role, String incumbentId)  
      void saveUserSettings​(org.silverpeas.core.contribution.content.form.DataRecord data)
      Save the user settings which have been filled with the user settings form.
      void setCurrentTokenId​(String newTokenId)
      Set the current tokenId.
      void setResumingInstance​(boolean isResumingInstance)  
      void unlock​(String stateName)
      Un-Lock the current instance for current user and given state
      void unlock​(String userId, String stateName)
      Un-Lock the current instance for given user and given state
      • Methods inherited from class org.silverpeas.core.web.mvc.controller.AbstractComponentSessionController

        addClipboardSelection, clipboardPasteDone, close, getClipboardErrorMessage, getClipboardExceptionError, getClipboardObjects, getClipboardSelectedObjects, getClipboardSize, getComponentAccessController, getComponentId, getComponentLabel, getComponentName, getComponentParameterValue, getComponentParameterValue, getComponentRootName, getComponentUrl, getHighestSilverpeasUserRole, getIcon, getLanguage, getLook, getMultilang, getOrganisationController, getPersonalization, getRSSUrl, getSelection, getSettings, getSilverpeasUserRoles, getSpaceId, getSpaceLabel, getString, getSubscriptionContext, getUrlEncodedParameter, getUserAccessLevel, getUserAvailComponentIds, getUserDetail, getUserDetail, getUserId, getUserManageableGroupIds, getUserManageableSpaceIds, getUserRoles, getZoneId, isAppInMaintenance, isGroupManager, isPasswordChangeAllowed, isSpaceInMaintenance, removeClipboardElement, setAppModeMaintenance, setClipboardSelectedElement, setComponentRootName, setSpaceModeMaintenance
    • Constructor Detail

      • ProcessManagerSessionController

        public ProcessManagerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl,
                                               org.silverpeas.core.web.mvc.controller.ComponentContext context)
                                        throws ProcessManagerException
        Builds and init a new session controller
        Parameters:
        mainSessionCtrl -
        context -
        Throws:
        ProcessManagerException
      • ProcessManagerSessionController

        public ProcessManagerSessionController​(org.silverpeas.core.web.mvc.controller.MainSessionController mainSessionCtrl,
                                               org.silverpeas.core.web.mvc.controller.ComponentContext context,
                                               ProcessManagerException fatal)
        Builds a ill session controller. Initialization is skipped and this session controller can only * display the fatal exception. Used by the request router when a full session controller can't be built.
        Parameters:
        mainSessionCtrl -
        context -
        fatal -
    • Method Detail

      • getCreationRights

        public boolean getCreationRights()
        Get the creation rights
        Returns:
        true if user can do the "Creation" action
      • resetCreationRights

        public final void resetCreationRights()
        Compute the creation rights set creationRight to true if user can do the "Creation" action
      • filterHistory

        public boolean filterHistory()
        L'historique peut être filtré. Dans ce cas, les formulaires associés à chaque état sont visibles uniquement si l'utilisateur courant était un working user ou un interested user.
      • isHistoryTabVisible

        public boolean isHistoryTabVisible()
      • isCSVExportEnabled

        public boolean isCSVExportEnabled()
      • isPrintButtonEnabled

        public boolean isPrintButtonEnabled()
        Print button on an action can be disabled. So it's return the visibility status of that button.
        Returns:
        true is print button is visible
      • isSaveButtonEnabled

        public boolean isSaveButtonEnabled()
        Save button on an action can be disabled. So it's return the visibility status of that button.
        Returns:
        true is save button is visible
      • resetCurrentProcessInstance

        public void resetCurrentProcessInstance()
        Set current Process instance to null
      • resetCurrentProcessInstance

        public org.silverpeas.core.workflow.api.instance.ProcessInstance resetCurrentProcessInstance​(String instanceId)
                                                                                              throws ProcessManagerException
        Updates the current process instance from the given id and returns the associated ProcessInstance object. If the instanceId parameter is null, updates nothing and returns the current ProcessInstance. Throws ProcessManagerException when the instanceId is unkwown and when the current user is not allowed to access the instance. Doesn't change the current process instance when an error occures.
        Throws:
        ProcessManagerException
      • getCurrentProcessInstance

        public org.silverpeas.core.workflow.api.instance.ProcessInstance getCurrentProcessInstance()
        Get the current process instance
      • getProcessListHeaders

        public org.silverpeas.core.contribution.content.form.RecordTemplate getProcessListHeaders()
        Returns the current instance list rows template.
      • resetCurrentProcessListHeaders

        public void resetCurrentProcessListHeaders()
        Reset the current instance list rows template.
      • resetCurrentProcessList

        public List<org.silverpeas.core.contribution.content.form.DataRecord> resetCurrentProcessList​(boolean doAPause)
                                                                                               throws ProcessManagerException
        Updates the current process instance list with current filter and returns this list. Doesn't change the current process instance when an error occurs.
        Throws:
        ProcessManagerException
      • getProcessInstanceIdFromExternalTodoId

        public String getProcessInstanceIdFromExternalTodoId​(String externalTodoId)
                                                      throws ProcessManagerException
        Get the process instance Id referred by the todo with the given todo id
        Parameters:
        externalTodoId - external todo identifier
        Returns:
        the process instance Id referred by the todo with the given todo id.
        Throws:
        ProcessManagerException
      • isUserAllowedOnActiveStates

        public boolean isUserAllowedOnActiveStates()
      • getUser

        public org.silverpeas.core.workflow.api.user.User getUser​(String userId)
                                                           throws ProcessManagerException
        Returns the workflow user having the given id.
        Parameters:
        userId - the user identifier
        Returns:
        the workflow user having the given id.
        Throws:
        ProcessManagerException
      • getProcessModel

        public final org.silverpeas.core.workflow.api.model.ProcessModel getProcessModel​(String modelId)
                                                                                  throws ProcessManagerException
        Returns the process model having the given id.
        Parameters:
        modelId - the model identifier
        Returns:
        the process model having the given id.
        Throws:
        ProcessManagerException
      • getCurrentRole

        public String getCurrentRole()
        Returns:
        the current role name.
      • getCurrentReplacement

        public org.silverpeas.core.workflow.api.user.Replacement getCurrentReplacement()
        Returns:
        the current replacement if any.
      • getUserRoleLabels

        public NamedValue[] getUserRoleLabels()
        Returns the user roles as a list of (name, label) pair.
      • getComponentInstanceRoleLabels

        public NamedValue[] getComponentInstanceRoleLabels()
        Returns the component instance roles as a list of (name, label) pair.
      • getPresentationForm

        public org.silverpeas.core.contribution.content.form.Form getPresentationForm()
                                                                               throws ProcessManagerException
        Returns the form presenting the folder of the current process instance.
        Throws:
        ProcessManagerException
      • getFolderItems

        public org.silverpeas.core.workflow.api.model.Item[] getFolderItems()
      • getEmptyCreationRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getEmptyCreationRecord()
                                                                                        throws ProcessManagerException
        Returns the an empty creation record which will be filled with the creation form.
        Throws:
        ProcessManagerException
      • getEmptyQuestionRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getEmptyQuestionRecord()
        Returns the an empty question record which will be filled with the question form.
      • getQuestion

        public org.silverpeas.core.workflow.api.instance.Question getQuestion​(String questionId)
        get the question with the given id
        Parameters:
        questionId - question id
        Returns:
        the found question
      • getQuestionRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getQuestionRecord​(String questionId)
        Returns the an empty question record which will be filled with the question form.
      • getAssignRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getAssignRecord()
        Get assign data (for the re-affectations)
      • createProcessInstance

        public String createProcessInstance​(org.silverpeas.core.contribution.content.form.DataRecord data,
                                            boolean isDraft,
                                            boolean firstTimeSaved)
                                     throws ProcessManagerException
        Create a new process instance with the filled form.
        Parameters:
        data - the form data
        isDraft - true if form has just been saved as draft
        firstTimeSaved - true if form is saved as draft for the first time
        Throws:
        ProcessManagerException
      • getDeleteAction

        public String[] getDeleteAction()
        Search for an hypothetic action of kind "delete", allowed for the current user with the given role
        Returns:
        an array of 3 Strings { action.name, state.name, action.label }, an empty array if no action found
      • getPresentationForm

        public org.silverpeas.core.contribution.content.form.Form getPresentationForm​(String name)
                                                                               throws ProcessManagerException
        Returns the named form (Read only). Throws an exception if the form is unknown.
        Throws:
        ProcessManagerException
      • getActionForm

        public org.silverpeas.core.contribution.content.form.Form getActionForm​(String actionName)
                                                                         throws ProcessManagerException
        Returns the form associated to the named action. Returns null if this action has no form. Throws an exception if the action is unknown.
        Throws:
        ProcessManagerException
      • getActionRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getActionRecord​(String actionName)
                                                                                 throws ProcessManagerException
        Returns a new DataRecord filled whith the folder data and which will be be completed by the action form.
        Throws:
        ProcessManagerException
      • processAction

        public void processAction​(String stateName,
                                  String actionName,
                                  org.silverpeas.core.contribution.content.form.DataRecord data,
                                  boolean isDraft,
                                  boolean isFirstTimeSaved)
                           throws ProcessManagerException
        Create a new history step instance with the filled form.
        Throws:
        ProcessManagerException
      • getStep

        public org.silverpeas.core.workflow.api.instance.HistoryStep getStep​(String stepId)
        Returns the required step
      • getSortedHistorySteps

        public org.silverpeas.core.workflow.api.instance.HistoryStep[] getSortedHistorySteps​(boolean ascending)
      • getStepActor

        public String getStepActor​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
        Get the list of actors in History Step of current process instance
        Returns:
        an array of string containing actors full name
      • getStepSubstitute

        public String getStepSubstitute​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
      • getStepAction

        public String getStepAction​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
        Get the list of actions in History Step of current process instance
        Returns:
        an array of string containing actions names
      • getStepForm

        public org.silverpeas.core.contribution.content.form.Form getStepForm​(org.silverpeas.core.workflow.api.instance.HistoryStep step)
                                                                       throws ProcessManagerException
        Returns the form used to display the i-th step. Returns null if the step is unkwown.
        Throws:
        ProcessManagerException
      • getState

        public org.silverpeas.core.workflow.api.model.State getState​(String stateName)
        Get the state with the given name
        Parameters:
        stateName - state name
        Returns:
        State object
      • getAction

        public org.silverpeas.core.workflow.api.model.Action getAction​(String actionName)
        Get the named action
        Parameters:
        actionName - action name
        Returns:
        action
      • hasPendingQuestions

        public boolean hasPendingQuestions()
        Tests if there is some question for current user in current processInstance
        Returns:
        true if there is one or more question
      • getEmptyUserSettingsRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getEmptyUserSettingsRecord()
                                                                                            throws ProcessManagerException
        Returns the an empty date record which will be filled with the user settings form.
        Throws:
        ProcessManagerException
      • getUserSettingsRecord

        public org.silverpeas.core.contribution.content.form.DataRecord getUserSettingsRecord()
                                                                                       throws ProcessManagerException
        Returns the an empty data record which will be filled with the user settings form.
        Throws:
        ProcessManagerException
      • saveUserSettings

        public void saveUserSettings​(org.silverpeas.core.contribution.content.form.DataRecord data)
                              throws ProcessManagerException
        Save the user settings which have been filled with the user settings form.
        Throws:
        ProcessManagerException
      • clearFilter

        public void clearFilter()
      • getProcessInstanceErrors

        public org.silverpeas.core.workflow.api.error.WorkflowError[] getProcessInstanceErrors​(String processId)
        Get all the errors occured while processing the current process instance
      • isUserSettingsOK

        public boolean isUserSettingsOK()
        Returns true if : the user settings are correct
      • hasUserSettings

        public boolean hasUserSettings()
        Returns true if : the model has any user settings.
      • isVersionControlled

        public boolean isVersionControlled()
      • isAttachmentTabEnabled

        public boolean isAttachmentTabEnabled()
      • isProcessIdVisible

        public boolean isProcessIdVisible()
      • isViewReturn

        public boolean isViewReturn()
      • isCurrentUserIsLockingUser

        public boolean isCurrentUserIsLockingUser()
        Is current user is part of the locking users for current process instance ?
        Returns:
        true is current user is part of the locking users for current process instance
      • setResumingInstance

        public void setResumingInstance​(boolean isResumingInstance)
      • isResumingInstance

        public boolean isResumingInstance()
      • getCurrentTokenId

        public String getCurrentTokenId()
        Get the current tokenId. Token Id prevents users to use several windows with same session.
        Returns:
        the current token id
      • setCurrentTokenId

        public void setCurrentTokenId​(String newTokenId)
        Set the current tokenId. Token Id prevents users to use several windows with same session.
        Parameters:
        newTokenId - the current token id
      • getNbEntriesAboutQuestions

        public int getNbEntriesAboutQuestions()
      • getCurrentAndNextUserReplacementsAsIncumbent

        public List<org.silverpeas.core.workflow.api.user.Replacement> getCurrentAndNextUserReplacementsAsIncumbent()
        Gets current and next replacements at date of day in which the current user can be replaced in the workflow.
        Returns:
        a list of possible replacements.
      • getCurrentRoleLabel

        public String getCurrentRoleLabel()