aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Shen <shentao@chinamobile.com>2020-03-10 02:10:14 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-10 02:10:14 +0000
commitaedfcf68e086e3ca13b108bc344821f15a0e3540 (patch)
tree3900cacee94b5828fa6ea3e75fd42f9d3bcb18e3
parent49c8bebba6183237a1bd0c0e8862e67660742754 (diff)
parentb2856f77db0f772f09bc90bacecafd5904e420a1 (diff)
Merge "Gneral Sonar fixes"
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java30
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java45
2 files changed, 27 insertions, 48 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
index ea318783..c3764960 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceConvert.java
@@ -90,7 +90,7 @@ public class ResourceMgtServiceConvert {
void convertSlicingBusinessList(SlicingBusinessList slicingBusinessList, AAIServiceRsp aAIServiceRsp, int pageNo,
int pageSize)
throws InvocationTargetException, IllegalAccessException, IOException {
- if (aAIServiceRsp.getaAIService() == null || aAIServiceRsp.getaAIService().size() == 0) {
+ if (aAIServiceRsp.getaAIService() == null || aAIServiceRsp.getaAIService().isEmpty()) {
logger.error("convertSlicingBusinessList:aAIServiceRsp.getaAIService() is null or size is 0");
return;
}
@@ -124,7 +124,6 @@ public class ResourceMgtServiceConvert {
void getNsiInfoByBusiness(NsiInfo nsiInfo, String nsiId) {
try {
- // TODO
AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
Response<JSONObject> response = this.aaiSliceService
.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId)
@@ -154,7 +153,6 @@ public class ResourceMgtServiceConvert {
String modelInvariantId;
String modelVersionId;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, nsiId).execute();
if (response.isSuccessful()) {
@@ -171,12 +169,11 @@ public class ResourceMgtServiceConvert {
return;
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in getNstInfoByBusiness response",e);
return;
}
try {
- // TODO
Response<AAIServiceNST> nstResponse = this.aaiSliceService.queryServiceNST(modelInvariantId, modelVersionId)
.execute();
if (nstResponse.isSuccessful()) {
@@ -190,7 +187,7 @@ public class ResourceMgtServiceConvert {
return;
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in getNstInfoByBusiness nstResponse",e);
return;
}
}
@@ -199,7 +196,6 @@ public class ResourceMgtServiceConvert {
throws IOException {
List<AAIServiceAndInstance> aaiServiceAndInstanceList = new ArrayList<>();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.queryAllottedResources(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, businessId).execute();
if (response.isSuccessful()) {
@@ -226,7 +222,7 @@ public class ResourceMgtServiceConvert {
return "";
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in getNsiIdByBusiness response",e);
return "";
}
return "";
@@ -242,7 +238,6 @@ public class ResourceMgtServiceConvert {
AAIServiceProfiles aaiServiceProfiles = new AAIServiceProfiles();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.getServiceProfiles(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, businessId).execute();
@@ -263,7 +258,8 @@ public class ResourceMgtServiceConvert {
}
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in convertBusinessProfileDetails response",e);
+
}
String useInterval = generalConvert.getUseInterval(businessId);
@@ -324,7 +320,6 @@ public class ResourceMgtServiceConvert {
for (String nssiId : nssiIdList) {
i++;
try {
- // TODO
AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
Response<JSONObject> response = this.aaiSliceService
.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId)
@@ -346,7 +341,8 @@ public class ResourceMgtServiceConvert {
response.message()));
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in getIncludedNssiInfoList response",e);
+
}
}
}
@@ -355,7 +351,6 @@ public class ResourceMgtServiceConvert {
throws IOException, InvocationTargetException, IllegalAccessException {
for (String businessId : businessIdList) {
try {
- // TODO
// 添加给slicingTaskCreationProgress赋值的代码
AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance();
Response<JSONObject> response = this.aaiSliceService
@@ -377,7 +372,7 @@ public class ResourceMgtServiceConvert {
response.message()));
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in getHostedBusinessInfoList response",e);
}
}
}
@@ -445,7 +440,7 @@ public class ResourceMgtServiceConvert {
AAIServiceRsp aAIServiceRsp,
int pageNo, int pageSize)
throws InvocationTargetException, IllegalAccessException {
- if (aAIServiceRsp.getaAIService() == null || aAIServiceRsp.getaAIService().size() == 0) {
+ if (aAIServiceRsp.getaAIService() == null || aAIServiceRsp.getaAIService().isEmpty()) {
logger.error("convertNssiServiceInstanceList: aAIServiceRsp.getaAIService() is null or size is 0");
return;
}
@@ -473,7 +468,6 @@ public class ResourceMgtServiceConvert {
List<HostedNsiInfo> hostedNsiInfoList = new ArrayList<>();
for (String nsiId : nsiIdList) {
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, nsiId).execute();
if (response.isSuccessful()) {
@@ -492,7 +486,7 @@ public class ResourceMgtServiceConvert {
response.message()));
}
} catch (Exception e) {
- logger.error(e.getMessage());
+ logger.error("Exception in convertNssiDetails response",e);
}
}
@@ -562,7 +556,7 @@ public class ResourceMgtServiceConvert {
public List<AAIServiceAndInstance> queryAllottedResourceUtil(JSONObject objectResource) {
JSONArray arrayResource = objectResource.getJSONArray("allotted-resource");
- if (arrayResource == null || arrayResource.size() == 0) {
+ if (arrayResource == null || arrayResource.isEmpty()) {
logger.error("arrayResource is null or size is 0");
return null;
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
index 8b99fba7..a0a626e1 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java
@@ -101,7 +101,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.listService(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G).execute();
if (response.isSuccessful()) {
@@ -131,7 +130,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing business instances query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingBusiness response",e);
}
logger.info(resultMsg);
@@ -203,7 +202,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.listServiceByStatus(
NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, processingStatus).execute();
if (response.isSuccessful()) {
@@ -231,7 +229,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing business instances query based on status failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingBusinessByStatus response",e);
}
logger.info(resultMsg);
@@ -252,7 +250,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.listServiceById(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, businessId)
.execute();
@@ -275,7 +272,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing business details query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in querySlicingBusinessDetails response",e);
}
logger.info(resultMsg);
@@ -296,7 +293,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.listServiceNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G).execute();
if (response.isSuccessful()) {
@@ -321,7 +317,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing NSI service instances query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNsiInstances response",e);
}
logger.info(resultMsg);
@@ -342,7 +338,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.listServiceNSIByStatus(
NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, instanceStatus).execute();
if (response.isSuccessful()) {
@@ -368,7 +363,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing NSI service instances based on status query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNsiInstancesByStatus response",e);
}
logger.info(resultMsg);
@@ -390,7 +385,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, serviceInstanceId).execute();
if (response.isSuccessful()) {
@@ -411,7 +405,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing business details query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNsiDetails response",e);
}
logger.info(resultMsg);
@@ -430,7 +424,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
NsiRelatedNssiInfo nsiRelatedNssiInfo = new NsiRelatedNssiInfo();
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.querySerAndSubInsByNSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nsiId)
.execute();
@@ -453,7 +446,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "NSSI associated with NSI query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNsiRelatedNssiInfo response",e);
}
logger.info(resultMsg);
@@ -473,7 +466,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.listServiceNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G).execute();
if (response.isSuccessful()) {
@@ -499,7 +491,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing NSSI service instances query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNssiInstances response",e);
}
logger.info(resultMsg);
@@ -519,7 +511,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.listServiceNSSIByStatus(
NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, instanceStatus).execute();
if (response.isSuccessful()) {
@@ -546,7 +537,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing NSSI service instances based on status query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNssiInstancesByStatus response",e);
}
logger.info(resultMsg);
@@ -567,7 +558,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
AAIServiceRsp aAIServiceRsp = new AAIServiceRsp();
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService.listServiceNSSIByEnv(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G, environmentContext).execute();
if (response.isSuccessful()) {
@@ -593,7 +583,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing NSSI service instances based on environment query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNssiInstancesByEnvironment response",e);
}
logger.info(resultMsg);
@@ -614,7 +604,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
Response<JSONObject> response = this.aaiSliceService
.queryNSIByNSSI(NsmfParamConstant.CUSTOM_5G, NsmfParamConstant.SERVICE_TYPE_5G, nssiId).execute();
if (response.isSuccessful()) {
@@ -634,7 +623,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing service nssi details query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryNssiDetails response",e);
}
logger.info(resultMsg);
@@ -653,7 +642,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
SubscriberInfo subscriberInfo = resourceMgtServiceConvert.buildSubscriberInfo(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
@@ -683,7 +671,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing service activation failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in activateSlicingService response",e);
}
logger.info(resultMsg);
@@ -702,7 +690,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
SubscriberInfo subscriberInfo = resourceMgtServiceConvert.buildSubscriberInfo(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
@@ -732,7 +719,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing service deactivation failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in deactivateSlicingService response",e);
}
logger.info(resultMsg);
@@ -751,7 +738,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg;
try {
- // TODO
SubscriberInfo subscriberInfo = resourceMgtServiceConvert.buildSubscriberInfo(NsmfParamConstant.CUSTOM_5G,
NsmfParamConstant.SERVICE_TYPE_5G);
String jsonstr = JSON.toJSONString(subscriberInfo);
@@ -781,7 +767,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing service termination failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in terminateSlicingService response",e);
}
logger.info(resultMsg);
@@ -800,7 +786,6 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
String resultMsg = "";
try {
- // TODO
ServiceInstanceOperations serviceInstanceOperations = serviceLcmService
.getServiceInstanceOperationById(serviceId);
if (serviceInstanceOperations != null) {
@@ -852,7 +837,7 @@ public class ResourceMgtServiceImpl implements ResourceMgtService {
} catch (Exception e) {
resultMsg = "5G slicing service operation progress query failed. Unknown exception occurred!";
resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN);
- logger.error(e.getMessage());
+ logger.error("Exception in queryOperationProgress response",e);
}
logger.info(resultMsg);