@RequestMapping( value = "/{topologyId}/workflows/{workflowName}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public RestResponse<Workflow> renameWorkflow( @PathVariable String topologyId, @PathVariable String workflowName, @RequestParam String newName) { Topology topology = topologyServiceCore.getMandatoryTopology(topologyId); topologyService.checkEditionAuthorizations(topology); topologyService.throwsErrorIfReleased(topology); if (topology.getWorkflows().containsKey(newName)) { throw new AlreadyExistException( String.format("The workflow named '%s' already exists", newName)); } Workflow wf = topology.getWorkflows().remove(workflowName); if (wf.isStandard()) { throw new RuntimeException("standard wf can not be renamed"); } wf.setName(newName); topology.getWorkflows().put(newName, wf); alienDAO.save(topology); return RestResponseBuilder.<Workflow>builder().data(wf).build(); }
@RequestMapping( value = "/{topologyId}/workflows", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public RestResponse<Workflow> createWorkflow(@PathVariable String topologyId) { Topology topology = topologyServiceCore.getMandatoryTopology(topologyId); topologyService.checkEditionAuthorizations(topology); topologyService.throwsErrorIfReleased(topology); Workflow wf = workflowBuilderService.ceateWorkflow(topology); alienDAO.save(topology); return RestResponseBuilder.<Workflow>builder().data(wf).build(); }
@RequestMapping( value = "/{topologyId}/workflows/{workflowName}/steps/{stepId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) public RestResponse<Workflow> removeStep( @PathVariable String topologyId, @PathVariable String workflowName, @PathVariable String stepId) { Topology topology = topologyServiceCore.getMandatoryTopology(topologyId); topologyService.checkEditionAuthorizations(topology); topologyService.throwsErrorIfReleased(topology); Workflow wf = workflowBuilderService.removeStep(topology, workflowName, stepId, false); alienDAO.save(topology); return RestResponseBuilder.<Workflow>builder().data(wf).build(); }
@RequestMapping( value = "/{topologyId}/workflows/{workflowName}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) public RestResponse<Void> removeWorkflow( @PathVariable String topologyId, @PathVariable String workflowName) { Topology topology = topologyServiceCore.getMandatoryTopology(topologyId); topologyService.checkEditionAuthorizations(topology); topologyService.throwsErrorIfReleased(topology); Workflow wf = topology.getWorkflows().remove(workflowName); if (wf.isStandard()) { throw new RuntimeException("standard wf can not be removed"); } alienDAO.save(topology); return new RestResponse<Void>(); }
@RequestMapping( value = "/{topologyId}/workflows/{workflowName}/activities", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public RestResponse<Workflow> addActivity( @PathVariable String topologyId, @PathVariable String workflowName, @RequestBody TopologyWorkflowAddActivityRequest activityRequest) { Topology topology = topologyServiceCore.getMandatoryTopology(topologyId); topologyService.checkEditionAuthorizations(topology); topologyService.throwsErrorIfReleased(topology); Workflow wf = workflowBuilderService.addActivity( topology, workflowName, activityRequest.getRelatedStepId(), activityRequest.isBefore(), activityRequest.getActivity()); alienDAO.save(topology); return RestResponseBuilder.<Workflow>builder().data(wf).build(); }