TSK-1430: further grouped and renamed endpoints

This commit is contained in:
Mustapha Zorgati 2020-10-29 18:21:01 +01:00
parent 4561e6c4f9
commit fbc623bd31
3 changed files with 35 additions and 23 deletions

View File

@ -5,29 +5,39 @@ public final class RestEndpoints {
public static final String API_V1 = "/api/v1/";
// configuration endpoints
public static final String URL_VERSION = API_V1 + "version";
public static final String URL_DOMAIN = API_V1 + "domains";
public static final String URL_CURRENT_USER = API_V1 + "current-user-info";
public static final String URL_ACCESS_ID = API_V1 + "access-ids";
public static final String URL_ACCESS_ID_GROUPS = API_V1 + "access-ids/groups";
public static final String URL_CLASSIFICATIONS = API_V1 + "classifications";
public static final String URL_CLASSIFICATIONS_ID = API_V1 + "classifications/{classificationId}";
public static final String URL_CLASSIFICATION_DEFINITIONS = API_V1 + "classification-definitions";
public static final String URL_CLASSIFICATION_CATEGORIES = API_V1 + "classification-categories";
public static final String URL_CLASSIFICATION_TYPES = API_V1 + "classification-types";
public static final String URL_CLASSIFICATION_CATEGORIES_BY_TYPES =
API_V1 + "classifications-by-type";
public static final String URL_WORKBASKET_ACCESS_ITEMS = API_V1 + "workbasket-access-items";
public static final String URL_WORKBASKET = API_V1 + "workbaskets";
// access id endpoints
public static final String URL_ACCESS_ID = API_V1 + "access-ids";
public static final String URL_ACCESS_ID_GROUPS = API_V1 + "access-ids/groups";
// import / export endpoints
public static final String URL_CLASSIFICATION_DEFINITIONS = API_V1 + "classification-definitions";
public static final String URL_WORKBASKET_DEFINITIONS = API_V1 + "workbasket-definitions";
// classification endpoints
public static final String URL_CLASSIFICATIONS = API_V1 + "classifications";
public static final String URL_CLASSIFICATIONS_ID = API_V1 + "classifications/{classificationId}";
// workbasket endpoints
public static final String URL_WORKBASKET = API_V1 + "workbaskets";
public static final String URL_WORKBASKET_ID = API_V1 + "workbaskets/{workbasketId}";
public static final String URL_WORKBASKET_ID_ACCESS_ITEMS =
API_V1 + "workbaskets/{workbasketId}/workbasketAccessItems";
public static final String URL_WORKBASKET_ID_DISTRIBUTION =
API_V1 + "workbaskets/{workbasketId}/distribution-targets";
// access item endpoints
public static final String URL_WORKBASKET_ACCESS_ITEMS = API_V1 + "workbasket-access-items";
// task endpoints
public static final String URL_TASKS = API_V1 + "tasks";
public static final String URL_TASKS_ID = API_V1 + "tasks/{taskId}";
public static final String URL_TASKS_ID_CLAIM = API_V1 + "tasks/{taskId}/claim";
@ -36,18 +46,20 @@ public final class RestEndpoints {
public static final String URL_TASKS_ID_TRANSFER_WORKBASKET_ID =
API_V1 + "tasks/{taskId}/transfer/{workbasketId}";
// task comment endpoints
public static final String URL_TASK_COMMENTS = API_V1 + "tasks/{taskId}/comments";
public static final String URL_TASK_COMMENT = API_V1 + "tasks/comments/{taskCommentId}";
public static final String URL_MONITOR = API_V1 + "monitor";
public static final String URL_MONITOR_TASKS_STATUS = API_V1 + "monitor/tasks-status-report";
public static final String URL_MONITOR_TASKS_WORKBASKET =
// monitor endpoints
public static final String URL_MONITOR_TASKS_STATUS_REPORT =
API_V1 + "monitor/tasks-status-report";
public static final String URL_MONITOR_TASKS_WORKBASKET_REPORT =
API_V1 + "monitor/tasks-workbasket-report";
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED =
public static final String URL_MONITOR_TASKS_WORKBASKET_PLANNED_REPORT =
API_V1 + "monitor/tasks-workbasket-planned-date-report";
public static final String URL_MONITOR_TASKS_CLASSIFICATION =
public static final String URL_MONITOR_TASKS_CLASSIFICATION_REPORT =
API_V1 + "monitor/tasks-classification-report";
public static final String URL_MONITOR_TIMESTAMP = API_V1 + "monitor/timestamp-report";
public static final String URL_MONITOR_TIMESTAMP_REPORT = API_V1 + "monitor/timestamp-report";
public static final String URL_HISTORY_ENABLED = API_V1 + "history-provider-enabled";
public static final String URL_HISTORY_EVENTS = API_V1 + "task-history-event";

View File

@ -45,7 +45,7 @@ public class MonitorController {
this.reportRepresentationModelAssembler = reportRepresentationModelAssembler;
}
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_STATUS)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksStatusReport(
@RequestParam(required = false) List<String> domains,
@ -69,7 +69,7 @@ public class MonitorController {
return response;
}
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketReport(
@RequestParam(value = "states") List<TaskState> states)
@ -92,7 +92,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET_PLANNED)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_WORKBASKET_PLANNED_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksWorkbasketPlannedDateReport(
@RequestParam(value = "daysInPast") int daysInPast,
@ -120,7 +120,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION)
@GetMapping(path = RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getTasksClassificationReport()
throws NotAuthorizedException, InvalidArgumentException {
@ -140,7 +140,7 @@ public class MonitorController {
return ResponseEntity.status(HttpStatus.OK).body(report);
}
@GetMapping(path = RestEndpoints.URL_MONITOR_TIMESTAMP)
@GetMapping(path = RestEndpoints.URL_MONITOR_TIMESTAMP_REPORT)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ReportRepresentationModel> getDailyEntryExitReport()
throws NotAuthorizedException, InvalidArgumentException {

View File

@ -54,7 +54,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS))
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT))
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(
@ -67,7 +67,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_WORKBASKET)
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_WORKBASKET_REPORT)
+ "?daysInPast=4&states=READY,CLAIMED,COMPLETED")
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
@ -82,7 +82,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION))
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_CLASSIFICATION_REPORT))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())
@ -96,7 +96,7 @@ class MonitorControllerRestDocumentation extends BaseRestDocumentation {
this.mockMvc
.perform(
RestDocumentationRequestBuilders.get(
restHelper.toUrl(RestEndpoints.URL_MONITOR_TIMESTAMP))
restHelper.toUrl(RestEndpoints.URL_MONITOR_TIMESTAMP_REPORT))
.accept("application/hal+json")
.header("Authorization", ADMIN_CREDENTIALS))
.andExpect(MockMvcResultMatchers.status().isOk())