aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/org/onap/portal
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/onap/portal')
-rw-r--r--app/src/main/java/org/onap/portal/history/HistoryApplication.java (renamed from app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java)8
-rw-r--r--app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java (renamed from app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java)4
-rw-r--r--app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java11
-rw-r--r--app/src/main/java/org/onap/portal/history/controller/ActionsController.java14
-rw-r--r--app/src/main/java/org/onap/portal/history/util/Logger.java6
5 files changed, 21 insertions, 22 deletions
diff --git a/app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java b/app/src/main/java/org/onap/portal/history/HistoryApplication.java
index 0e712f2..21c3c4b 100644
--- a/app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java
+++ b/app/src/main/java/org/onap/portal/history/HistoryApplication.java
@@ -25,15 +25,15 @@
package org.onap.portal.history;
-import org.onap.portal.history.configuration.PortalHistoryConfig;
+import org.onap.portal.history.configuration.HistoryConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
-@EnableConfigurationProperties(PortalHistoryConfig.class)
+@EnableConfigurationProperties(HistoryConfig.class)
@SpringBootApplication
-public class PortalHistoryApplication {
+public class HistoryApplication {
public static void main(String[] args) {
- SpringApplication.run(PortalHistoryApplication.class, args);
+ SpringApplication.run(HistoryApplication.class, args);
}
}
diff --git a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java b/app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java
index 9a42214..f70a9d4 100644
--- a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java
+++ b/app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java
@@ -27,8 +27,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import jakarta.validation.constraints.NotBlank;
@Data
-@ConfigurationProperties("portal-history")
-public class PortalHistoryConfig {
+@ConfigurationProperties("history")
+public class HistoryConfig {
@NotBlank
private final Integer saveInterval;
diff --git a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
index 2295a5f..88531af 100644
--- a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
+++ b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
@@ -23,7 +23,6 @@ package org.onap.portal.history.configuration;
import org.onap.portal.history.services.ActionsService;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -34,20 +33,20 @@ import org.springframework.stereotype.Component;
public class SchedulerConfig {
private final ActionsService actionsService;
- private final PortalHistoryConfig portalHistoryConfig;
+ private final HistoryConfig historyConfig;
- public SchedulerConfig(ActionsService actionsService, PortalHistoryConfig portalHistoryConfig){
+ public SchedulerConfig(ActionsService actionsService, HistoryConfig historyConfig){
this.actionsService = actionsService;
- this.portalHistoryConfig = portalHistoryConfig;
+ this.historyConfig = historyConfig;
}
/**
* This method will be trigger by Spring Boot scheduler.
* The cron execution time is configured in the application properties as well as the save interval.
*/
- @Scheduled(cron="${portal-history.delete-interval}")
+ @Scheduled(cron="${history.delete-interval}")
public void runDeleteActions(){
- actionsService.deleteActions(portalHistoryConfig.getSaveInterval());
+ actionsService.deleteActions(historyConfig.getSaveInterval());
log.info("Delete actions in scheduled job");
}
}
diff --git a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
index 8339d65..ce781f5 100644
--- a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
+++ b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
@@ -23,7 +23,7 @@ package org.onap.portal.history.controller;
import java.util.Optional;
-import org.onap.portal.history.configuration.PortalHistoryConfig;
+import org.onap.portal.history.configuration.HistoryConfig;
import org.onap.portal.history.openapi.api.ActionsApi;
import org.onap.portal.history.openapi.model.ActionResponse;
import org.onap.portal.history.openapi.model.ActionsListResponse;
@@ -40,11 +40,11 @@ import reactor.core.publisher.Mono;
public class ActionsController implements ActionsApi {
private final ActionsService actionsService;
- private final PortalHistoryConfig portalHistoryConfig;
+ private final HistoryConfig historyConfig;
- public ActionsController(ActionsService actionsService, PortalHistoryConfig portalHistoryConfig){
+ public ActionsController(ActionsService actionsService, HistoryConfig historyConfig){
this.actionsService = actionsService;
- this.portalHistoryConfig = portalHistoryConfig;
+ this.historyConfig = historyConfig;
}
@Override
@@ -52,7 +52,7 @@ public class ActionsController implements ActionsApi {
return IdTokenExchange
.validateUserId(userId, exchange, xRequestId)
- .then(createActionRequest.flatMap(action -> actionsService.createActions(userId, action, portalHistoryConfig.getSaveInterval(), xRequestId)))
+ .then(createActionRequest.flatMap(action -> actionsService.createActions(userId, action, historyConfig.getSaveInterval(), xRequestId)))
.map(ResponseEntity::ok);
}
@@ -70,7 +70,7 @@ public class ActionsController implements ActionsApi {
return IdTokenExchange
.validateUserId(userId, exchange, xRequestId)
- .then(actionsService.getActions(userId, page.orElse(1), pageSize.orElse(10), showLastHours.orElse(portalHistoryConfig.getSaveInterval()), portalHistoryConfig.getSaveInterval(), xRequestId))
+ .then(actionsService.getActions(userId, page.orElse(1), pageSize.orElse(10), showLastHours.orElse(historyConfig.getSaveInterval()), historyConfig.getSaveInterval(), xRequestId))
.map(ResponseEntity::ok);
}
@@ -78,7 +78,7 @@ public class ActionsController implements ActionsApi {
public Mono<ResponseEntity<ActionsListResponse>> listActions(String xRequestId, Optional<Integer> page, Optional<Integer> pageSize, Optional<Integer> showLastHours, ServerWebExchange exchange) {
return actionsService
- .listActions(page.orElse(1), pageSize.orElse(10), showLastHours.orElse(portalHistoryConfig.getSaveInterval()), portalHistoryConfig.getSaveInterval(), xRequestId)
+ .listActions(page.orElse(1), pageSize.orElse(10), showLastHours.orElse(historyConfig.getSaveInterval()), historyConfig.getSaveInterval(), xRequestId)
.map(ResponseEntity::ok);
}
}
diff --git a/app/src/main/java/org/onap/portal/history/util/Logger.java b/app/src/main/java/org/onap/portal/history/util/Logger.java
index 01b159c..c072c16 100644
--- a/app/src/main/java/org/onap/portal/history/util/Logger.java
+++ b/app/src/main/java/org/onap/portal/history/util/Logger.java
@@ -40,7 +40,7 @@ public class Logger {
* @param path which is called be the request
*/
public static void requestLog(String xRequestId, HttpMethod methode, URI path) {
- log.info("Portal-history - request - X-Request-Id {} {} {}", xRequestId, methode, path);
+ log.info("History - request - X-Request-Id {} {} {}", xRequestId, methode, path);
}
/**
@@ -49,7 +49,7 @@ public class Logger {
* @param code http status of the response
*/
public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) {
- log.info("Portal-history - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
+ log.info("History - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
}
/**
@@ -60,6 +60,6 @@ public class Logger {
*/
public static void errorLog(String xRequestId, String msg, String id) {
log.info(
- "Portal-history - error - X-Request-Id {} {} {} not found", xRequestId, msg, id);
+ "History - error - X-Request-Id {} {} {} not found", xRequestId, msg, id);
}
}