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 StringadminUserprotected UserDataBinderdataBinderprotected DomainProcessEngineengineprotected EntityFactoryentityFactoryprotected static LoggerLOGprotected UserDAOuserDAO
-
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 voidcancel(org.flowable.engine.runtime.ProcessInstance procInst, String reason)Cancel a running user request.voidcancelByProcessDefinition(String processDefinitionId)Cancel all running user requests for the given process definition id.voidcancelByUser(EntityLifecycleEvent<Entity> event)Cancel all running user requests for the user in the given delete event.UserRequestFormclaimForm(String taskId)Claim a form for a given object.protected intcountProcessInstances(StringBuilder processInstanceQuery)protected StringBuildercreateProcessInstanceQuery(String userKey)protected static FormPropertyTypefromFlowableFormType(org.flowable.engine.form.FormType flowableFormType)UserRequestFormgetForm(String userKey, String taskId)Get the form matching the provided task id.protected UserRequestFormgetForm(String procInstId, String taskId, String formKey, List<org.flowable.engine.form.FormProperty> props)protected UserRequestFormgetForm(org.flowable.task.api.history.HistoricTaskInstance task)protected UserRequestFormgetForm(org.flowable.task.api.Task task)protected UserRequestFormgetForm(org.flowable.task.api.Task task, org.flowable.engine.form.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 UserRequestFormgetHistoricFormTO(String procInstId, String taskId, String formKey, List<org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntity> props)protected <T> TgetHistoricVariable(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.TaskgetTask(String taskId)protected StringgetUserKey(String procInstId)protected UserRequestgetUserRequest(org.flowable.engine.runtime.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 UserlazyLoad(User user)Pair<org.flowable.engine.runtime.ProcessInstance,String>parse(String executionId)Parses the given execution id to find matching user request and owner.protected Pair<org.flowable.task.api.Task,org.flowable.engine.form.TaskFormData>parseTask(String taskId)UserRequeststart(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.UserRequestFormunclaimForm(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(org.flowable.engine.runtime.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:UserRequestHandlerGet the running user requests matching the provided parameters.- Specified by:
getUserRequestsin 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:UserRequestHandlerStarts a new user request, for the given BPMN process and user.- Specified by:
startin interfaceUserRequestHandler- Parameters:
bpmnProcess- BPMN processuser- userinputVariables- variables- Returns:
- data about the started request service, including execution id
-
parse
public Pair<org.flowable.engine.runtime.ProcessInstance,String> parse(String executionId)
Description copied from interface:UserRequestHandlerParses the given execution id to find matching user request and owner.- Specified by:
parsein interfaceUserRequestHandler- Parameters:
executionId- execution id- Returns:
- matching user request and owner
-
cancel
public void cancel(org.flowable.engine.runtime.ProcessInstance procInst, String reason)Description copied from interface:UserRequestHandlerCancel a running user request.- Specified by:
cancelin interfaceUserRequestHandler- Parameters:
procInst- process instance for user requestreason- reason to cancel the user request
-
cancelByProcessDefinition
public void cancelByProcessDefinition(String processDefinitionId)
Description copied from interface:UserRequestHandlerCancel all running user requests for the given process definition id.- Specified by:
cancelByProcessDefinitionin interfaceUserRequestHandler- Parameters:
processDefinitionId- process definition id
-
cancelByUser
public void cancelByUser(EntityLifecycleEvent<Entity> event)
Description copied from interface:UserRequestHandlerCancel all running user requests for the user in the given delete event.- Specified by:
cancelByUserin interfaceUserRequestHandler- Parameters:
event- delete event
-
fromFlowableFormType
protected static FormPropertyType fromFlowableFormType(org.flowable.engine.form.FormType flowableFormType)
-
getForm
protected UserRequestForm getForm(org.flowable.task.api.Task task)
-
getForm
protected UserRequestForm getForm(org.flowable.task.api.Task task, org.flowable.engine.form.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<org.flowable.engine.form.FormProperty> props)
-
getForm
public UserRequestForm getForm(String userKey, String taskId)
Description copied from interface:UserRequestHandlerGet the form matching the provided task id.- Specified by:
getFormin 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:UserRequestHandlerGet the forms matching the provided parameters.- Specified by:
getFormsin 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,org.flowable.engine.form.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:UserRequestHandlerClaim a form for a given object.- Specified by:
claimFormin interfaceUserRequestHandler- Parameters:
taskId- Workflow task to which the form is associated- Returns:
- updated form
-
unclaimForm
public UserRequestForm unclaimForm(String taskId)
Description copied from interface:UserRequestHandlerUnclaim a form for a given object.- Specified by:
unclaimFormin 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:UserRequestHandlerSubmit a form.- Specified by:
submitFormin interfaceUserRequestHandler- Parameters:
form- to be submitted- Returns:
- user updated by this form submit
-
-