aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
diff options
context:
space:
mode:
authormicdzied <michal.1.dziedzic@nokia.com>2018-05-07 08:42:44 +0200
committermicdzied <michal.1.dziedzic@nokia.com>2018-05-07 12:43:40 +0200
commit7e7aa0c165665f74b628ba5c95fb3cdae72f4449 (patch)
tree737fe8068a44e7e297c305af1ff699b1f53a7c5e /prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
parentee36c363b3c90055d9b10059775a9d54a76f767a (diff)
creating swagger documentation
Change-Id: I8ca3faf2e6afb7add2785add2ac9096ded98f591 Issue-ID: DCAEGEN2-468 Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
Diffstat (limited to 'prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
index 733b7dfc..60572cb3 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
@@ -19,6 +19,8 @@
*/
package org.onap.dcaegen2.services.prh.controllers;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@@ -44,6 +46,7 @@ import reactor.core.publisher.Mono;
*/
@RestController
@Component
+@Api(value = "ScheduleController", description = "Schedule Controller")
public class ScheduleController {
private static final Logger logger = LoggerFactory.getLogger(PrhAppConfig.class);
@@ -62,17 +65,20 @@ public class ScheduleController {
}
@RequestMapping(value = "start", method = RequestMethod.GET)
+ @ApiOperation(value = "Start scheduling worker request")
public Mono<ResponseEntity<String>> startTasks() {
logDebug("Starting scheduling worker request on on thread={} , time={} ");
return Mono.fromSupplier(this::tryToStartTask).map(this::createStartTaskResponse);
}
@RequestMapping(value = "stopPrh", method = RequestMethod.GET)
+ @ApiOperation(value = "Stop scheduling worker request")
public Mono<ResponseEntity<String>> stopTask() {
logDebug("Stopping scheduling worker request on on thread={} , time={} ");
return getResponseFromCancellationOfTasks();
}
+ @ApiOperation(value = "Get response on stopping task execution")
private synchronized Mono<ResponseEntity<String>> getResponseFromCancellationOfTasks() {
scheduledFutureList.forEach(x -> x.cancel(false));
scheduledFutureList.clear();
@@ -82,6 +88,7 @@ public class ScheduleController {
});
}
+ @ApiOperation(value = "Start task if possible")
private synchronized boolean tryToStartTask() {
if (scheduledFutureList.isEmpty()) {
scheduledFutureList.add(taskScheduler
@@ -93,6 +100,7 @@ public class ScheduleController {
}
+ @ApiOperation(value = "Sends success or error response on starting task execution")
private ResponseEntity<String> createStartTaskResponse(boolean wasScheduled) {
if (wasScheduled) {
logDebug("Sending success response on starting task execution thread={} , time={} ");