AnsweredAssumed Answered

FormService should be support for Object type value

Question asked by kafeitu on Oct 14, 2012
Latest reply on Oct 15, 2012 by kafeitu
ProcessInstance   submitStartFormData(String processDefinitionId, Map<String,String> properties)
          Start a new process instance with the user data that was entered as properties in a start form.

ProcessInstance   submitStartFormData(String processDefinitionId, String businessKey, Map<String,String> properties)
          Start a new process instance with the user data that was entered as properties in a start form.

void   submitTaskFormData(String taskId, Map<String,String> properties)
          Completes a task with the user data that was entered as properties in a task form.

Now, use FormService to submit datas that should be String, why not support for Object?

For example, start a process instance that contains a multi instance task, and the Collections use expression ${users}. So use code of below to start a process instance.


String users = "user1,user2,user3,user4";
    String processDefinitionId = processDefinition.getId();
   
    Map<String, String> formProperties = new HashMap<String, String>();
    formProperties.put("countersignUsers", users);
   
    ProcessInstance processInstance = formService.submitStartFormData(processDefinitionId, formProperties);

Then occur a exception: org.activiti.engine.ActivitiException: ${countersignUsers}' didn't resolve to a Collection

——————-
Use RuntimeService.startProcessInstanceBy* method are ok.


    Map<String, Object> variableMap = new HashMap<String, Object>();

    List<String> users = Arrays.asList("user1", "user2", "user3", "user4");
    variableMap.put("countersignUsers", users);
    variableMap.put("rate", rate);

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dispatch", variableMap);
    assertNotNull(processInstance.getId()); // it's ok

So, i hope on the FormService's method that name start with submit to support Object type value.

JIRA: http://jira.codehaus.org/browse/ACT-1412

—————
I created a branch form-properties-support-object-value, details: https://github.com/henryyan/Activiti/commit/15f86de0b6d6e0eea3488c0da621f76647871174
All unit tests valid and my question has been resolved too.

Outcomes