diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2022-08-12 10:42:36 +0800 |
---|---|---|
committer | Guangrong Fu <fu.guangrong@zte.com.cn> | 2022-08-12 10:42:40 +0800 |
commit | 0138ee36fd9fa7f5b4d33d45ec1bc1aa0c9c4e45 (patch) | |
tree | f42cfef4cea1461f6b66663277b2ac725cd9a92e /rules/ccvpn2-rule.drl | |
parent | 857c9da5ed2a2775ac7426d97a99195d671c21b5 (diff) |
Replaced ServiceLocator with SpringContextUtil
Issue-ID: HOLMES-511
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Change-Id: I0f881f66766c8d084424111f0529895c94565ad0
Diffstat (limited to 'rules/ccvpn2-rule.drl')
-rw-r--r-- | rules/ccvpn2-rule.drl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/rules/ccvpn2-rule.drl b/rules/ccvpn2-rule.drl index 0d34932..54fa8a2 100644 --- a/rules/ccvpn2-rule.drl +++ b/rules/ccvpn2-rule.drl @@ -9,10 +9,9 @@ dialect "java" import org.onap.holmes.common.dmaap.entity.PolicyMsg; import org.onap.holmes.common.dmaap.DmaapService; import org.onap.holmes.common.utils.DroolsLog; - import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder; + import org.onap.holmes.common.utils.SpringContextUtil; - import com.alibaba.fastjson.JSONArray; - import com.alibaba.fastjson.JSONObject; + import com.google.gson.JsonObject; import java.util.List; import java.util.Map; @@ -32,17 +31,17 @@ dialect "java" function Map<String, Object> getAdditionalResourceInfo(VesAlarm a, String bandwidth) { AaiQuery4Ccvpn2 aai = AaiQuery4Ccvpn2.newInstance(); - JSONObject instance = aai.getServiceInstance(getAdditionalField(a, "siteService")); + JsonObject instance = aai.getServiceInstance(getAdditionalField(a, "siteService")); Map<String, Object> ret = new HashMap<String, Object>(); - ret.put("service-instance.service-instance-id", instance.getString("service-instance-id")); + ret.put("service-instance.service-instance-id", instance.get("service-instance-id").getAsString()); ret.put("vserver.vserver-name", "TBD"); - ret.put("globalSubscriberId", instance.getString("globalSubscriberId")); - ret.put("serviceType", instance.getString("serviceType")); + ret.put("globalSubscriberId", instance.get("globalSubscriberId").getAsString()); + ret.put("serviceType", instance.get("serviceType").getAsString()); ret.put("vserver.is-closed-loop-disabled", "false"); ret.put("vserver.prov-status", "ACTIVE"); ret.put("bandwidth", bandwidth); ret.put("bandwidth-change-time", getAdditionalField(a, "timestamp")); - ret.put("vnfId", instance.getString("vnfId")); + ret.put("vnfId", instance.get("vnfId").getAsString()); return ret; } @@ -75,7 +74,7 @@ dialect "java" bandwidth = "10000"; } PolicyMsg msg = createPolicyMsg($a, bandwidth); - DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class); + DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class); dmaapService.publishPolicyMsg(msg, "dcae_cl_out"); $a.setRootFlag(1); end |