String processInstanceId = task.getProcessInstanceId();
Record record = keyValue.findByRef(processInstanceId);
Map<String, Object> processParameters = new HashMap<String, Object>();
if (record == null) {
new CompleteTaskWithCommentCmd(taskId, processParameters,
OPERATION_COMMENT).execute(commandContext);
return null;
}
// 如果有表单,就从数据库获取数据
for (Prop prop : record.getProps().values()) {
String key = prop.getCode();
String value = prop.getValue();
String formType = this.getFormType(formTypeMap, key);
if ("userpicker".equals(formType)) {
processParameters.put(key,
new ArrayList(Arrays.asList(value.split(","))));
} else if (formType != null) {
processParameters.put(key, value);
}
}
new CompleteTaskWithCommentCmd(taskId, processParameters,
OPERATION_COMMENT).execute(commandContext);
record = new RecordBuilder().build(record, STATUS_RUNNING,
processInstanceId);
keyValue.save(record);