use of org.activiti.engine.form.FormData in project Activiti by Activiti.
the class FormDataResource method getFormData.
@RequestMapping(value = "/form/form-data", method = RequestMethod.GET, produces = "application/json")
public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId, @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request) {
if (taskId == null && processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("The taskId or processDefinitionId parameter has to be provided");
}
if (taskId != null && processDefinitionId != null) {
throw new ActivitiIllegalArgumentException("Not both a taskId and a processDefinitionId parameter can be provided");
}
FormData formData = null;
String id = null;
if (taskId != null) {
formData = formService.getTaskFormData(taskId);
id = taskId;
} else {
formData = formService.getStartFormData(processDefinitionId);
id = processDefinitionId;
}
if (formData == null) {
throw new ActivitiObjectNotFoundException("Could not find a form data with id '" + id + "'.", FormData.class);
}
return restResponseFactory.createFormDataResponse(formData);
}
Aggregations