Class ProcessAction

java.lang.Object
org.apache.struts.action.Action
org.apache.struts.actions.BaseAction
org.apache.struts.actions.DispatchAction
org.bgerp.action.base.BaseAction
org.bgerp.action.ProcessAction
Direct Known Subclasses:
ProcessAction, ProcessLinkAction, ProcessQueueAction

public class ProcessAction extends BaseAction
Process actions: viewing, creation, status, type, groups, executors and merging
  • Constructor Details

    • ProcessAction

      public ProcessAction()
      Default constructor
  • Method Details

    • unspecified

      public org.apache.struts.action.ActionForward unspecified(DynActionForm form, ConnectionSet conSet) throws Exception
      Description copied from class: BaseAction
      Default action method if no parameter 'action' passed. Overwrite and implement.
      Overrides:
      unspecified in class BaseAction
      Parameters:
      form -
      conSet -
      Returns:
      Throws:
      Exception
    • process

      public org.apache.struts.action.ActionForward process(DynActionForm form, ConnectionSet conSet) throws Exception
      Opens a process, or a placeholder when it does not exist, optionally with its creation wizard
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processCreateTypes

      public static List<ProcessCreateType> processCreateTypes(DynActionForm form, String area, Set<Integer> ids)
      List of process types, allowed for creation, filtered by 'create.in' configuration and process isolation
      Parameters:
      form - current request form user and permission
      area - creation area
      ids - optional additional restricting process IDs
      Returns:
      list of process types
    • processCreateGroups

      public org.apache.struts.action.ActionForward processCreateGroups(DynActionForm form, Connection con)
      Returns the groups offered for selection when creating a process of the given type
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
    • processCreateAndGet

      public static Process processCreateAndGet(DynActionForm form, Connection con) throws Exception
      Creates a process from the form parameters and returns it
      Parameters:
      form - request form
      con - database connection
      Returns:
      the created process
      Throws:
      Exception - on any error
    • processCreate

      public static void processCreate(DynActionForm form, Connection con, Process process) throws Exception
      Creates the given process with no preselected group
      Parameters:
      form - request form
      con - database connection
      process - process to create
      Throws:
      Exception - on any error
    • processCreate

      public static void processCreate(DynActionForm form, Connection con, Process process, int groupId) throws Exception
      Creates the given process: stores it, sets the initial status, groups and runs the creation wizard
      Parameters:
      form - request form
      con - database connection
      process - process to create
      groupId - group to assign, or non-positive to use the type configuration
      Throws:
      Exception - on any error
    • doCreateWizard

      protected static void doCreateWizard(DynActionForm form, Connection con, Process process, ProcessType type) throws SQLException
      Inverts the process ID to a temporary (negative) one when the type has a creation wizard
      Parameters:
      form - request form
      con - database connection
      process - process being created
      type - process type
      Throws:
      SQLException - on a database error
    • processCreate

      public org.apache.struts.action.ActionForward processCreate(DynActionForm form, Connection con) throws Exception
      Creates a process and returns its ID for navigating to the editor
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processClone

      public org.apache.struts.action.ActionForward processClone(DynActionForm form, Connection con) throws Exception
      Clones a process with its parameters
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processDeleteTmp

      public org.apache.struts.action.ActionForward processDeleteTmp(DynActionForm form, Connection con) throws Exception
      Deletes a temporary (not yet finally created) process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processDelete

      public org.apache.struts.action.ActionForward processDelete(DynActionForm form, Connection con) throws Exception
      Deletes a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processDelete

      public static void processDelete(DynActionForm form, Connection con, Process process) throws Exception
      Deletes the given process and fires the removed event
      Parameters:
      form - request form
      con - database connection
      process - process to delete
      Throws:
      Exception - on any error
    • processFinishCreateTmp

      public org.apache.struts.action.ActionForward processFinishCreateTmp(DynActionForm form, Connection con) throws Exception
      Finalizes creation of a temporary process, turning it into a permanent one
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processStatusEdit

      public org.apache.struts.action.ActionForward processStatusEdit(DynActionForm form, Connection con) throws Exception
      Opens the status editor of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processStatusUpdate

      public org.apache.struts.action.ActionForward processStatusUpdate(DynActionForm form, Connection con) throws Exception
      Changes the status of a process, supporting the special 'prev' previous-status value
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processStatusUpdate

      public static void processStatusUpdate(DynActionForm form, Connection con, Process process, StatusChange change) throws Exception
      Applies a status change to a process, validating required comment, parameters and the transition
      Parameters:
      form - request form
      con - database connection
      process - process to change
      change - status change to apply
      Throws:
      Exception - on any error
    • processStatusHistory

      public org.apache.struts.action.ActionForward processStatusHistory(DynActionForm form, Connection con) throws Exception
      Returns the status change history of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processPriorityEdit

      public org.apache.struts.action.ActionForward processPriorityEdit(DynActionForm form, ConnectionSet conSet)
      Opens the priority editor of a process
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
    • processPriorityUpdate

      public org.apache.struts.action.ActionForward processPriorityUpdate(DynActionForm form, Connection con) throws Exception
      Updates the priority of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processPriorityUpdate

      public static void processPriorityUpdate(DynActionForm form, Process process, Connection con, Integer priority) throws Exception
      Sets the priority of the given process and fires change events
      Parameters:
      form - request form
      process - process to change
      con - database connection
      priority - new priority
      Throws:
      Exception - on any error
    • processTypeEdit

      public org.apache.struts.action.ActionForward processTypeEdit(DynActionForm form, Connection con)
      Opens the type editor of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
    • processTypeUpdate

      public org.apache.struts.action.ActionForward processTypeUpdate(DynActionForm form, Connection con) throws Exception
      Updates the type of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processDescriptionUpdate

      public org.apache.struts.action.ActionForward processDescriptionUpdate(DynActionForm form, Connection con) throws Exception
      Replaces the description of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processDescriptionAdd

      public org.apache.struts.action.ActionForward processDescriptionAdd(DynActionForm form, Connection con) throws Exception
      Appends text to the description of a process using the configured pattern
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processGroupsEdit

      public org.apache.struts.action.ActionForward processGroupsEdit(DynActionForm form, Connection con) throws Exception
      Opens the groups-with-roles editor of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processGroupsUpdate

      public org.apache.struts.action.ActionForward processGroupsUpdate(DynActionForm form, Connection con) throws Exception
      Updates the groups with roles of a process, validating them against the allowed groups
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processGroupsUpdate

      public static void processGroupsUpdate(DynActionForm form, Connection con, Process process, Set<ProcessGroup> processGroups) throws Exception
      Sets the groups with roles of the given process and removes executors of dropped group-roles
      Parameters:
      form - request form
      con - database connection
      process - process to change
      processGroups - new groups with roles
      Throws:
      Exception - on any error
    • processExecutorsEdit

      public org.apache.struts.action.ActionForward processExecutorsEdit(DynActionForm form, ConnectionSet conSet) throws Exception
      Opens the executors editor of a process, grouped by group and role
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processExecutorsUpdate

      public org.apache.struts.action.ActionForward processExecutorsUpdate(DynActionForm form, Connection con) throws Exception
      Updates the executors of a process in the given group-roles
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processExecutorsSwap

      public org.apache.struts.action.ActionForward processExecutorsSwap(DynActionForm form, Connection con) throws Exception
      Swaps executors between the two groups of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error
    • processExecutorsUpdate

      public static void processExecutorsUpdate(DynActionForm form, Connection con, Process process, Set<ProcessGroup> processGroups, Set<ProcessExecutor> processExecutors) throws Exception
      Updates the executors of the given process in the given group-roles, applying permission checks
      Parameters:
      form - request form
      con - database connection
      process - process to change
      processGroups - group-roles being updated
      processExecutors - new executors for those group-roles
      Throws:
      Exception - on any error
    • getProcess

      protected Process getProcess(ProcessDAO processDao, int id) throws SQLException, BGMessageException
      Gets process entity by ID.
      Parameters:
      processDao - DAO.
      id - process ID.
      Returns:
      the process
      Throws:
      SQLException - - DB exception.
      BGMessageException - - entity not found.
    • getProcessType

      public static ProcessType getProcessType(int typeId) throws BGMessageException
      Returns the process type from cache by its ID, or throws if it does not exist
      Parameters:
      typeId - process type ID
      Returns:
      the process type
      Throws:
      BGMessageException - if the type is not found
    • messagePossibleProcessList

      public org.apache.struts.action.ActionForward messagePossibleProcessList(DynActionForm form, ConnectionSet conSet) throws Exception
      Returns the processes a message could possibly belong to, by sender and linked objects
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • unionLog

      public org.apache.struts.action.ActionForward unionLog(DynActionForm form, Connection con) throws Exception
      Returns the combined log of a process
      Parameters:
      form - request form
      con - database connection
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • userProcessList

      public org.apache.struts.action.ActionForward userProcessList(DynActionForm form, ConnectionSet conSet) throws Exception
      Returns the processes the current user is an executor of
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processTypes

      protected List<IdTitle> processTypes(Collection<Process> processes)
      List with process types, reverse ordered by usage counts
      Parameters:
      processes - processes to count types over
      Returns:
      list of process type ID/title pairs ordered by descending usage count
    • processMergeEdit

      public org.apache.struts.action.ActionForward processMergeEdit(DynActionForm form, ConnectionSet conSet) throws Exception
      Opens the merge editor of a process
      Parameters:
      form - request form
      conSet - connection set
      Returns:
      HTML view forward
      Throws:
      Exception - on any error
    • processMerge

      public org.apache.struts.action.ActionForward processMerge(DynActionForm form, Connection con) throws Exception
      Merges a process into another one, moving its messages and deleting the source process
      Parameters:
      form - request form
      con - database connection
      Returns:
      JSON response
      Throws:
      Exception - on any error