aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/main/java
diff options
context:
space:
mode:
authorzhuguanyu <zhuguanyu5@huawei.com>2022-08-10 16:55:56 +0800
committerzhuguanyu <zhuguanyu5@huawei.com>2022-08-10 16:59:18 +0800
commit2d13c3e71c1189c57b504cb2202fff72debb6786 (patch)
tree80db6f494ca027801ba7c6aca3a5896b2bb70640 /intentanalysis/src/main/java
parent96d16d95ec27c62722a601f5bf8e735965692b8f (diff)
Add logs for uui intent-analysis server
Issue-ID: USECASEUI-708 Signed-off-by: zhuguanyu <zhuguanyu5@huawei.com> Change-Id: Iab2a9f71a7142f31ca9c3dd7444636ae96b46add
Diffstat (limited to 'intentanalysis/src/main/java')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java23
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java23
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java22
3 files changed, 32 insertions, 36 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
index af7a2e9..b8f6c3e 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationServiceImpl.java
@@ -17,6 +17,7 @@
package org.onap.usecaseui.intentanalysis.service.impl;
+import lombok.extern.slf4j.Slf4j;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
import org.onap.usecaseui.intentanalysis.bean.models.State;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
@@ -25,8 +26,6 @@ import org.onap.usecaseui.intentanalysis.service.ExpectationService;
import org.onap.usecaseui.intentanalysis.service.StateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
@@ -34,9 +33,9 @@ import java.util.ArrayList;
import java.util.List;
@Service
+@Slf4j
public class ExpectationServiceImpl implements ExpectationService {
- private static Logger LOGGER = LoggerFactory.getLogger(ExpectationServiceImpl.class);
@Autowired
private ExpectationMapper expectationMapper;
@@ -56,7 +55,7 @@ public class ExpectationServiceImpl implements ExpectationService {
int res = expectationMapper.insertExpectationList(expectationList, intentId);
if (res < 1) {
String msg = "Create expectation to database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
}
@@ -66,7 +65,7 @@ public class ExpectationServiceImpl implements ExpectationService {
List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId);
if (expectationList == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
for (Expectation expectation : expectationList) {
@@ -81,13 +80,13 @@ public class ExpectationServiceImpl implements ExpectationService {
List<Expectation> expectationList = expectationMapper.selectExpectationByIntentId(intentId);
if (expectationList == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
int res = expectationMapper.deleteExpectationByIntentId(intentId);
if (res < 1) {
String msg = "Delete expectation in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
for (Expectation expectation : expectationList) {
@@ -100,7 +99,7 @@ public class ExpectationServiceImpl implements ExpectationService {
List<Expectation> expectationDBList = expectationMapper.selectExpectationByIntentId(intentId);
if (expectationDBList == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
List<String> expectationDBIdList = new ArrayList<>();
@@ -114,7 +113,7 @@ public class ExpectationServiceImpl implements ExpectationService {
int res = expectationMapper.updateExpectation(expectation);
if (res < 1) {
String msg = "Update expectation in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_UPDATE_DATA_FAIL);
}
expectationDBIdList.remove(expectation.getExpectationId());
@@ -125,7 +124,7 @@ public class ExpectationServiceImpl implements ExpectationService {
for (String expectationDBId : expectationDBIdList) {
expectationService.deleteExpectationById(expectationDBId);
}
- LOGGER.info("Expectations are successfully updated.");
+ log.info("Expectations are successfully updated.");
}
@Override
@@ -133,7 +132,7 @@ public class ExpectationServiceImpl implements ExpectationService {
int res = expectationMapper.insertExpectation(expectation, intentId);
if (res < 1) {
String msg = "Create expectation to database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
}
@@ -143,7 +142,7 @@ public class ExpectationServiceImpl implements ExpectationService {
int res = expectationMapper.deleteExpectationById(expectationId);
if (res < 1) {
String msg = "Delete expectation in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
index 21dfe21..2564c2a 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/IntentServiceImpl.java
@@ -17,12 +17,11 @@
package org.onap.usecaseui.intentanalysis.service.impl;
+import lombok.extern.slf4j.Slf4j;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.mapper.IntentMapper;
import org.onap.usecaseui.intentanalysis.service.ExpectationService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -33,8 +32,8 @@ import java.util.ArrayList;
import java.util.List;
@Service
+@Slf4j
public class IntentServiceImpl implements IntentService {
- private static Logger LOGGER = LoggerFactory.getLogger(IntentService.class);
@Autowired
private IntentMapper intentMapper;
@@ -47,7 +46,7 @@ public class IntentServiceImpl implements IntentService {
List<Intent> intentList = intentMapper.selectIntents();
if (intentList == null || intentList.size() <= 0) {
String msg = "Intent list doesn't exist in the intent database.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
for (Intent intent : intentList) {
@@ -64,7 +63,7 @@ public class IntentServiceImpl implements IntentService {
return intent;
} else {
String msg = String.format("Intent id %s doesn't exist in database.", intentId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
}
@@ -75,12 +74,12 @@ public class IntentServiceImpl implements IntentService {
int res = intentMapper.insertIntent(intent);
if (res < 1) {
String msg = "Create intent to database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
// saving expectation list into expectation table
expectationService.createExpectationList(intent.getExpectationList(), intent.getIntentId());
- LOGGER.info("Intent was successfully created.");
+ log.debug("Intent was successfully created.");
return intent;
}
@@ -89,17 +88,17 @@ public class IntentServiceImpl implements IntentService {
Intent intentDB = intentMapper.selectIntentById(intent.getIntentId());
if (intentDB == null) {
String msg = String.format("Intent id %s doesn't exist in database.", intent.getIntentId());
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
expectationService.updateExpectationListById(intent.getExpectationList(), intent.getIntentId());
int res = intentMapper.updateIntent(intent);
if (res < 1) {
String msg = "Update intent in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_UPDATE_DATA_FAIL);
}
- LOGGER.info("Update intent successfully.");
+ log.debug("Update intent successfully.");
return intentMapper.selectIntentById(intent.getIntentId());
}
@@ -108,10 +107,10 @@ public class IntentServiceImpl implements IntentService {
int res = intentMapper.deleteIntentById(intentId);
if (res < 1) {
String msg = "Delete intent in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
expectationService.deleteExpectationListById(intentId);
- LOGGER.info("Intent has been deleted successfully.");
+ log.debug("Intent has been deleted successfully.");
}
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
index 06fa9fd..5a748d9 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/StateServiceImpl.java
@@ -17,13 +17,12 @@
package org.onap.usecaseui.intentanalysis.service.impl;
+import lombok.extern.slf4j.Slf4j;
import org.onap.usecaseui.intentanalysis.bean.models.State;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
import org.onap.usecaseui.intentanalysis.mapper.StateMapper;
import org.onap.usecaseui.intentanalysis.service.StateService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -31,10 +30,9 @@ import java.util.ArrayList;
import java.util.List;
@Service
+@Slf4j
public class StateServiceImpl implements StateService {
- private static Logger LOGGER = LoggerFactory.getLogger(StateServiceImpl.class);
-
@Autowired
private StateMapper stateMapper;
@@ -46,7 +44,7 @@ public class StateServiceImpl implements StateService {
int res = stateMapper.insertStateList(stateList, expectationId);
if (res < 1) {
String msg = "Create state to database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
}
@@ -56,7 +54,7 @@ public class StateServiceImpl implements StateService {
List<State> stateList = stateMapper.selectStateByExpectation(expectationId);
if (stateList == null) {
String msg = String.format("Expectation id %s doesn't exist in database.", expectationId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
return stateList;
@@ -67,7 +65,7 @@ public class StateServiceImpl implements StateService {
int res = stateMapper.deleteStateByExpectationId(expectationId);
if (res < 1) {
String msg = "Delete state in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
}
@@ -77,7 +75,7 @@ public class StateServiceImpl implements StateService {
List<State> stateDBList = stateMapper.selectStateByExpectation(expectationId);
if (stateDBList == null) {
String msg = String.format("Expectation id %s doesn't exist in database.", expectationId);
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_QUERY_DATA_EMPTY);
}
List<String> stateDBIdList = new ArrayList<>();
@@ -89,7 +87,7 @@ public class StateServiceImpl implements StateService {
int res = stateMapper.updateState(state);
if (res < 1) {
String msg = "Update state in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_UPDATE_DATA_FAIL);
}
stateDBIdList.remove(state.getStateId());
@@ -100,7 +98,7 @@ public class StateServiceImpl implements StateService {
for (String stateDBId : stateDBIdList) {
stateService.deleteStateById(stateDBId);
}
- LOGGER.info("States are successfully updated.");
+ log.debug("States are successfully updated.");
}
@Override
@@ -108,7 +106,7 @@ public class StateServiceImpl implements StateService {
int res = stateMapper.insertState(state, expectationId);
if (res < 1) {
String msg = "Create state to database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
}
@@ -118,7 +116,7 @@ public class StateServiceImpl implements StateService {
int res = stateMapper.deleteStateById(stateId);
if (res < 1) {
String msg = "Delete state in database failed.";
- LOGGER.error(msg);
+ log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_DELETE_DATA_FAIL);
}
}