Skip to content

Commit

Permalink
gbif#48 Fix mappings in PipelinesHistoryResource
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-podolskiy90 committed Feb 27, 2020
1 parent 41c4ab5 commit 5da61ab
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@
@RequestMapping(value = "pipelines/history", produces = MediaType.APPLICATION_JSON_VALUE)
public class PipelinesHistoryResource {

private static final String PROCESS_PATH = "process/";
private static final String RUN_PATH = "run/";

private final PipelinesHistoryTrackingService historyTrackingService;

public PipelinesHistoryResource(PipelinesHistoryTrackingService historyTrackingService) {
Expand All @@ -91,7 +88,7 @@ public PipelineProcess getPipelineProcess(
return historyTrackingService.get(datasetKey, attempt);
}

@PostMapping(value = PROCESS_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "process", consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public long createPipelineProcess(
@RequestBody @NotNull PipelineProcessParameters params, Authentication authentication) {
Expand All @@ -100,7 +97,7 @@ public long createPipelineProcess(
}

/** Adds a new pipeline execution. */
@PostMapping(value = PROCESS_PATH + "{processKey}", consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "process/{processKey}", consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public long addPipelineExecution(
@PathVariable("processKey") long processKey,
Expand All @@ -112,7 +109,7 @@ public long addPipelineExecution(

/** Adds a new pipeline step. */
@PostMapping(
value = PROCESS_PATH + "{processKey}/{executionKey}",
value = "process/{processKey}/{executionKey}",
consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public long addPipelineStep(
Expand All @@ -124,7 +121,7 @@ public long addPipelineStep(
processKey, executionKey, pipelineStep, authentication.getName());
}

@GetMapping(PROCESS_PATH + "{processKey}/{executionKey}/{stepKey}")
@GetMapping("process/{processKey}/{executionKey}/{stepKey}")
public PipelineStep getPipelineStep(
@PathVariable("processKey") long processKey,
@PathVariable("executionKey") long executionKey,
Expand All @@ -134,7 +131,7 @@ public PipelineStep getPipelineStep(

/** Updates the step status. */
@PutMapping(
value = PROCESS_PATH + "{processKey}/{executionKey}/{stepKey}",
value = "process/{processKey}/{executionKey}/{stepKey}",
consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_PLAIN_VALUE})
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public void updatePipelineStepStatusAndMetrics(
Expand All @@ -157,7 +154,7 @@ public void updatePipelineStepStatusAndMetrics(
* will be validated in PipelinesHistoryResource#checkRunInputParams so here they are specified as
* optional fields.
*/
@PostMapping(value = RUN_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "run", consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public ResponseEntity<RunPipelineResponse> runAll(
@RequestParam(value = "steps", required = false) String steps,
Expand All @@ -182,7 +179,7 @@ public ResponseEntity<RunPipelineResponse> runAll(
* but they will be validated in PipelinesHistoryResource#checkRunInputParams so here they are
* specified as optional fields.
*/
@PostMapping(value = RUN_PATH + "{datasetKey}")
@PostMapping(value = "run/{datasetKey}", consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public ResponseEntity<RunPipelineResponse> runPipelineAttempt(
@PathVariable("datasetKey") UUID datasetKey,
Expand All @@ -202,7 +199,7 @@ public ResponseEntity<RunPipelineResponse> runPipelineAttempt(
* validated in PipelinesHistoryResource#checkRunInputParams so here they are specified as
* optional fields.
*/
@PostMapping(value = RUN_PATH + "{datasetKey}/{attempt}")
@PostMapping(value = "run/{datasetKey}/{attempt}", consumes = MediaType.APPLICATION_JSON_VALUE)
@Secured({ADMIN_ROLE, EDITOR_ROLE})
public ResponseEntity<RunPipelineResponse> runPipelineAttempt(
@PathVariable("datasetKey") UUID datasetKey,
Expand Down

0 comments on commit 5da61ab

Please sign in to comment.