fr.paris.lutece.portal.service.workflow
Class WorkflowService

java.lang.Object
  extended by fr.paris.lutece.portal.service.workflow.WorkflowService

public final class WorkflowService
extends Object

WorkflowService


Method Summary
 boolean canProcessAction(int nIdResource, String strResourceType, int nIdAction, Integer nExternalParentId, javax.servlet.http.HttpServletRequest request, boolean bIsAutomatic)
          Check if the action can be proceed for the given resource
 void doProcessAction(int nIdResource, String strResourceType, int nIdAction, Integer nExternalParentId, javax.servlet.http.HttpServletRequest request, Locale locale, boolean bIsAutomatic)
          Proceed action given in parameter
 void doProcessAutomaticReflexiveActions(int nIdResource, String strResourceType, int nIdState, Integer nIdExternalParent, Locale locale)
          Proceed automatic reflexive actions of state given in parameter.
 void doRemoveWorkFlowResource(int nIdResource, String strResourceType)
          Remove in all workflows the resource specified in parameter
 void doRemoveWorkFlowResourceByListId(List<Integer> lListIdResource, String strResourceType, Integer nIdWorflow)
          Remove list of resource workflow by list id
 String doSaveTasksForm(int nIdResource, String strResourceType, int nIdAction, Integer nExternalParentId, javax.servlet.http.HttpServletRequest request, Locale locale)
          Perform the information on the various tasks associated with the given action specified in parameter
 void executeActionAutomatic(int nIdResource, String strResourceType, int nIdWorkflow, Integer nExternalParentId)
          Execute action automatic
 Collection<fr.paris.lutece.plugins.workflowcore.business.action.Action> getActions(int nIdResource, String strResourceType, int nIdWorkflow, AdminUser user)
          returns a list of actions possible for a given document based on the status of the document in the workflow and the user role
 Map<Integer,List<fr.paris.lutece.plugins.workflowcore.business.action.Action>> getActions(List<Integer> listIdResource, String strResourceType, Integer nIdExternalParentId, int nIdWorkflow, AdminUser user)
          returns a list of actions possible for a given document based on the status of the document in the workflow and the user role
 Collection<fr.paris.lutece.plugins.workflowcore.business.state.State> getAllStateByWorkflow(int nIdWorkflow, AdminUser user)
          returns all state of a given workflow
 List<Integer> getAuthorizedResourceList(String strResourceType, int nIdWorkflow, int nIdWorkflowState, Integer nExternalParentId, AdminUser user)
          Get all authorized resource Id
 List<Integer> getAuthorizedResourceList(String strResourceType, int nIdWorkflow, List<Integer> lListIdWorkflowState, Integer nExternalParentId, AdminUser user)
          Get all authorized resource Id by list of state
 String getDisplayDocumentHistory(int nIdResource, String strResourceType, int nIdWorkflow, javax.servlet.http.HttpServletRequest request, Locale locale)
          returns the actions history performed on a resource
 String getDisplayTasksForm(int nIdResource, String strResourceType, int nIdAction, javax.servlet.http.HttpServletRequest request, Locale locale)
          returns the tasks form
 String getDocumentHistoryXml(int nIdResource, String strResourceType, int nIdWorkflow, javax.servlet.http.HttpServletRequest request, Locale locale)
          returns a xml wich contains the actions history performed on a resource
static WorkflowService getInstance()
          Returns the unique instance of the service
 List<fr.paris.lutece.plugins.workflowcore.business.action.Action> getMassActions(int nIdWorkflow)
          Get the list of mass actions from a given id workflow
 List<Integer> getResourceIdListByIdState(int nIdState, String strResourceType)
          Get the list of ids of resources of a given type that are in a given state
 fr.paris.lutece.plugins.workflowcore.business.state.State getState(int nIdResource, String strResourceType, int nIdWorkflow, Integer nIdExternalParentId)
          returns the state of a given document of the document in the workflow and the user role
 ReferenceList getWorkflowsEnabled(AdminUser user, Locale locale)
          return a reference list which contains a list enabled workflow
 boolean isAuthorized(int nIdResource, String strResourceType, int nIdWorkflow, AdminUser user)
          Check that a given user is allowed to view a resource depending the state of the resource
 boolean isAvailable()
          Check if the workflow service is available.
 boolean isDisplayTasksForm(int nIdAction, Locale locale)
          return true if a form is associate to the action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static WorkflowService getInstance()
Returns the unique instance of the service

Returns:
The instance of the service

isAvailable

public boolean isAvailable()
Check if the workflow service is available. To be available, the following conditions must be verified :

Returns:
true if the workflow service is available

getActions

public Collection<fr.paris.lutece.plugins.workflowcore.business.action.Action> getActions(int nIdResource,
                                                                                          String strResourceType,
                                                                                          int nIdWorkflow,
                                                                                          AdminUser user)
returns a list of actions possible for a given document based on the status of the document in the workflow and the user role

Parameters:
nIdResource - the document id
strResourceType - the document type
user - the adminUser
nIdWorkflow - the workflow id
Returns:
a list of Action

getActions

public Map<Integer,List<fr.paris.lutece.plugins.workflowcore.business.action.Action>> getActions(List<Integer> listIdResource,
                                                                                                 String strResourceType,
                                                                                                 Integer nIdExternalParentId,
                                                                                                 int nIdWorkflow,
                                                                                                 AdminUser user)
returns a list of actions possible for a given document based on the status of the document in the workflow and the user role

Parameters:
listIdResource - the list of resource id
strResourceType - the document type
nIdExternalParentId - the external parent identifier
nIdWorkflow - the workflow id
user - the adminUser
Returns:
a list of Action

isDisplayTasksForm

public boolean isDisplayTasksForm(int nIdAction,
                                  Locale locale)
return true if a form is associate to the action

Parameters:
nIdAction - the action id
locale - the loacle
Returns:
true if a form is associate to the action

doProcessAction

public void doProcessAction(int nIdResource,
                            String strResourceType,
                            int nIdAction,
                            Integer nExternalParentId,
                            javax.servlet.http.HttpServletRequest request,
                            Locale locale,
                            boolean bIsAutomatic)
Proceed action given in parameter

Parameters:
nIdResource - the resource id
strResourceType - the resource type
nIdAction - the action id
nExternalParentId - the external parent id
request - the request
locale - locale
bIsAutomatic - Is automatic

getDisplayDocumentHistory

public String getDisplayDocumentHistory(int nIdResource,
                                        String strResourceType,
                                        int nIdWorkflow,
                                        javax.servlet.http.HttpServletRequest request,
                                        Locale locale)
returns the actions history performed on a resource

Parameters:
nIdResource - the resource id
strResourceType - the resource type
request - the request
nIdWorkflow - the workflow id
locale - the locale
Returns:
the history of actions performed on a resource

getDocumentHistoryXml

public String getDocumentHistoryXml(int nIdResource,
                                    String strResourceType,
                                    int nIdWorkflow,
                                    javax.servlet.http.HttpServletRequest request,
                                    Locale locale)
returns a xml wich contains the actions history performed on a resource

Parameters:
nIdResource - the resource id
strResourceType - the resource type
request - the request
nIdWorkflow - the workflow id
locale - the locale
Returns:
a xml wich contains the history of actions performed on a resource

doSaveTasksForm

public String doSaveTasksForm(int nIdResource,
                              String strResourceType,
                              int nIdAction,
                              Integer nExternalParentId,
                              javax.servlet.http.HttpServletRequest request,
                              Locale locale)
Perform the information on the various tasks associated with the given action specified in parameter

Parameters:
nIdResource - the resource id
strResourceType - the resource type
nExternalParentId - the external parent id
request - the request
nIdAction - the action id
locale - the locale
Returns:
null if there is no error in the task form else return the error message url

getResourceIdListByIdState

public List<Integer> getResourceIdListByIdState(int nIdState,
                                                String strResourceType)
Get the list of ids of resources of a given type that are in a given state

Parameters:
nIdState - The id of the state of resources to get
strResourceType - The type of resources to get
Returns:
The list of resources matching both given state id and resource given. Return an empty list if no resource was found, or if the state does not exist.

doRemoveWorkFlowResource

public void doRemoveWorkFlowResource(int nIdResource,
                                     String strResourceType)
Remove in all workflows the resource specified in parameter

Parameters:
nIdResource - the resource id
strResourceType - the resource type

doRemoveWorkFlowResourceByListId

public void doRemoveWorkFlowResourceByListId(List<Integer> lListIdResource,
                                             String strResourceType,
                                             Integer nIdWorflow)
Remove list of resource workflow by list id

Parameters:
lListIdResource - list of id resource
strResourceType - the ressource type
nIdWorflow - the workflow id

getDisplayTasksForm

public String getDisplayTasksForm(int nIdResource,
                                  String strResourceType,
                                  int nIdAction,
                                  javax.servlet.http.HttpServletRequest request,
                                  Locale locale)
returns the tasks form

Parameters:
nIdResource - the document id
strResourceType - the document type
request - the request
nIdAction - the action id
locale - the locale
Returns:
the tasks form associated to the action

isAuthorized

public boolean isAuthorized(int nIdResource,
                            String strResourceType,
                            int nIdWorkflow,
                            AdminUser user)
Check that a given user is allowed to view a resource depending the state of the resource

Parameters:
nIdResource - the document id
strResourceType - the document type
user - the AdminUser
nIdWorkflow - the workflow id
Returns:
a list of Action

getAuthorizedResourceList

public List<Integer> getAuthorizedResourceList(String strResourceType,
                                               int nIdWorkflow,
                                               int nIdWorkflowState,
                                               Integer nExternalParentId,
                                               AdminUser user)
Get all authorized resource Id

Parameters:
strResourceType - the resource type
nIdWorkflow - the workflow id
nIdWorkflowState - The workflow state id or -1 for all workflow states
nExternalParentId - The external parent id
user - the AdminUser
Returns:
a list resource id

getAuthorizedResourceList

public List<Integer> getAuthorizedResourceList(String strResourceType,
                                               int nIdWorkflow,
                                               List<Integer> lListIdWorkflowState,
                                               Integer nExternalParentId,
                                               AdminUser user)
Get all authorized resource Id by list of state

Parameters:
strResourceType - the resource type
nIdWorkflow - the workflow id
lListIdWorkflowState - The workflow state id or null for all workflow states
nExternalParentId - the externbal parent identifier
user - the AdminUser
Returns:
a list resource id

getWorkflowsEnabled

public ReferenceList getWorkflowsEnabled(AdminUser user,
                                         Locale locale)
return a reference list which contains a list enabled workflow

Parameters:
user - the AdminUser
locale - the locale
Returns:
a reference list which contains a list enabled workflow

getAllStateByWorkflow

public Collection<fr.paris.lutece.plugins.workflowcore.business.state.State> getAllStateByWorkflow(int nIdWorkflow,
                                                                                                   AdminUser user)
returns all state of a given workflow

Parameters:
user - the adminUser
nIdWorkflow - the workflow id
Returns:
the state of a given document

getState

public fr.paris.lutece.plugins.workflowcore.business.state.State getState(int nIdResource,
                                                                          String strResourceType,
                                                                          int nIdWorkflow,
                                                                          Integer nIdExternalParentId)
returns the state of a given document of the document in the workflow and the user role

Parameters:
nIdResource - the document id
strResourceType - the document type
nIdWorkflow - the workflow id
nIdExternalParentId - the external parent id
Returns:
the state of a given document

executeActionAutomatic

public void executeActionAutomatic(int nIdResource,
                                   String strResourceType,
                                   int nIdWorkflow,
                                   Integer nExternalParentId)
Execute action automatic

Parameters:
nIdResource - the document id
strResourceType - the document type
nIdWorkflow - the workflow id
nExternalParentId - the external parent id

getMassActions

public List<fr.paris.lutece.plugins.workflowcore.business.action.Action> getMassActions(int nIdWorkflow)
Get the list of mass actions from a given id workflow

Parameters:
nIdWorkflow - the id workflow
Returns:
the list of mass actions

canProcessAction

public boolean canProcessAction(int nIdResource,
                                String strResourceType,
                                int nIdAction,
                                Integer nExternalParentId,
                                javax.servlet.http.HttpServletRequest request,
                                boolean bIsAutomatic)
Check if the action can be proceed for the given resource

Parameters:
nIdResource - the id resource
strResourceType - the resource type
nIdAction - the id action
nExternalParentId - the external parent id
request - the HTTP request
bIsAutomatic - is automatic action
Returns:
true if the action can proceed, false otherwise

doProcessAutomaticReflexiveActions

public void doProcessAutomaticReflexiveActions(int nIdResource,
                                               String strResourceType,
                                               int nIdState,
                                               Integer nIdExternalParent,
                                               Locale locale)
Proceed automatic reflexive actions of state given in parameter. This method should be called anytime a service changed the state of a resource without proceeding a workflow action

Parameters:
nIdResource - the resource id
strResourceType - the resource type
nIdState - the state of the resource id
nIdExternalParent - the external parent id*
locale - locale


Copyright © 2014 Mairie de Paris. All Rights Reserved.