aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2018-04-21 15:40:05 +0800
committerc00149107 <chenchuanyu@huawei.com>2018-04-21 16:15:00 +0800
commit7ded7cc8a1c4282e4cc84d4f82f73491f0bf3f08 (patch)
tree63ecd2c97aacac8d6027f176e4075c3d5b9cf1b0
parent479d72f82afa3b2a84c68358f2462a5d9cb4e0e9 (diff)
Recipe param xsd support
Recipe param xsd support Change-Id: I561d98358a76f1007b979cdf6753d2f3b7754991 Issue-ID: SO-583 Signed-off-by: c00149107 <chenchuanyu@huawei.com>
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java40
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java14
3 files changed, 32 insertions, 24 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
index 5be6970554..7d6aed4785 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -24,6 +24,10 @@ import java.util.Map;
import org.openecomp.mso.db.catalog.beans.Recipe;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
/**
* serivce csar query support
* <br>
@@ -41,16 +45,6 @@ public class QueryResourceRecipe extends CatalogQuery{
this.resourceRecipe =resourceRecipe;
}
- private final String template =
- "\t{\n"+
- "\t\t\"id\" : <ID>,\n"+
- "\t\t\"action\" : <ACTION>,\n"+
- "\t\t\"orchestrationUri\" : <ORCHESTRATION_URI>,\n"+
- "\t\t\"recipeTimeout\" : <RECIPE_TIMEOUT>,\n"+
- "\t\t\"paramXSD\" : <PARAM_XSD>,\n"+
- "\t\t\"description\" : <DESCRIPTION>\n"+
- "\t}";
-
@Override
public String toString() {
@@ -58,15 +52,25 @@ public class QueryResourceRecipe extends CatalogQuery{
}
@Override
- public String JSON2(boolean isArray, boolean isEmbed) {
+ public String JSON2(boolean isArray, boolean isEmbed) {
+
Map<String, String> valueMap = new HashMap<>();
- put(valueMap, "ID", null == resourceRecipe ? null : resourceRecipe.getId());
- put(valueMap, "ACTION", null == resourceRecipe ? null : resourceRecipe.getAction());
- put(valueMap, "ORCHESTRATION_URI", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
- put(valueMap, "RECIPE_TIMEOUT", null == resourceRecipe ? null : resourceRecipe.getRecipeTimeout());
- put(valueMap, "PARAM_XSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
- put(valueMap, "DESCRIPTION", null == resourceRecipe ? null : resourceRecipe.getDescription());
- return this.setTemplate(template, valueMap);
+ valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId()));
+ valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction());
+ valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
+ valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout()));
+ valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
+ valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription());
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ String jsonStr = "";
+ try {
+ jsonStr = mapper.writeValueAsString(valueMap);
+ } catch(JsonProcessingException e) {
+
+ e.printStackTrace();
+ }
+ return jsonStr;
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index ca32420b73..9f3910beed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -80,6 +80,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
//deal with operation key
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
+ //set local globalSubscriberId variable
+ execution.setVariable("globalSubscriberId", globalSubscriberId);
String serviceType = execution.getVariable("serviceType")
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 0aeb0c6310..25141a0c40 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -84,13 +84,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException {
logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
- String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
- HttpPost httpPost = new HttpPost(url);
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint");
+ HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
String postBody = getPostStringBody(resourceOperationStatus);
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
- httpPost(url, httpPost);
+ httpPost(requestsdbEndPoint, httpPost);
logger.info("AbstractSdncOperationTask.updateResOperStatus end!");
}
@@ -165,13 +166,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException {
logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!");
- String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
- HttpPost httpPost = new HttpPost(url);
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint");
+ HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID);
httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML));
- String result = httpPost(url, httpPost);
+ String result = httpPost(requestsdbEndPoint, httpPost);
ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result);
logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!");
return resourceOperationStatus;