@RequestMapping(value = "/{journalTrackId}/journalStep", method = RequestMethod.GET) @PreAuthorize(Permission.SECURITY_REFERENCE_READ) public @ResponseBody PagedResponse<JournalStepTO> getAllForJournalTrack( final @PathVariable UUID journalTrackId, final @RequestParam(required = false) ObjectStatus status, final @RequestParam(required = false) Integer start, final @RequestParam(required = false) Integer limit, final @RequestParam(required = false) String sort, final @RequestParam(required = false) String sortDirection) throws ObjectNotFoundException { final JournalTrack journalTrack = getService().get(journalTrackId); SortingAndPaging sAndP = null; if (limit != null) { sAndP = SortingAndPaging.createForSingleSortWithPaging( status, start, limit, sort, sortDirection, "sortOrder"); } else { if (sort == null || sort.length() == 0) sAndP = SortingAndPaging.createForSingleSortAll(status, "sortOrder", sortDirection); else sAndP = SortingAndPaging.createForSingleSortAll(status, sort, sortDirection); } final PagingWrapper<JournalStep> data = journalStepService.getAllForJournalTrack(journalTrack, sAndP); return new PagedResponse<JournalStepTO>( true, data.getResults(), journalStepFactory.asTOList(data.getRows())); }
@RequestMapping(value = "/{id}/journalStep", method = RequestMethod.DELETE) public @ResponseBody ServiceResponse removeJournalStepFromJournalTrack( @PathVariable final UUID id, @RequestBody @NotNull final UUID journalStepId) throws ObjectNotFoundException { final JournalStep journalStep = journalStepService.get(journalStepId); final JournalTrack journalTrack = service.get(id); service.removeJournalStepFromJournalTrack(journalStep, journalTrack); return new ServiceResponse(true); }
@RequestMapping(value = "/{id}/journalStep", method = RequestMethod.POST) public @ResponseBody ServiceResponse addJournalStepToJournalTrack( @PathVariable final UUID id, @RequestBody @NotNull final JournalAssociationTO journalAssociation) throws ObjectNotFoundException { final JournalStep journalStep = journalStepService.get(journalAssociation.getId()); final JournalTrack journalTrack = service.get(id); service.addJournalStepToJournalTrack( journalStep, journalTrack, journalAssociation.getSortOrder()); return new ServiceResponse(true); }