diff options
author | shentao999 <shentao@chinamobile.com> | 2019-08-22 17:11:59 +0800 |
---|---|---|
committer | shentao999 <shentao@chinamobile.com> | 2019-08-22 17:12:00 +0800 |
commit | bb8ea9e84d2a39680cac205cb7599fb250a7c9a6 (patch) | |
tree | e68b561036f15be488579e0802de404c6d226753 | |
parent | 74315aa9158fae70bda29202269be3c7c503cc6f (diff) |
Delete uui-server constant
Change-Id: I2d66b7444a4072d48c50cfc751fdab0e0884e97e
Issue-ID: USECASEUI-307
Signed-off-by: shentao999 <shentao@chinamobile.com>
11 files changed, 147 insertions, 214 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java deleted file mode 100755 index cbdc1a7c..00000000 --- a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java +++ /dev/null @@ -1,54 +0,0 @@ -/**
- * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.server.constant;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
-
-public final class Constant
-{
- public static final String DATE_FORMAT= "yyyy-MM-dd HH:mm:ss";
-
- public static final String RegEX_DATE_FORMAT = "[^0-9-:]";
-
- public static Map<String,ServiceTemplateInput> netWorkMap = new HashMap<String,ServiceTemplateInput>();
-
- public static final String CONSTANT_SUCCESS="{\"status\":\"SUCCESS\"}";
-
- public static final String CONSTANT_FAILED="{\"status\":\"FAILED\"}";
-
- public static final String CREATING_CODE="1001";
-
- public static final String DELETING_CODE="1002";
-
- public static final String SCALING_CODE="1003";
-
- public static final String HEALING_CODE="1004";
-
- public static final String UPDATING_CODE="1005";
-
- public static final String SUCCESS_CODE="2001";
-
- public static final String FAIL_CODE="2002";
-
- public static final String IN_PROGRESS_CODE="2003";
-
- public static final String ALARM_TOPIC="unauthenticated.SEC_FAULT_OUTPUT";
-
- public static final String PERFORMANCE_TOPIC="unauthenticated.SEC_MEASUREMENT_OUTPUT";
-}
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java index 087883dd..0cceee27 100755 --- a/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/AlarmController.java @@ -31,7 +31,7 @@ import com.google.common.base.Throwables; import org.onap.usecaseui.server.bean.AlarmsHeader;
import org.onap.usecaseui.server.bean.AlarmsInformation;
import org.onap.usecaseui.server.bean.SortMaster;
-import org.onap.usecaseui.server.constant.Constant;
+import org.onap.usecaseui.server.constant.CommonConstant;
import org.onap.usecaseui.server.service.AlarmsHeaderService;
import org.onap.usecaseui.server.service.AlarmsInformationService;
import org.onap.usecaseui.server.util.DateProcessDataObject;
@@ -112,16 +112,16 @@ public class AlarmController alarm.setSourceName(sourceName);
alarm.setStatus(vfStatus);
alarm.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime) ? null
- : new SimpleDateFormat(Constant.DATE_FORMAT).parse(startTime).getTime() + "");
+ : new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(startTime).getTime() + "");
alarm.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime) ? null
- : new SimpleDateFormat(Constant.DATE_FORMAT).parse(endTime).getTime() + "");
+ : new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(endTime).getTime() + "");
Page pa =
alarmsHeaderService.queryAlarmsHeader(alarm, Integer.parseInt(currentPage), Integer.parseInt(pageSize));
try {
Map<String, Object> map = new HashMap<>();
map.put("alarms", pa.getList());
map.put("totalRecords", pa.getTotalRecords());
- omAlarm.setDateFormat(new SimpleDateFormat(Constant.DATE_FORMAT));
+ omAlarm.setDateFormat(new SimpleDateFormat(CommonConstant.DATE_FORMAT));
return omAlarm.writeValueAsString(map);
} catch (JsonProcessingException e) {
logger.debug("JsonProcessingException :" + e.getMessage());
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java index 0ef97ce0..220ca464 100755 --- a/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/PerformanceController.java @@ -29,7 +29,7 @@ import javax.annotation.Resource; import org.onap.usecaseui.server.bean.PerformanceHeader; import org.onap.usecaseui.server.bean.PerformanceInformation; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.PerformanceHeaderService; import org.onap.usecaseui.server.service.PerformanceInformationService; import org.onap.usecaseui.server.util.Page; @@ -80,14 +80,14 @@ public class PerformanceController { Page<PerformanceHeader> pa = new Page<PerformanceHeader>(); PerformanceHeader performanceHeader = new PerformanceHeader.PerformanceHeaderBuilder().createPerformanceHeader(); performanceHeader.setSourceName(sourceName); - performanceHeader.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(startTime).getTime()+""); - performanceHeader.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime)?null:new SimpleDateFormat(Constant.DATE_FORMAT).parse(endTime).getTime()+""); + performanceHeader.setStartEpochMicrosec(!UuiCommonUtil.isNotNullOrEmpty(startTime)?null:new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(startTime).getTime()+""); + performanceHeader.setLastEpochMicroSec(!UuiCommonUtil.isNotNullOrEmpty(endTime)?null:new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(endTime).getTime()+""); pa = performanceHeaderService.queryPerformanceHeader(performanceHeader,Integer.parseInt(currentPage),Integer.parseInt(pageSize)); try { Map<String,Object> map = new HashMap<>(); map.put("performances",pa.getList()); map.put("totalRecords",pa.getTotalRecords()); - omPerformance.setDateFormat(new SimpleDateFormat(Constant.DATE_FORMAT)); + omPerformance.setDateFormat(new SimpleDateFormat(CommonConstant.DATE_FORMAT)); return omPerformance.writeValueAsString(map); } catch (JsonProcessingException e) { logger.error("JsonProcessingException"+e.getMessage()); diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java index e2051aed..70e796af 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java @@ -16,7 +16,6 @@ package org.onap.usecaseui.server.controller.lcm; import java.text.ParseException; -import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; @@ -25,7 +24,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.usecaseui.server.bean.ServiceBean; import org.onap.usecaseui.server.bean.ServiceInstanceOperations; import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.lcm.PackageDistributionService; import org.onap.usecaseui.server.service.lcm.ServiceLcmService; import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; @@ -48,7 +47,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @RestController @@ -125,11 +123,11 @@ public class PackageDistributionController { JobStatus jobStatus = packageDistributionService.getNsLcmJobStatus(serviceInstanceId,jobId, responseId,operationType); if(UuiCommonUtil.isNotNullOrEmpty(jobStatus)&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor())&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor().getProgress())){ String processNum = jobStatus.getResponseDescriptor().getProgress(); - String operationResult = Constant.IN_PROGRESS_CODE; + String operationResult = CommonConstant.IN_PROGRESS_CODE; if(Integer.parseInt(processNum)==100){ - operationResult = Constant.SUCCESS_CODE; + operationResult = CommonConstant.SUCCESS_CODE; }else if(Integer.parseInt(processNum)>100){ - operationResult=Constant.FAIL_CODE; + operationResult= CommonConstant.FAIL_CODE; } serviceLcmService.updateServiceInstanceOperation(serviceInstanceId,operationType,processNum,operationResult); } @@ -258,7 +256,7 @@ public class PackageDistributionController { JSONObject jobObject = JSONObject.parseObject(object); String jobId = jobObject.getString("jobId"); ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,null,null); - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId, CommonConstant.CREATING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); serviceLcmService.saveOrUpdateServiceBean(serviceBean); return object; @@ -272,7 +270,7 @@ public class PackageDistributionController { JSONObject jobIdObject = JSONObject.parseObject(result); jobId = jobIdObject.getString("jobId"); } - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId, CommonConstant.DELETING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return result; } @@ -285,7 +283,7 @@ public class PackageDistributionController { JSONObject jobIdObject = JSONObject.parseObject(result); jobId = jobIdObject.getString("jobId"); } - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.HEALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId, CommonConstant.HEALING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return result; } diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java index 28b4b57e..4e9102f8 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java @@ -17,7 +17,7 @@ package org.onap.usecaseui.server.controller.lcm; import org.onap.usecaseui.server.bean.ServiceBean; import org.onap.usecaseui.server.bean.ServiceInstanceOperations; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.lcm.ServiceLcmService; import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp; import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; @@ -68,7 +68,7 @@ public class ServiceLcmController { String serviceId = serviceOperation.getService().getServiceId(); String operationId = serviceOperation.getService().getOperationId(); serviceBean.setServiceInstanceId(serviceId); - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,operationId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,operationId, CommonConstant.CREATING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceBean(serviceBean); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return serviceOperation; @@ -78,15 +78,15 @@ public class ServiceLcmController { @RequestMapping(value = {"/uui-lcm/services/{serviceId}/operations/{operationId}"}, method = RequestMethod.GET , produces = "application/json") public OperationProgressInformation queryOperationProgress(HttpServletRequest request,@PathVariable(value="serviceId") String serviceId, @PathVariable(value="operationId") String operationId){ String operationType = request.getParameter("operationType"); - String operationResult = Constant.IN_PROGRESS_CODE; + String operationResult = CommonConstant.IN_PROGRESS_CODE; OperationProgressInformation operationProgressInformation =serviceLcmService.queryOperationProgress(serviceId, operationId); if(UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation)&&UuiCommonUtil.isNotNullOrEmpty(operationProgressInformation.getOperationStatus())){ //serviceLcmService.updateServiceInstanceStatusById(operationProgressInformation.getOperationStatus().getResult(), serviceId); int progress =operationProgressInformation.getOperationStatus().getProgress(); if(0<=progress&&progress<100){ - operationResult=Constant.IN_PROGRESS_CODE; + operationResult= CommonConstant.IN_PROGRESS_CODE; }else if(progress==100){ - operationResult=Constant.SUCCESS_CODE; + operationResult= CommonConstant.SUCCESS_CODE; } serviceLcmService.updateServiceInstanceOperation(serviceId,operationType,progress+"",operationResult); } @@ -97,7 +97,7 @@ public class ServiceLcmController { @RequestMapping(value = {"/uui-lcm/services/{serviceId}"}, method = RequestMethod.DELETE , produces = "application/json") public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{ DeleteOperationRsp deleteOperationRsp = serviceLcmService.terminateService(serviceId, request); - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,deleteOperationRsp.getOperationId(),Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,deleteOperationRsp.getOperationId(), CommonConstant.DELETING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return deleteOperationRsp; } @@ -119,7 +119,7 @@ public class ServiceLcmController { @RequestMapping(value = {"/uui-lcm/services/scaleServices/{serviceId}"}, method = RequestMethod.POST , produces = "application/json") public SaveOrUpdateOperationRsp scaleServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{ SaveOrUpdateOperationRsp saveOrUpdateOperationRsp =serviceLcmService.scaleService(serviceId, request); - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(),Constant.SCALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(), CommonConstant.SCALING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return saveOrUpdateOperationRsp; } @@ -141,7 +141,7 @@ public class ServiceLcmController { @RequestMapping(value = {"/uui-lcm/services/updateService/{serviceId}"}, method = RequestMethod.PUT , produces = "application/json") public SaveOrUpdateOperationRsp updateServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request) throws ParseException{ SaveOrUpdateOperationRsp saveOrUpdateOperationRsp =serviceLcmService.scaleService(serviceId, request); - ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(),Constant.UPDATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); + ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(serviceId,saveOrUpdateOperationRsp.getOperationId(), CommonConstant.UPDATING_CODE,"0", CommonConstant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null); serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera); return saveOrUpdateOperationRsp; } diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java b/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java index 7f3f3188..5b84d8c6 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java @@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletRequest; import org.onap.usecaseui.server.bean.sotn.NetWorkResource; import org.onap.usecaseui.server.bean.sotn.Pinterface; import org.onap.usecaseui.server.bean.sotn.Pnf; -import org.onap.usecaseui.server.constant.Constant; import org.onap.usecaseui.server.service.sotn.SOTNService; import org.onap.usecaseui.server.util.HttpUtil; import org.onap.usecaseui.server.util.UuiCommonUtil; @@ -34,7 +33,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.JsonNode; @@ -168,13 +166,7 @@ public class SotnController { String serviceType = request.getParameter("serviceType"); return sotnService.getServiceInstances(customerId, serviceType); } - - @RequestMapping(value = {"/getOssInvenory"}, method = RequestMethod.GET) - public String getData(){ - String result = HttpUtil.sendGet("http://172.60.3.45:8099/oss/inventory", ""); - return result; - } - + @RequestMapping(value = {"/deleteExtNetWork"}, method = RequestMethod.DELETE) public String deleteExtNetwork(@RequestParam String extNetworkId,@RequestParam(value="resourceVersion") String resourceVersion){ return sotnService.deleteExtNetwork(extNetworkId,resourceVersion); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java index b4595456..e3b758e4 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java @@ -22,19 +22,17 @@ import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts. import static org.onap.usecaseui.server.util.RestfulServices.create; import static org.onap.usecaseui.server.util.RestfulServices.extractBody; -import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.onap.usecaseui.server.bean.ServiceBean; import org.onap.usecaseui.server.bean.lcm.VfNsPackageInfo; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.lcm.PackageDistributionService; import org.onap.usecaseui.server.service.lcm.ServiceLcmService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.nsServiceRsp; @@ -47,7 +45,6 @@ import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job; import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus; import org.onap.usecaseui.server.service.lcm.domain.vfc.exceptions.VfcException; -import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -225,11 +222,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getVnfPackages[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getVnfPackages occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -246,11 +243,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getNetworkServicePackages[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getNetworkServicePackages occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -268,11 +265,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getPnfPackages[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getPnfPackages occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -287,14 +284,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.downLoadNsPackage(nsdInfoId).execute(); logger.info("vfc downLoadNsPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get downLoadNsPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("downLoadNsPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -309,14 +306,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.downLoadNsPackage(pnfdInfoId).execute(); logger.info("vfc downLoadPnfPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get downLoadPnfPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("downLoadPnfPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -331,14 +328,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.downLoadNsPackage(vnfPkgId).execute(); logger.info("vfc downLoadVnfPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get downLoadVnfPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("downLoadVnfPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -353,17 +350,17 @@ public class DefaultPackageDistributionService implements PackageDistributionSer response = this.vfcService.deleteNsdPackage(nsdInfoId).execute(); logger.info("vfc deleteNsdPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get deleteNsdPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { if(e.getMessage().contains("204")){ - return Constant.CONSTANT_SUCCESS; + return CommonConstant.CONSTANT_SUCCESS; } logger.error("deleteNsdPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -378,17 +375,17 @@ public class DefaultPackageDistributionService implements PackageDistributionSer response = this.vfcService.deleteVnfdPackage(vnfPkgId).execute(); logger.info("vfc deleteVnfPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get deleteNsdPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { if(e.getMessage().contains("204")){ - return Constant.CONSTANT_SUCCESS; + return CommonConstant.CONSTANT_SUCCESS; } logger.error("deleteVnfPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -403,17 +400,17 @@ public class DefaultPackageDistributionService implements PackageDistributionSer response = this.vfcService.deletePnfdPackage(pnfdInfoId).execute(); logger.info("vfc deletePnfPackage has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get deletePnfPackage[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { if(e.getMessage().contains("204")){ - return Constant.CONSTANT_SUCCESS; + return CommonConstant.CONSTANT_SUCCESS; } logger.error("deletePnfPackage occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -461,11 +458,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createNetworkServiceInstance occur exception:"+e); } return result; @@ -480,17 +477,17 @@ public class DefaultPackageDistributionService implements PackageDistributionSer response = this.vfcService.deleteNetworkServiceInstance(nsInstanceId).execute(); logger.info("vfc deleteNetworkServiceInstance has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get deleteNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { if(e.getMessage().contains("204")){ - return Constant.CONSTANT_SUCCESS; + return CommonConstant.CONSTANT_SUCCESS; } logger.error("deleteNetworkServiceInstance occur exception:"+e); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } return result; @@ -507,11 +504,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not terminateNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("terminateNetworkServiceInstance occur exception:"+e); } return result; @@ -528,11 +525,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not healNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("healNetworkServiceInstance occur exception:"+e); } return result; @@ -549,11 +546,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not scaleNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("scaleNetworkServiceInstance occur exception:"+e); } return result; @@ -570,11 +567,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createNetworkServiceData[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createNetworkServiceData occur exception:"+e); } return result; @@ -591,11 +588,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createVnfData[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createVnfData occur exception:"+e); } return result; @@ -612,11 +609,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createPnfData[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createPnfData occur exception:"+e); } return result; @@ -631,14 +628,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.getNsdInfo(nsdInfoId).execute(); logger.info("vfc getNsdInfo has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get getNsdInfo[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getNsdInfo occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -653,14 +650,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.getVnfInfo(vnfPkgId).execute(); logger.info("vfc getVnfInfo has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get getVnfInfo[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getVnfInfo occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -675,14 +672,14 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = this.vfcService.getPnfInfo(pnfdInfoId).execute(); logger.info("vfc getPnfInfo has finished!"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { logger.info(String.format("Can not get getPnfInfo[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getPnfInfo occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -700,11 +697,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get listNsTemplates[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("listNsTemplates occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; @@ -721,11 +718,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not fetchNsTemplateData[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("fetchNsTemplateData occur exception:"+e); } return result; @@ -745,10 +742,10 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute(); logger.info("calling ccvpn template file parser has finished"); if (response.isSuccessful()) { - result.put("status", Constant.CONSTANT_SUCCESS); + result.put("status", CommonConstant.CONSTANT_SUCCESS); result.put("result", JSONObject.parseObject(new String(response.body().bytes()))); } else { - result.put("status", Constant.CONSTANT_FAILED); + result.put("status", CommonConstant.CONSTANT_FAILED); result.put("error", String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message())); logger.error(String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message())); } @@ -761,21 +758,21 @@ public class DefaultPackageDistributionService implements PackageDistributionSer Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute(); logger.info("calling ccvpn template file parser has finished"); if (response.isSuccessful()) { - result.put("status", Constant.CONSTANT_SUCCESS); + result.put("status", CommonConstant.CONSTANT_SUCCESS); result.put("result",JSONObject.parseObject(new String(response.body().bytes()))); } else { - result.put("status", Constant.CONSTANT_FAILED); + result.put("status", CommonConstant.CONSTANT_FAILED); result.put("error",String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message())); logger.error(String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message())); } } else { - result.put("status", Constant.CONSTANT_FAILED); + result.put("status", CommonConstant.CONSTANT_FAILED); result.put("error",String.format("Can not distribute ccvpn template file. Detail Info [code=%s, message=%s]", postResponse.code(), postResponse.message())); logger.error(String.format("Can not distribute ccvpn template file. Detail Info [code=%s, message=%s]", postResponse.code(), postResponse.message())); } } } catch (Exception e) { - result.put("status", Constant.CONSTANT_FAILED); + result.put("status", CommonConstant.CONSTANT_FAILED); result.put("errorMessage", "calling ccvpn template parser happened exception:"+e); } return result; @@ -792,11 +789,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer if (response.isSuccessful()) { result=new String(response.body().bytes()); } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not instantiateNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("instantiateNetworkServiceInstance occur exception:"+e); } return result; @@ -814,11 +811,11 @@ public class DefaultPackageDistributionService implements PackageDistributionSer result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getVnfInfoById[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getVnfInfoById occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java index 9aba5cca..908ea820 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java @@ -19,7 +19,7 @@ import com.google.common.io.Files; import okhttp3.ResponseBody; import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput; import org.onap.usecaseui.server.bean.lcm.TemplateInput; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController; @@ -221,7 +221,7 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { for (Map.Entry<String, Property> entry : properties.entrySet()) { String key = entry.getKey(); if (key.endsWith("providing_service_uuid")) { - Constant.netWorkMap.put(String.valueOf(entry.getValue().getValue()), newServiceTemplateInput(nodeTemplate)); + CommonConstant.netWorkMap.put(String.valueOf(entry.getValue().getValue()), newServiceTemplateInput(nodeTemplate)); return String.valueOf(entry.getValue().getValue()); } } @@ -285,8 +285,8 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { } private static ServiceTemplateInput newServiceTemplateInput(ToscaTemplate tosca) { - if(Constant.netWorkMap.containsKey(tosca.getMetaData().getValue("UUID"))){ - return Constant.netWorkMap.get(tosca.getMetaData().getValue("UUID")); + if(CommonConstant.netWorkMap.containsKey(tosca.getMetaData().getValue("UUID"))){ + return CommonConstant.netWorkMap.get(tosca.getMetaData().getValue("UUID")); }else{ String invariantUUID = tosca.getMetaData().getValue("invariantUUID"); String uuid = tosca.getMetaData().getValue("UUID"); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java index a70bb07e..5a132067 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/sotn/impl/SOTNServiceImpl.java @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.usecaseui.server.bean.sotn.Pinterface; import org.onap.usecaseui.server.bean.sotn.PinterfaceRsp; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException; @@ -68,11 +68,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getNetWorkResources[code=%s, message=%s]", response.code(), response.message())); - result = Constant.CONSTANT_FAILED; + result = CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getNetWorkResources occur exception:"+e); - result = Constant.CONSTANT_FAILED;; + result = CommonConstant.CONSTANT_FAILED;; } return result; } @@ -107,11 +107,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getLogicalLinks[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } } catch (IOException e) { logger.error("getLogicalLinks occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -127,11 +127,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getSpecificLogicalLink[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getSpecificLogicalLink occur exception:"+e); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } return result; } @@ -147,11 +147,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getHostUrl[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getHostUrl occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -167,11 +167,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getExtAaiId[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getExtAaiId occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -185,13 +185,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.createHostUrl(requestBody,aaiId).execute(); logger.info("aai createHostUrl has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createHostUrl[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createHostUrl occur exception:"+e); } return result; @@ -206,13 +206,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.createTopoNetwork(requestBody,networkId).execute(); logger.info("aai createTopoNetwork has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createTopoNetwork[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createTopoNetwork occur exception:"+e); } return result; @@ -227,13 +227,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.createTerminationPoint(requestBody,pnfName,tpId).execute(); logger.info("aai createTerminationPoint has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createTerminationPoint[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createTerminationPoint occur exception:"+e); } return result; @@ -248,9 +248,9 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.createLink(requestBody,linkName).execute(); logger.info("aai createLink has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createLink[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { @@ -269,13 +269,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.createPnf(requestBody,pnfName).execute(); logger.info("aai createPnf has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not createPnf[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("createPnf occur exception:"+e); } return result; @@ -289,13 +289,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.deleteLink(linkName,resourceVersion).execute(); logger.info("aai deleteLink has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not deleteLink[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("deleteLink occur exception:"+e); } return result; @@ -312,11 +312,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.error(String.format("Can not getServiceInstances[code=%s, message=%s]", response.code(), response.message())); - result= Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (Exception e) { logger.error("getServiceInstances occur exception:"+e); - result= Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } return result; } @@ -351,11 +351,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getPnfInfo[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getPnfInfo occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -371,11 +371,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getAllottedResources[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getAllottedResources occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -391,11 +391,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getConnectivityInfo[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getConnectivityInfo occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -411,11 +411,11 @@ public class SOTNServiceImpl implements SOTNService{ result=new String(response.body().bytes()); } else { logger.info(String.format("Can not get getPinterfaceByVpnId[code=%s, message=%s]", response.code(), response.message())); - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; } } catch (IOException e) { logger.error("getPinterfaceByVpnId occur exception:"+e); - result=Constant.CONSTANT_FAILED;; + result= CommonConstant.CONSTANT_FAILED;; } return result; } @@ -428,13 +428,13 @@ public class SOTNServiceImpl implements SOTNService{ Response<ResponseBody> response = aaiService.deleteExtNetwork(networkId,resourceVersion).execute(); logger.info("aai deleteExtNetwork has finished"); if (response.isSuccessful()) { - result=Constant.CONSTANT_SUCCESS; + result= CommonConstant.CONSTANT_SUCCESS; } else { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error(String.format("Can not deleteExtNetwork[code=%s, message=%s]", response.code(), response.message())); } } catch (Exception e) { - result=Constant.CONSTANT_FAILED; + result= CommonConstant.CONSTANT_FAILED; logger.error("deleteExtNetwork occur exception:"+e); } return result; diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java b/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java index fa582eef..809e7256 100755 --- a/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/DateUtils.java @@ -15,7 +15,7 @@ */ package org.onap.usecaseui.server.util; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -66,7 +66,7 @@ public class DateUtils { ldt = ldt.withSecond(0); } else ldt = ldt.withMinute(ldt.getSecond()-1); - return ldt.format(DateTimeFormatter.ofPattern(Constant.DATE_FORMAT)); + return ldt.format(DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT)); } @@ -85,7 +85,7 @@ public class DateUtils { * @throws ParseException */ public static Date initProcessDate(Date d,int year,int month,int day,int hour,int minute,int second) throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat(Constant.DATE_FORMAT); + SimpleDateFormat sdf = new SimpleDateFormat(CommonConstant.DATE_FORMAT); Calendar c = Calendar.getInstance(); c.setTime(d); if(year >= 0){ @@ -166,19 +166,19 @@ public class DateUtils { } break; } - return ldt.format(DateTimeFormatter.ofPattern(Constant.DATE_FORMAT)); + return ldt.format(DateTimeFormatter.ofPattern(CommonConstant.DATE_FORMAT)); } public static String dateToString(Date d){ - return new SimpleDateFormat(Constant.DATE_FORMAT).format(d); + return new SimpleDateFormat(CommonConstant.DATE_FORMAT).format(d); } public static Date stringToDate(String d) throws ParseException { - return new SimpleDateFormat(Constant.DATE_FORMAT).parse(d); + return new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(d); } public static Date now() throws ParseException { - return new SimpleDateFormat(Constant.DATE_FORMAT).parse(dateToString(new Date())); + return new SimpleDateFormat(CommonConstant.DATE_FORMAT).parse(dateToString(new Date())); } public static String getYearMonthDayHourMinuteSecond(long timeMillis) { diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java index 23c0fda4..8753ae56 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import com.google.common.base.Throwables; import org.glassfish.jersey.client.ClientConfig; import org.onap.usecaseui.server.bean.*; -import org.onap.usecaseui.server.constant.Constant; +import org.onap.usecaseui.server.constant.CommonConstant; import org.onap.usecaseui.server.service.AlarmsHeaderService; import org.onap.usecaseui.server.service.AlarmsInformationService; import org.onap.usecaseui.server.service.PerformanceHeaderService; @@ -77,7 +77,7 @@ public class DmaapSubscriber implements Runnable { return; } ObjectMapper objMapper = new ObjectMapper(); - objMapper.setDateFormat(new SimpleDateFormat(Constant.DATE_FORMAT)); + objMapper.setDateFormat(new SimpleDateFormat(CommonConstant.DATE_FORMAT)); respList.forEach(rl -> { try { Map<String, Object> eventMaps = |