use of org.camunda.bpm.engine.FormService in project camunda-bpm-platform by camunda.
the class MockedProcessEngineProvider method mockServices.
private void mockServices(ProcessEngine engine) {
RepositoryService repoService = mock(RepositoryService.class);
IdentityService identityService = mock(IdentityService.class);
TaskService taskService = mock(TaskService.class);
RuntimeService runtimeService = mock(RuntimeService.class);
FormService formService = mock(FormService.class);
HistoryService historyService = mock(HistoryService.class);
ManagementService managementService = mock(ManagementService.class);
CaseService caseService = mock(CaseService.class);
FilterService filterService = mock(FilterService.class);
ExternalTaskService externalTaskService = mock(ExternalTaskService.class);
when(engine.getRepositoryService()).thenReturn(repoService);
when(engine.getIdentityService()).thenReturn(identityService);
when(engine.getTaskService()).thenReturn(taskService);
when(engine.getRuntimeService()).thenReturn(runtimeService);
when(engine.getFormService()).thenReturn(formService);
when(engine.getHistoryService()).thenReturn(historyService);
when(engine.getManagementService()).thenReturn(managementService);
when(engine.getCaseService()).thenReturn(caseService);
when(engine.getFilterService()).thenReturn(filterService);
when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
use of org.camunda.bpm.engine.FormService in project camunda-bpm-platform by camunda.
the class ProcessDefinitionResourceImpl method getRenderedForm.
public Response getRenderedForm() {
FormService formService = engine.getFormService();
Object startForm = formService.getRenderedStartForm(processDefinitionId);
if (startForm != null) {
String content = startForm.toString();
InputStream stream = new ByteArrayInputStream(content.getBytes(EncodingUtil.DEFAULT_ENCODING));
return Response.ok(stream).type(MediaType.APPLICATION_XHTML_XML).build();
}
throw new InvalidRequestException(Status.NOT_FOUND, "No matching rendered start form for process definition with the id " + processDefinitionId + " found.");
}
use of org.camunda.bpm.engine.FormService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method getFormVariables.
public Map<String, VariableValueDto> getFormVariables(String variableNames, boolean deserializeValues) {
final FormService formService = engine.getFormService();
List<String> formVariables = null;
if (variableNames != null) {
StringListConverter stringListConverter = new StringListConverter();
formVariables = stringListConverter.convertQueryParameterToType(variableNames);
}
VariableMap startFormVariables = formService.getTaskFormVariables(taskId, formVariables, deserializeValues);
return VariableValueDto.fromVariableMap(startFormVariables);
}
use of org.camunda.bpm.engine.FormService in project camunda-bpm-platform by camunda.
the class TaskResourceImpl method submit.
public void submit(CompleteTaskDto dto) {
FormService formService = engine.getFormService();
try {
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
formService.submitTaskForm(taskId, variables);
} catch (RestException e) {
String errorMessage = String.format("Cannot submit task form %s: %s", taskId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
} catch (AuthorizationException e) {
throw e;
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot submit task form %s: %s", taskId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
Aggregations