Source:
public ProcessDefinitionMetaResource getProcessDefinitionMetadata(@PathVariable String id) { org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionId(id) .singleResult(); if (processDefinition == null) { throw new ActivitiException("Unable to find process definition for the given id:'" + id + "'"); } List<Process> processes = repositoryService.getBpmnModel(id).getProcesses(); HashSet<ProcessDefinitionVariable> variables = new HashSet<ProcessDefinitionVariable>(); HashSet<String> users = new HashSet<String>(); HashSet<String> groups = new HashSet<String>(); HashSet<ProcessDefinitionUserTask> userTasks = new HashSet<ProcessDefinitionUserTask>(); HashSet<ProcessDefinitionServiceTask> serviceTasks = new HashSet<ProcessDefinitionServiceTask>(); for (Process process : processes) { variables.addAll(getVariables(process)); List<FlowElement> flowElementList = (List<FlowElement>) process.getFlowElements(); for (FlowElement flowElement : flowElementList) { if (flowElement.getClass().equals(UserTask.class)) { UserTask userTask = (UserTask) flowElement; ProcessDefinitionUserTask task = new ProcessDefinitionUserTask(userTask.getName(), userTask.getDocumentation()); userTasks.add(task); users.addAll(userTask.getCandidateUsers()); groups.addAll(userTask.getCandidateGroups()); } if (flowElement.getClass().equals(ServiceTask.class)) { ServiceTask serviceTask = (ServiceTask) flowElement; ProcessDefinitionServiceTask task = new ProcessDefinitionServiceTask(serviceTask.getName(), serviceTask.getImplementation()); serviceTasks.add(task); } } } return resourceAssembler.toResource(new ProcessDefinitionMeta(processDefinition.getId(), processDefinition.getName(), processDefinition.getDescription(), processDefinition.getVersion(), users, groups, variables, userTasks, serviceTasks)); }

Target:
public ProcessDefinitionMetaResource getProcessDefinitionMetadata(@PathVariable String id) { org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionId(id) .singleResult(); if (processDefinition == null) { throw new ActivitiException("Unable to find process definition for the given id:'" + id + "'"); } List<Process> processes = repositoryService.getBpmnModel(id).getProcesses(); Set<ProcessDefinitionVariable> variables = new HashSet<ProcessDefinitionVariable>(); Set<String> users = new HashSet<String>(); Set<String> groups = new HashSet<String>(); Set<ProcessDefinitionUserTask> userTasks = new HashSet<ProcessDefinitionUserTask>(); Set<ProcessDefinitionServiceTask> serviceTasks = new HashSet<ProcessDefinitionServiceTask>(); for (Process process : processes) { variables.addAll(getVariables(process)); List<FlowElement> flowElementList = (List<FlowElement>) process.getFlowElements(); for (FlowElement flowElement : flowElementList) { if (flowElement.getClass().equals(UserTask.class)) { UserTask userTask = (UserTask) flowElement; ProcessDefinitionUserTask task = new ProcessDefinitionUserTask(userTask.getName(), userTask.getDocumentation()); userTasks.add(task); users.addAll(userTask.getCandidateUsers()); groups.addAll(userTask.getCandidateGroups()); } if (flowElement.getClass().equals(ServiceTask.class)) { ServiceTask serviceTask = (ServiceTask) flowElement; ProcessDefinitionServiceTask task = new ProcessDefinitionServiceTask(serviceTask.getName(), serviceTask.getImplementation()); serviceTasks.add(task); } } } return resourceAssembler.toResource(new ProcessDefinitionMeta(processDefinition.getId(), processDefinition.getName(), processDefinition.getDescription(), processDefinition.getVersion(), users, groups, variables, userTasks, serviceTasks)); }