From 4d163375fd9a3ad60ab57e078859230a07911662 Mon Sep 17 00:00:00 2001 From: luxin Date: Wed, 20 Sep 2017 11:45:05 +0800 Subject: Replace duplicating literal Change-Id: I452679a049d29f13b549c5dc7c691f68945f7005 Issue-Id:VFC-375 Signed-off-by: luxin --- .../vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java | 12 ++++++------ .../nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'huawei/vnfmadapter/VnfmadapterService') diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java index 3bc7346b..33730fd2 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java @@ -78,7 +78,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { if(statusCode == Constant.HTTP_CREATED || statusCode == Constant.HTTP_OK) { restJson.put(Constant.RETCODE, Constant.REST_SUCCESS); JSONObject resultObj = new JSONObject(); - resultObj.put("jobId", vnfInstanceId + "_" + Constant.PUT); + resultObj.put(Constant.JOBID, vnfInstanceId + "_" + Constant.PUT); restJson.put("data", resultObj); } else { LOG.error("function=scaleVnf, msg=send create vnf msg to csm get wrong status: " + statusCode); @@ -134,7 +134,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { JSONObject appInfo = JSONObject.fromObject(queryResult.getString("data")).getJSONObject("app_info"); JSONObject resultObj = new JSONObject(); resultObj.put("vnfInstanceId", appInfo.getString("id")); - resultObj.put("jobId", appInfo.getString("id") + "_" + Constant.POST); + resultObj.put(Constant.JOBID, appInfo.getString("id") + "_" + Constant.POST); restJson.put("data", resultObj); } else { LOG.error("function=createVnf, msg=send create vnf msg to csm get wrong status: " + statusCode); @@ -162,7 +162,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { if(statusCode == Constant.HTTP_NOCONTENT) { restJson.put(Constant.RETCODE, Constant.REST_SUCCESS); JSONObject resultObj = new JSONObject(); - resultObj.put("jobId", vnfId + "_" + Constant.DELETE); + resultObj.put(Constant.JOBID, vnfId + "_" + Constant.DELETE); restJson.put("data", resultObj); } else { LOG.error("function=removeVnf, msg=send remove vnf msg to csm get wrong status: {}", statusCode); @@ -181,7 +181,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { String.format(ParamConstants.VNF_INSTANCE_GET, vnfId) + Constant.ROARAND + "&type=status", Constant.GET, null, Constant.CERTIFICATE); - int statusCode = queryResult.getInt("retCode"); + int statusCode = queryResult.getInt(Constant.RETCODE); if(statusCode == Constant.HTTP_OK || statusCode == Constant.HTTP_CREATED) { if(null == (queryResult.get("data"))) { @@ -208,7 +208,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { String.format(ParamConstants.VNF_INSTANCE_GET, vnfId) + Constant.ROARAND + "&type=status", Constant.GET, null, Constant.CERTIFICATE); - int statusCode = queryResult.getInt("retCode"); + int statusCode = queryResult.getInt(Constant.RETCODE); if(statusCode == Constant.HTTP_OK || statusCode == Constant.HTTP_CREATED) { @@ -255,7 +255,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr { JSONObject healResult = ResultRequestUtil.callSouth(vnfmObjcet, path, Constant.PUT, subJsonObject.toString(), Constant.CERTIFICATE); - int statusCode = healResult.getInt("retCode"); + int statusCode = healResult.getInt(Constant.RETCODE); if(statusCode == Constant.HTTP_OK) { restJson.put(Constant.RETCODE, Constant.REST_SUCCESS); diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java index 5733efa7..9e58d6bb 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/process/VnfMgr.java @@ -202,7 +202,7 @@ public class VnfMgr { basicInfoJson.put("vnfInstanceDescription", "vFW"); Vnfm vnfm = vnfmDao.getVnfmById(retJson.getString("id")); - basicInfoJson.put("vnfdId", vnfm == null ? "" : vnfm.getVnfdId()); + basicInfoJson.put(Constant.VNFDID, vnfm == null ? "" : vnfm.getVnfdId()); basicInfoJson.put("vnfdPackageId", vnfm == null ? "" : vnfm.getVnfPackageId()); basicInfoJson.put("version", vnfm == null ? "" : vnfm.getVersion()); basicInfoJson.put("vnfProvider", "hw"); @@ -227,7 +227,7 @@ public class VnfMgr { private JSONObject transferVnfBody(JSONObject vnfObject, JSONObject resObject, String vnfmId) { JSONObject restJson = new JSONObject(); JSONObject vappIfno = new JSONObject(); - restJson.put("vnfd_id", resObject.getString("vnfdId")); + restJson.put("vnfd_id", resObject.getString(Constant.VNFDID)); restJson.put("plan_id", resObject.getOrDefault("planId", "")); restJson.put("plan_name", resObject.getOrDefault("planName", "")); restJson.put("vapp_name", vnfObject.get("vnfInstanceName")); @@ -283,7 +283,7 @@ public class VnfMgr { Vnfm info = new Vnfm(); info.setId(vnfObject.getJSONObject("data").getString("vnfInstanceId")); info.setVersion(resObject.getString("vnfdVersion")); - info.setVnfdId(resObject.getString("vnfdId")); + info.setVnfdId(resObject.getString(Constant.VNFDID)); info.setVnfPackageId(""); try { vnfmDao.insertVnfm(info); -- cgit 1.2.3-korg