Package org.appng.camunda.bpm
Class TaskWrapper
- java.lang.Object
-
- org.appng.camunda.bpm.TaskWrapper
-
- All Implemented Interfaces:
org.camunda.bpm.engine.task.Task
public class TaskWrapper extends Object implements org.camunda.bpm.engine.task.Task
A wrapper for aTask
, providing the ability of dynamically addingFieldDef
initions based on theTaskFormData
that has been defined for that task.
This class can easily be used as the bind-class of an appNGDatasource
.- Author:
- Matthias Müller
-
-
Constructor Summary
Constructors Constructor Description TaskWrapper()
TaskWrapper(org.camunda.bpm.engine.task.Task task, Collection<org.camunda.bpm.engine.task.IdentityLink> identityLinks, org.camunda.bpm.engine.variable.VariableMap variables)
Create a newTaskWrapper
from the givenTask
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFormFields(FieldProcessor fp, org.camunda.bpm.engine.form.TaskFormData taskFormData, String mandatoryMessage)
Dynamically addsFieldDef
initions to the givenFieldProcessor
, depending on theFormField
s defined at theTaskFormData
.protected void
addValidation(FieldDef field, org.camunda.bpm.engine.form.FormFieldValidationConstraint validationConstraint, String mandatoryMessage)
protected void
determineFieldType(org.camunda.bpm.engine.form.FormType type, FieldDef field)
Object
getFormField(String name)
void
validate(Site site, Application application, Environment environment, Options options, Request request, FieldProcessor fp, org.camunda.bpm.engine.form.TaskFormData taskFormData, String requiredMessage)
Validates thisTaskWrapper
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.task.Task
delegate, getAssignee, getCaseDefinitionId, getCaseExecutionId, getCaseInstanceId, getCreateTime, getDelegationState, getDescription, getDueDate, getExecutionId, getFollowUpDate, getFormKey, getId, getName, getOwner, getParentTaskId, getPriority, getProcessDefinitionId, getProcessInstanceId, getTaskDefinitionKey, getTenantId, isSuspended, setAssignee, setCaseInstanceId, setDelegationState, setDescription, setDueDate, setFollowUpDate, setName, setOwner, setParentTaskId, setPriority, setTenantId
-
-
-
-
Constructor Detail
-
TaskWrapper
public TaskWrapper()
-
TaskWrapper
public TaskWrapper(org.camunda.bpm.engine.task.Task task, Collection<org.camunda.bpm.engine.task.IdentityLink> identityLinks, org.camunda.bpm.engine.variable.VariableMap variables)
Create a newTaskWrapper
from the givenTask
- Parameters:
task
- theTask
to wrap, retrieved from aTaskService
identityLinks
- theIdentityLink
s for the task, usually retrieved withTaskService.getIdentityLinksForTask(String)
variables
- the variables for thisTask
, usually retrieved withTaskService.getVariablesTyped(String)
-
-
Method Detail
-
addFormFields
public void addFormFields(FieldProcessor fp, org.camunda.bpm.engine.form.TaskFormData taskFormData, String mandatoryMessage)
Dynamically addsFieldDef
initions to the givenFieldProcessor
, depending on theFormField
s defined at theTaskFormData
.- Parameters:
fp
- theFieldProcessor
taskFormData
- theTaskFormData
to dynamically add the fields frommandatoryMessage
- the message in case a field id mandatory
-
addValidation
protected void addValidation(FieldDef field, org.camunda.bpm.engine.form.FormFieldValidationConstraint validationConstraint, String mandatoryMessage)
-
determineFieldType
protected void determineFieldType(org.camunda.bpm.engine.form.FormType type, FieldDef field)
-
validate
public void validate(Site site, Application application, Environment environment, Options options, Request request, FieldProcessor fp, org.camunda.bpm.engine.form.TaskFormData taskFormData, String requiredMessage)
Validates thisTaskWrapper
. Therefore, theFormField
s returned by theTaskFormData
are checked forFormFieldValidationConstraint
s. If there is arequired
constraint, and the value returned bygetFormField(String)
isnull
or empty for the givenFormField
, an error-message as append to theFieldDef
inition of that field.- Parameters:
site
- the currentSite
application
- the currentApplication
environment
- the currentEnvironment
options
- the currentOptions
request
- the currentRequest
fp
- the currentFieldProcessor
taskFormData
- the currentTaskFormData
requiredMessage
- the currentSite
-
-