Class 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 a Task, providing the ability of dynamically adding FieldDefinitions based on the TaskFormData that has been defined for that task.
    This class can easily be used as the bind-class of an appNG Datasource.
    Author:
    Matthias Müller
    • Field Summary

      • Fields inherited from interface org.camunda.bpm.engine.task.Task

        PRIORITY_MAXIMUM, PRIORITY_MINIUM, PRIORITY_NORMAL
    • 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 new TaskWrapper from the given Task
    • 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 new TaskWrapper from the given Task
        Parameters:
        task - the Task to wrap, retrieved from a TaskService
        identityLinks - the IdentityLinks for the task, usually retrieved with TaskService.getIdentityLinksForTask(String)
        variables - the variables for this Task, usually retrieved with TaskService.getVariablesTyped(String)
    • Method Detail

      • addFormFields

        public void addFormFields​(FieldProcessor fp,
                                  org.camunda.bpm.engine.form.TaskFormData taskFormData,
                                  String mandatoryMessage)
        Dynamically adds FieldDefinitions to the given FieldProcessor, depending on the FormFields defined at the TaskFormData.
        Parameters:
        fp - the FieldProcessor
        taskFormData - the TaskFormData to dynamically add the fields from
        mandatoryMessage - 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 this TaskWrapper. Therefore, the FormFields returned by the TaskFormData are checked for FormFieldValidationConstraints. If there is a required constraint, and the value returned by getFormField(String) is null or empty for the given FormField, an error-message as append to the FieldDefinition of that field.
        Parameters:
        site - the current Site
        application - the current Application
        environment - the current Environment
        options - the current Options
        request - the current Request
        fp - the current FieldProcessor
        taskFormData - the current TaskFormData
        requiredMessage - the current Site
      • getFormField

        public Object getFormField​(String name)