aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-06 15:15:35 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-06 15:15:35 +0000
commit2c9a77e893d414b8af81668dc9945691f4466528 (patch)
treefb1acd7bdfb2bdf34962c3f4b5d43e95d0239908 /bpmn/so-bpmn-infrastructure-common
parent89f384164a2712f7515497fe16b55e585266c79b (diff)
parentfb6ab40a64e74876ba1f08c4d3bdb6a040c21b94 (diff)
Merge "Bug fixes November 5th" into casablanca
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy44
2 files changed, 18 insertions, 55 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
index 3c08779513..1be4989490 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
@@ -240,11 +240,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
if(obj.has("result-data")){
JSONObject ob = obj.getJSONArray("result-data").getJSONObject(0)
String resourceLink = ob.getString("resource-link")
+ AAIResourceUri siUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, new URI(resourceLink))
- String[] split = resourceLink.split("/aai/")
- String siRelatedLink = "/aai/" + split[1]
-
- execution.setVariable("PSI_resourceLink", resourceLink)
+ execution.setVariable("PSI_resourceLink", siUri)
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
}
@@ -277,26 +275,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
//AAI PUT
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
- String siResourceLink= execution.getVariable("PSI_resourceLink")
-
- String siUri = ""
- msoLogger.debug("PSI_resourceLink:" + siResourceLink)
-
- if(!isBlank(siResourceLink)) {
- msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink)
- String[] split = siResourceLink.split("/aai/")
- siUri = "/aai/" + split[1]
- }
- else
- {
- msg = "Parent Service Link in AAI is null"
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
- execution.setVariable("aaiARPath", arUrl)
+ AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
+ AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
+ execution.setVariable("aaiARPath", arUtils.createARUrl(execution, siResourceLink, allottedResourceId))
msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl)
String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
index 5f9b4b8ecd..48eb1c85f9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
@@ -20,23 +20,22 @@
package org.onap.so.bpmn.vcpe.scripts;
+import static org.apache.commons.lang3.StringUtils.*
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.*;
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.rest.APIResponse
-
-import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.apache.commons.lang3.*
-import org.springframework.web.util.UriUtils;
-import static org.apache.commons.lang3.StringUtils.*
-
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
/**
* This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process.
@@ -204,26 +203,9 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
//AAI PUT
AaiUtil aaiUriUtil = new AaiUtil(this)
- String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
- String siResourceLink= execution.getVariable("PSI_resourceLink")
-
- String siUri = ""
- msoLogger.debug("PSI_resourceLink:" + siResourceLink)
-
- if(!isBlank(siResourceLink)) {
- msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink)
- String[] split = siResourceLink.split("/aai/")
- siUri = "/aai/" + split[1]
- }
- else
- {
- msg = "Parent Service Link in AAI is null"
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
- execution.setVariable("aaiARPath", arUrl)
+ AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
+ AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
+ execution.setVariable("aaiARPath", arUtils.createARUrl(execution, siResourceLink, allottedResourceId))
msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl)
String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)