aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-28 09:55:49 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-28 09:56:01 -0400
commit6ffc97aad02be00b5c68c055f16df8ab600b9ea9 (patch)
tree1e078c0d78ef54f6d8b6bd934d8ed4ad1ebc8714 /bpmn/so-bpmn-infrastructure-common/src
parenteb94991c543a1d9cf3c9b6c4dfca921dedf48da5 (diff)
fixed incorrect groovy method call
Added missing pers to isEmpty and also added relationship present check to prevent null pointer. Change-Id: I7f184c428694e55b75f255d517a53aac7be82aab Issue-ID: SO-924 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy70
1 files changed, 36 insertions, 34 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
index a79483f6e9..eb736f8ffe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
@@ -305,45 +305,47 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
}
AAIResultWrapper wrapper = resourceClient.get(uri)
- List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE)
- uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF))
- uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
-
- if(uriList.isEmpty){
- Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
- String orchestrationStatus = si.get().getOrchestrationStatus()
- String serviceType = si.get().getServiceType()
- execution.setVariable("serviceType", serviceType)
- execution.setVariable("serviceRole", si.get().getServiceRole())
-
- if("TRANSPORT".equalsIgnoreCase(serviceType)){
- if("PendingDelete".equals(orchestrationStatus)){
- execution.setVariable("skipDeactivate", true)
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status: " + orchestrationStatus)
+ if(wrapper.getRelationships().isPresent()){
+ List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE)
+ uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF))
+ uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
+
+ if(uriList.isEmpty()){
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ String orchestrationStatus = si.get().getOrchestrationStatus()
+ String serviceType = si.get().getServiceType()
+ execution.setVariable("serviceType", serviceType)
+ execution.setVariable("serviceRole", si.get().getServiceRole())
+
+ if("TRANSPORT".equalsIgnoreCase(serviceType)){
+ if("PendingDelete".equals(orchestrationStatus)){
+ execution.setVariable("skipDeactivate", true)
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status: " + orchestrationStatus)
+ }
}
- }
- String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: ""
- List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*"));
- boolean isSdncService= false
- for(String listEntry : svcList){
- if(listEntry.equalsIgnoreCase(serviceType)){
- isSdncService = true
- break;
+ String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: ""
+ List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*"));
+ boolean isSdncService= false
+ for(String listEntry : svcList){
+ if(listEntry.equalsIgnoreCase(serviceType)){
+ isSdncService = true
+ break;
+ }
}
- }
- execution.setVariable("sendToSDNC", true)
- if(execution.getVariable("sdncVersion").equals("1610")){
- if(!isSdncService){
- execution.setVariable("sendToSDNC", false)
+ execution.setVariable("sendToSDNC", true)
+ if(execution.getVariable("sdncVersion").equals("1610")){
+ if(!isSdncService){
+ execution.setVariable("sendToSDNC", false)
+ }
}
- }
- }else{
- execution.setVariable("siInUse", true)
- msoLogger.debug("Stopped deleting Service Instance, it has dependencies")
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies")
+ }else{
+ execution.setVariable("siInUse", true)
+ msoLogger.debug("Stopped deleting Service Instance, it has dependencies")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies")
+ }
}
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance not found in aai")