Class FlowableUserRequestHandler
- java.lang.Object
-
- org.apache.syncope.core.flowable.impl.FlowableUserRequestHandler
-
- All Implemented Interfaces:
UserRequestHandler
@Transactional(propagation=REQUIRES_NEW, rollbackFor=java.lang.Throwable.class) public class FlowableUserRequestHandler extends Object implements UserRequestHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected String
adminUser
protected UserDataBinder
dataBinder
protected DomainProcessEngine
engine
protected EntityFactory
entityFactory
protected static Logger
LOG
protected UserDAO
userDAO
-
Constructor Summary
Constructors Constructor Description FlowableUserRequestHandler(UserDataBinder dataBinder, String adminUser, DomainProcessEngine engine, UserDAO userDAO, EntityFactory entityFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel(ProcessInstance procInst, String reason)
Cancel a running user request.void
cancelByProcessDefinition(String processDefinitionId)
Cancel all running user requests for the given process definition id.void
cancelByUser(EntityLifecycleEvent<Entity> event)
Cancel all running user requests for the user in the given delete event.UserRequestForm
claimForm(String taskId)
Claim a form for a given object.protected int
countProcessInstances(StringBuilder processInstanceQuery)
protected StringBuilder
createProcessInstanceQuery(String userKey)
protected static FormPropertyType
fromFlowableFormType(FormType flowableFormType)
UserRequestForm
getForm(String userKey, String taskId)
Get the form matching the provided task id.protected UserRequestForm
getForm(String procInstId, String taskId, String formKey, List<FormProperty> props)
protected UserRequestForm
getForm(org.flowable.task.api.history.HistoricTaskInstance task)
protected UserRequestForm
getForm(org.flowable.task.api.Task task)
protected UserRequestForm
getForm(org.flowable.task.api.Task task, TaskFormData fd)
Pair<Integer,List<UserRequestForm>>
getForms(String userKey, int page, int size, List<OrderByClause> ob)
Get the forms matching the provided parameters.protected Pair<Integer,List<UserRequestForm>>
getForms(org.flowable.task.api.TaskQuery query, int page, int size, List<OrderByClause> orderByClauses)
protected UserRequestForm
getHistoricFormTO(String procInstId, String taskId, String formKey, List<org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntity> props)
protected <T> T
getHistoricVariable(List<org.flowable.variable.api.history.HistoricVariableInstance> historicVariables, String name, Class<T> valueRef)
protected Map<String,String>
getPropertiesForSubmit(UserRequestForm form)
protected org.flowable.task.api.Task
getTask(String taskId)
protected String
getUserKey(String procInstId)
protected UserRequest
getUserRequest(ProcessInstance procInst)
Pair<Integer,List<UserRequest>>
getUserRequests(String userKey, int page, int size, List<OrderByClause> orderByClauses)
Get the running user requests matching the provided parameters.protected User
lazyLoad(User user)
Pair<ProcessInstance,String>
parse(String executionId)
Parses the given execution id to find matching user request and owner.protected Pair<org.flowable.task.api.Task,TaskFormData>
parseTask(String taskId)
UserRequest
start(String bpmnProcess, User user, WorkflowTaskExecInput inputVariables)
Starts a new user request, for the given BPMN process and user.UserWorkflowResult<UserUR>
submitForm(UserRequestForm form)
Submit a form.UserRequestForm
unclaimForm(String taskId)
Unclaim a form for a given object.
-
-
-
Field Detail
-
LOG
protected static final Logger LOG
-
dataBinder
protected final UserDataBinder dataBinder
-
adminUser
protected final String adminUser
-
engine
protected final DomainProcessEngine engine
-
userDAO
protected final UserDAO userDAO
-
entityFactory
protected final EntityFactory entityFactory
-
-
Constructor Detail
-
FlowableUserRequestHandler
public FlowableUserRequestHandler(UserDataBinder dataBinder, String adminUser, DomainProcessEngine engine, UserDAO userDAO, EntityFactory entityFactory)
-
-
Method Detail
-
createProcessInstanceQuery
protected StringBuilder createProcessInstanceQuery(String userKey)
-
countProcessInstances
protected int countProcessInstances(StringBuilder processInstanceQuery)
-
getUserRequest
protected UserRequest getUserRequest(ProcessInstance procInst)
-
getUserRequests
@Transactional(readOnly=true) public Pair<Integer,List<UserRequest>> getUserRequests(String userKey, int page, int size, List<OrderByClause> orderByClauses)
Description copied from interface:UserRequestHandler
Get the running user requests matching the provided parameters.- Specified by:
getUserRequests
in interfaceUserRequestHandler
- Parameters:
userKey
- user key (optional)page
- result pagesize
- items per pageorderByClauses
- sort conditions- Returns:
- total number of user requests, list of user requests matching the provided parameters
-
start
public UserRequest start(String bpmnProcess, User user, WorkflowTaskExecInput inputVariables)
Description copied from interface:UserRequestHandler
Starts a new user request, for the given BPMN process and user.- Specified by:
start
in interfaceUserRequestHandler
- Parameters:
bpmnProcess
- BPMN processuser
- userinputVariables
- variables- Returns:
- data about the started request service, including execution id
-
parse
public Pair<ProcessInstance,String> parse(String executionId)
Description copied from interface:UserRequestHandler
Parses the given execution id to find matching user request and owner.- Specified by:
parse
in interfaceUserRequestHandler
- Parameters:
executionId
- execution id- Returns:
- matching user request and owner
-
cancel
public void cancel(ProcessInstance procInst, String reason)
Description copied from interface:UserRequestHandler
Cancel a running user request.- Specified by:
cancel
in interfaceUserRequestHandler
- Parameters:
procInst
- process instance for user requestreason
- reason to cancel the user request
-
cancelByProcessDefinition
public void cancelByProcessDefinition(String processDefinitionId)
Description copied from interface:UserRequestHandler
Cancel all running user requests for the given process definition id.- Specified by:
cancelByProcessDefinition
in interfaceUserRequestHandler
- Parameters:
processDefinitionId
- process definition id
-
cancelByUser
public void cancelByUser(EntityLifecycleEvent<Entity> event)
Description copied from interface:UserRequestHandler
Cancel all running user requests for the user in the given delete event.- Specified by:
cancelByUser
in interfaceUserRequestHandler
- Parameters:
event
- delete event
-
fromFlowableFormType
protected static FormPropertyType fromFlowableFormType(FormType flowableFormType)
-
getForm
protected UserRequestForm getForm(org.flowable.task.api.Task task)
-
getForm
protected UserRequestForm getForm(org.flowable.task.api.Task task, TaskFormData fd)
-
getForm
protected UserRequestForm getForm(org.flowable.task.api.history.HistoricTaskInstance task)
-
getHistoricFormTO
protected UserRequestForm getHistoricFormTO(String procInstId, String taskId, String formKey, List<org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntity> props)
-
getForm
protected UserRequestForm getForm(String procInstId, String taskId, String formKey, List<FormProperty> props)
-
getForm
public UserRequestForm getForm(String userKey, String taskId)
Description copied from interface:UserRequestHandler
Get the form matching the provided task id.- Specified by:
getForm
in interfaceUserRequestHandler
- Parameters:
userKey
- user keytaskId
- task id- Returns:
- the form for the given task id
-
getForms
@Transactional(readOnly=true) public Pair<Integer,List<UserRequestForm>> getForms(String userKey, int page, int size, List<OrderByClause> ob)
Description copied from interface:UserRequestHandler
Get the forms matching the provided parameters.- Specified by:
getForms
in interfaceUserRequestHandler
- Parameters:
userKey
- user key (optional)page
- result pagesize
- items per pageob
- sort conditions- Returns:
- total number of forms, list of forms matching the provided parameters
-
getForms
protected Pair<Integer,List<UserRequestForm>> getForms(org.flowable.task.api.TaskQuery query, int page, int size, List<OrderByClause> orderByClauses)
-
parseTask
protected Pair<org.flowable.task.api.Task,TaskFormData> parseTask(String taskId)
-
getTask
protected org.flowable.task.api.Task getTask(String taskId) throws NotFoundException
- Throws:
NotFoundException
-
claimForm
public UserRequestForm claimForm(String taskId)
Description copied from interface:UserRequestHandler
Claim a form for a given object.- Specified by:
claimForm
in interfaceUserRequestHandler
- Parameters:
taskId
- Workflow task to which the form is associated- Returns:
- updated form
-
unclaimForm
public UserRequestForm unclaimForm(String taskId)
Description copied from interface:UserRequestHandler
Unclaim a form for a given object.- Specified by:
unclaimForm
in interfaceUserRequestHandler
- Parameters:
taskId
- Workflow task to which the form is associated- Returns:
- updated form
-
getPropertiesForSubmit
protected Map<String,String> getPropertiesForSubmit(UserRequestForm form)
-
getHistoricVariable
protected <T> T getHistoricVariable(List<org.flowable.variable.api.history.HistoricVariableInstance> historicVariables, String name, Class<T> valueRef)
-
submitForm
public UserWorkflowResult<UserUR> submitForm(UserRequestForm form)
Description copied from interface:UserRequestHandler
Submit a form.- Specified by:
submitForm
in interfaceUserRequestHandler
- Parameters:
form
- to be submitted- Returns:
- user updated by this form submit
-
-