summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java17
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java21
2 files changed, 21 insertions, 17 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index 2a661a7a6a..f7d718ccdc 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +34,8 @@ import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
@@ -44,7 +47,7 @@ import net.javacrumbs.shedlock.core.SchedulerLock;
@Component
public class ArchiveInfraRequestsScheduler {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ArchiveInfraRequestsScheduler.class);
+ private static Logger logger = LoggerFactory.getLogger(ArchiveInfraRequestsScheduler.class);
@Autowired
private InfraActiveRequestsRepository infraActiveRepo;
@@ -76,14 +79,14 @@ public class ArchiveInfraRequestsScheduler {
PageRequest pageRequest = new PageRequest(0, 100);
do {
requestsByEndTime = infraActiveRepo.findByEndTimeLessThan(archivingDate, pageRequest);
- logger.debug(requestsByEndTime.size() + " requests to be archived based on End Time" );
+ logger.debug("{} requests to be archived based on End Time", requestsByEndTime.size());
archiveInfraRequests(requestsByEndTime);
} while(!requestsByEndTime.isEmpty());
List<InfraActiveRequests> requestsByStartTime = new ArrayList<>();
do {
requestsByStartTime = infraActiveRepo.findByStartTimeLessThanAndEndTime(archivingDate, null, pageRequest);
- logger.debug(requestsByEndTime.size() + " requests to be archived based on Start Time" );
+ logger.debug("{} requests to be archived based on Start Time", requestsByEndTime.size());
archiveInfraRequests(requestsByStartTime);
} while(!requestsByStartTime.isEmpty());
@@ -145,15 +148,15 @@ public class ArchiveInfraRequestsScheduler {
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
} catch(Exception e) {
- logger.error(e);
- logger.error(MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode
+ .UnknownError.getValue(), e);
}
}
- logger.info("Creating archivedInfraRequest records: " + newArchivedReqs.size());
+ logger.info("Creating archivedInfraRequest records: {}", newArchivedReqs.size());
archivedInfraRepo.saveAll(newArchivedReqs);
- logger.info("Deleting InfraActiveRequest records: "+ oldInfraReqs.size());
+ logger.info("Deleting InfraActiveRequest records: {}", oldInfraReqs.size());
infraActiveRepo.deleteAll(oldInfraReqs);
}
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 626e3568bc..1027c8a18b 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +40,8 @@ import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.onap.so.db.request.data.repository.SiteStatusRepository;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDbConstant;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@@ -49,7 +51,7 @@ import org.springframework.stereotype.Component;
@Primary
public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoRequestsDbAdapterImpl.class);
+ private static Logger logger = LoggerFactory.getLogger(MsoRequestsDbAdapterImpl.class);
@Autowired
private InfraActiveRequestsRepository infraActive;
@@ -134,14 +136,14 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
try {
request.setProgress(Long.parseLong(progress));
} catch (NumberFormatException e) {
- logger.warnSimple("UpdateInfraRequest", "Invalid value sent for progress");
+ logger.warn("UpdateInfraRequest", "Invalid value sent for progress");
}
}
@Override
@Transactional
public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException {
- logger.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
+ logger.debug("Call to MSO Infra RequestsDb adapter get method with request Id: {}", requestId);
InfraActiveRequests request = null;
try {
request = infraActive.findOneByRequestIdOrClientRequestId(requestId, requestId);
@@ -167,9 +169,8 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
@Override
@Transactional
public boolean getSiteStatus(String siteName) {
- UUIDChecker.generateUUID(logger);
SiteStatus siteStatus;
- logger.debug("Request database - get Site Status with Site name:" + siteName);
+ logger.debug("Request database - get Site Status with Site name: {}", siteName);
siteStatus = siteRepo.findOneBySiteName(siteName);
if (siteStatus == null) {
// if not exist in DB, it means the site is not disabled, thus
@@ -203,7 +204,6 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: "
+ operationId;
logger.error(error);
-// throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError);
operStatus = new OperationStatus();
operStatus.setOperationId(operationId);
operStatus.setServiceId(serviceId);
@@ -353,12 +353,13 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
String serviceId = operStatus.getServiceId();
String operationId = operStatus.getOperationId();
- logger.debug("Request database - update Operation Status Based On Resource Operation Status with service Id:"
- + serviceId + ", operationId:" + operationId);
+ logger.debug("Request database - update Operation Status Based On Resource Operation Status with service Id: "
+ + "{}, operationId: {}", serviceId, operationId);
List<ResourceOperationStatus> lstResourceStatus = resourceOperationStatusRepository.findByServiceIdAndOperationId(serviceId, operationId);
if (lstResourceStatus == null) {
- logger.error("Unable to retrieve resourceOperStatus Object by ServiceId: " + serviceId + " operationId: " + operationId);
+ logger.error("Unable to retrieve resourceOperStatus Object by ServiceId: {} operationId: {}", serviceId,
+ operationId);
return;
}