aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java83
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java109
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java22
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java5
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java14
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java242
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java78
9 files changed, 379 insertions, 198 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
index 3c5c5ecb1d..64b7d86b59 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaResponse.java
@@ -20,53 +20,41 @@
package org.openecomp.mso.apihandler.camundabeans;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+// This class must be 100% JSON-compatible with the BPMN WorkflowResponse class.
+// TODO: BPMN and the API-H should use a common class.
/**
- * JavaBean JSON class for a "variables" which contains the xml payload that
- * will be passed to the Camunda process
- *
+ * A synchronous response from a workflow.
*/
-
+@JsonRootName(value = "WorkflowResponse")
public class CamundaResponse {
-
- @JsonProperty("response")
- private String response;
+
+ @JsonProperty("processInstanceId")
+ private String processInstanceId;
+
@JsonProperty("messageCode")
private int messageCode;
+
@JsonProperty("message")
private String message;
- @JsonProperty("processInstanceID")
- private String processInstanceID;
- @JsonProperty("variables")
- private String variables;
- public String getProcessInstanceID() {
- return processInstanceID;
- }
-
- public void setProcessInstanceID(String processInstanceID) {
- this.processInstanceID = processInstanceID;
- }
-
- public String getVariables() {
- return variables;
- }
-
- public void setVariables(String variables) {
- this.variables = variables;
- }
+ @JsonProperty("variables")
+ private Map<String,String> variables;
- public CamundaResponse() {
- }
+ @JsonProperty("content")
+ private String content;
- public String getResponse() {
- return response;
+ public String getProcessInstanceId() {
+ return processInstanceId;
}
- public void setResponse(String response) {
- this.response = response;
+ public void setProcessInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
}
public int getMessageCode() {
@@ -85,13 +73,30 @@ public class CamundaResponse {
this.message = message;
}
+ public Map<String,String> getVariables() {
+ return variables;
+ }
+
+ public void setVariables(Map<String,String> variables) {
+ this.variables = variables;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
@Override
public String toString() {
- return "CamundaResponse [response=" + response + ", messageCode="
- + messageCode + ", message=" + message + "]";
+ return getClass().getSimpleName() + "["
+ + "processInstanceId=" + processInstanceId
+ + ",messageCode=" + messageCode
+ + ",message=" + message
+ + ",variables=" + variables
+ + ",content=" + content
+ + "]";
}
-
-
-
-
-}
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
index faa669133f..9f30e67897 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java
@@ -34,7 +34,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
CommonConstants.REQUEST_ID_HEADER,
CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE,
- CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
+ CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE,
CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE,
@@ -55,7 +55,6 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.REQUEST_ID_HEADER)
private CamundaInput msoRequestId;
-
@JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE)
private CamundaBooleanInput isBaseVfModule;
@@ -68,6 +67,9 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
private CamundaInput serviceInstanceId;
+ @JsonProperty(CommonConstants.CORRELATION_ID)
+ private CamundaInput correlationId;
+
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
private CamundaInput vnfId;
@@ -177,6 +179,16 @@ public class CamundaVIDRequest {
this.serviceInstanceId = serviceInstanceId;
}
+ @JsonProperty(CommonConstants.CORRELATION_ID)
+ public CamundaInput getCorrelationId() {
+ return correlationId;
+ }
+
+ @JsonProperty(CommonConstants.CORRELATION_ID)
+ public void setCorrelationId(CamundaInput correlationId) {
+ this.correlationId = correlationId;
+ }
+
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
public CamundaInput getVnfId() {
return vnfId;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
index 1a086ac35c..85fe52f24c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java
@@ -85,14 +85,10 @@ public class BPELRestClient extends RequestClient {
}
@Override
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd) {
+ public HttpResponse post(RequestClientParamater params) {
return null;
}
-
+
@Override
public HttpResponse get() {
return null;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
index 9cc89530c4..d03aaef258 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java
@@ -20,13 +20,12 @@
package org.openecomp.mso.apihandler.common;
-
import java.io.IOException;
import javax.xml.bind.DatatypeConverter;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.openecomp.mso.apihandler.camundabeans.CamundaBooleanInput;
@@ -51,8 +50,7 @@ public class CamundaClient extends RequestClient{
@Override
public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
- throws ClientProtocolException, IOException{
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException {
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
@@ -77,7 +75,7 @@ public class CamundaClient extends RequestClient{
}
@Override
- public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{
+ public HttpResponse post(String jsonReq) throws IOException {
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
@@ -102,21 +100,13 @@ public class CamundaClient extends RequestClient{
}
@Override
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException{
+ public HttpResponse post(RequestClientParamater params) throws IOException {
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE + url);
- String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
- serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
- serviceType, vnfType, vfModuleType, networkType, requestDetails, recipeParamXsd);
+ String jsonReq = wrapVIDRequest(params);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
-
String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
@@ -128,12 +118,10 @@ public class CamundaClient extends RequestClient{
}
}
}
-
post.setEntity(input);
-
return client.execute(post);
}
-
+
@Override
public HttpResponse get() {
return null;
@@ -150,8 +138,6 @@ public class CamundaClient extends RequestClient{
if(schemaVersion == null){
schemaVersion = "";
}
-
-
try{
CamundaRequest camundaRequest = new CamundaRequest();
CamundaInput camundaInput = new CamundaInput();
@@ -183,52 +169,8 @@ public class CamundaClient extends RequestClient{
return jsonReq;
}
- private String wrapVIDRequest(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParams){
+ private String wrapVIDRequest(RequestClientParamater requestClientParamater) {
String jsonReq = null;
- if(requestId == null){
- requestId ="";
- }
- if(requestAction == null){
- requestAction ="";
- }
- if(serviceInstanceId == null){
- serviceInstanceId ="";
- }
- if(vnfId == null){
- vnfId ="";
- }
- if(vfModuleId == null){
- vfModuleId ="";
- }
- if(volumeGroupId == null){
- volumeGroupId ="";
- }
- if(networkId == null){
- networkId ="";
- }
- if(configurationId == null){
- configurationId ="";
- }
- if(serviceType == null){
- serviceType ="";
- }
- if(vnfType == null){
- vnfType ="";
- }
- if(vfModuleType == null){
- vfModuleType ="";
- }
- if(networkType == null){
- networkType ="";
- }
- if(requestDetails == null){
- requestDetails ="";
- }
-
try{
CamundaVIDRequest camundaRequest = new CamundaVIDRequest();
CamundaInput serviceInput = new CamundaInput();
@@ -238,6 +180,7 @@ public class CamundaClient extends RequestClient{
CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
CamundaInput requestActionInput = new CamundaInput();
CamundaInput serviceInstanceIdInput = new CamundaInput();
+ CamundaInput correlationIdInput = new CamundaInput();
CamundaInput vnfIdInput = new CamundaInput();
CamundaInput vfModuleIdInput = new CamundaInput();
CamundaInput volumeGroupIdInput = new CamundaInput();
@@ -248,23 +191,23 @@ public class CamundaClient extends RequestClient{
CamundaInput vfModuleTypeInput = new CamundaInput();
CamundaInput networkTypeInput = new CamundaInput();
CamundaInput recipeParamsInput = new CamundaInput();
- host.setValue(parseURL());
- requestIdInput.setValue(requestId);
- isBaseVfModuleInput.setValue(isBaseVfModule);
- recipeTimeoutInput.setValue(recipeTimeout);
- requestActionInput.setValue(requestAction);
- serviceInstanceIdInput.setValue(serviceInstanceId);
- vnfIdInput.setValue(vnfId);
- vfModuleIdInput.setValue(vfModuleId);
- volumeGroupIdInput.setValue(volumeGroupId);
- networkIdInput.setValue(networkId);
- configurationIdInput.setValue(configurationId);
- serviceTypeInput.setValue(serviceType);
- vnfTypeInput.setValue(vnfType);
- vfModuleTypeInput.setValue(vfModuleType);
- networkTypeInput.setValue(networkType);
- recipeParamsInput.setValue(recipeParams);
- serviceInput.setValue(requestDetails);
+ requestIdInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestId()));
+ isBaseVfModuleInput.setValue(requestClientParamater.isBaseVfModule());
+ recipeTimeoutInput.setValue(requestClientParamater.getRecipeTimeout());
+ requestActionInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestAction()));
+ serviceInstanceIdInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceInstanceId()));
+ correlationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getCorrelationId()));
+ vnfIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfId()));
+ vfModuleIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleId()));
+ volumeGroupIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVolumeGroupId()));
+ networkIdInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkId()));
+ configurationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getConfigurationId()));
+ serviceTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceType()));
+ vnfTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfType()));
+ vfModuleTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleType()));
+ networkTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkType()));
+ recipeParamsInput.setValue(requestClientParamater.getRecipeParamXsd());
+ serviceInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestDetails()));
camundaRequest.setServiceInput(serviceInput);
camundaRequest.setHost(host);
camundaRequest.setRequestId(requestIdInput);
@@ -273,6 +216,7 @@ public class CamundaClient extends RequestClient{
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
+ camundaRequest.setCorrelationId(correlationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
camundaRequest.setVolumeGroupId(volumeGroupIdInput);
@@ -306,5 +250,4 @@ public class CamundaClient extends RequestClient{
return host;
}
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
index 3941e1e5af..845b140348 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
@@ -25,7 +25,6 @@ import java.io.IOException;
import javax.xml.bind.DatatypeConverter;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
@@ -39,8 +38,7 @@ public class CamundaTaskClient extends RequestClient{
}
@Override
- public HttpResponse post(String jsonReq)
- throws ClientProtocolException, IOException{
+ public HttpResponse post(String jsonReq) throws IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug("Camunda Task url is: "+ url);
@@ -65,25 +63,18 @@ public class CamundaTaskClient extends RequestClient{
@Override
public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
- throws ClientProtocolException, IOException{
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
msoLogger.debug("Method not supported");
return null;
}
-
+
@Override
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException{
- msoLogger.debug("Method not supported");
+ public HttpResponse post(RequestClientParamater params) {
return null;
}
-
+
@Override
- public HttpResponse get() throws ClientProtocolException, IOException{
+ public HttpResponse get() throws IOException{
HttpGet get = new HttpGet(url);
msoLogger.debug("Camunda Task url is: "+ url);
String encryptedCredentials;
@@ -97,7 +88,6 @@ public class CamundaTaskClient extends RequestClient{
}
}
}
-
return client.execute(get);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
index 4dac998527..daa411a963 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java
@@ -25,13 +25,11 @@ public final class CommonConstants {
public static final String DEFAULT_BPEL_AUTH = "admin:admin";
public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-
public static final String REQUEST_ID_HEADER = "mso-request-id";
public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout";
public static final String SCHEMA_VERSION_HEADER = "mso-schema-version";
public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id";
public static final String ACTION_HEADER = "mso-action";
-
public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest";
public static final String CAMUNDA_ROOT_INPUT = "variables";
public static final String CONTENT_TYPE_JSON= "application/json";
@@ -47,13 +45,12 @@ public final class CommonConstants {
public static final int CAMUNDA = 1;
public static final int CAMUNDATASK = 2;
public static final String CAMUNDA_HOST = "host";
- public static final String SDNC_UUID_HEADER = "mso-sdnc-request-id";
-
public static final String REQUEST_ID_VARIABLE = "requestId";
public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule";
public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout";
public static final String REQUEST_ACTION_VARIABLE = "requestAction";
public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId";
+ public static final String CORRELATION_ID = "correlationId";
public static final String VNF_ID_VARIABLE = "vnfId";
public static final String VF_MODULE_ID_VARIABLE = "vfModuleId";
public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId";
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
index d702a63fda..ed5d076d8c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java
@@ -67,17 +67,11 @@ public abstract class RequestClient {
public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws ClientProtocolException, IOException;
- public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
-
- public abstract HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException;
+ public abstract HttpResponse post(String request) throws IOException;
+
+ public abstract HttpResponse post(RequestClientParamater params) throws IOException;
- public abstract HttpResponse get()
- throws ClientProtocolException, IOException;
+ public abstract HttpResponse get() throws IOException;
protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) {
try {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java
new file mode 100644
index 0000000000..4db69199da
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java
@@ -0,0 +1,242 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandler.common;
+
+public class RequestClientParamater {
+
+ private String requestId;
+ private boolean isBaseVfModule;
+ private int recipeTimeout;
+ private String requestAction;
+ private String serviceInstanceId;
+ private String correlationId;
+ private String vnfId;
+ private String vfModuleId;
+ private String volumeGroupId;
+ private String networkId;
+ private String configurationId;
+ private String serviceType;
+ private String vnfType;
+ private String vfModuleType;
+ private String networkType;
+ private String requestDetails;
+ private String recipeParamXsd;
+
+ private RequestClientParamater(Builder builder) {
+ requestId = builder.requestId;
+ isBaseVfModule = builder.isBaseVfModule;
+ recipeTimeout = builder.recipeTimeout;
+ requestAction = builder.requestAction;
+ serviceInstanceId = builder.serviceInstanceId;
+ correlationId = builder.correlationId;
+ vnfId = builder.vnfId;
+ vfModuleId = builder.vfModuleId;
+ volumeGroupId = builder.volumeGroupId;
+ networkId = builder.networkId;
+ configurationId = builder.configurationId;
+ serviceType = builder.serviceType;
+ vnfType = builder.vnfType;
+ vfModuleType = builder.vfModuleType;
+ networkType = builder.networkType;
+ requestDetails = builder.requestDetails;
+ recipeParamXsd = builder.recipeParamXsd;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public boolean isBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ public int getRecipeTimeout() {
+ return recipeTimeout;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public String getVolumeGroupId() {
+ return volumeGroupId;
+ }
+
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public String getVfModuleType() {
+ return vfModuleType;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public String getRequestDetails() {
+ return requestDetails;
+ }
+
+ public String getRecipeParamXsd() {
+ return recipeParamXsd;
+ }
+
+ public static class Builder {
+ private String requestId;
+ private boolean isBaseVfModule;
+ private int recipeTimeout;
+ private String requestAction;
+ private String serviceInstanceId;
+ private String correlationId;
+ private String vnfId;
+ private String vfModuleId;
+ private String volumeGroupId;
+ private String networkId;
+ private String configurationId;
+ private String serviceType;
+ private String vnfType;
+ private String vfModuleType;
+ private String networkType;
+ private String requestDetails;
+ private String recipeParamXsd;
+
+ public Builder setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public Builder setBaseVfModule(boolean baseVfModule) {
+ isBaseVfModule = baseVfModule;
+ return this;
+ }
+
+ public Builder setRecipeTimeout(int recipeTimeout) {
+ this.recipeTimeout = recipeTimeout;
+ return this;
+ }
+
+ public Builder setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public Builder setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ return this;
+ }
+
+ public Builder setCorrelationId(String correlationId) {
+ this.correlationId = correlationId;
+ return this;
+ }
+
+ public Builder setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ return this;
+ }
+
+ public Builder setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ return this;
+ }
+
+ public Builder setVolumeGroupId(String volumeGroupId) {
+ this.volumeGroupId = volumeGroupId;
+ return this;
+ }
+
+ public Builder setNetworkId(String networkId) {
+ this.networkId = networkId;
+ return this;
+ }
+
+ public Builder setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ return this;
+ }
+
+ public Builder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public Builder setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
+ }
+
+ public Builder setVfModuleType(String vfModuleType) {
+ this.vfModuleType = vfModuleType;
+ return this;
+ }
+
+ public Builder setNetworkType(String networkType) {
+ this.networkType = networkType;
+ return this;
+ }
+
+ public Builder setRequestDetails(String requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
+ }
+
+ public Builder setRecipeParamXsd(String recipeParamXsd) {
+ this.recipeParamXsd = recipeParamXsd;
+ return this;
+ }
+
+ public RequestClientParamater build(){
+ return new RequestClientParamater(this);
+ }
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
index 732b7786b2..a8b8984343 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ResponseHandler.java
@@ -27,21 +27,22 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.util.EntityUtils;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
-import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.RootIgnoringObjectMapper;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
public class ResponseHandler {
private CamundaResponse response;
private int status;
- private String responseBody="";
+ private String content = "";
private HttpResponse httpResponse;
private int type;
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
- private static final String RESPONSE_BODY_MSG = "response body is: ";
+ private static final String RESPONSE_CONTENT_MSG = "response content is: ";
public ResponseHandler(HttpResponse httpResponse, int type) {
this.httpResponse = httpResponse;
@@ -67,29 +68,31 @@ public class ResponseHandler {
+ @SuppressWarnings("unchecked")
private void parseCamunda(){
try{
- HttpEntity entity = httpResponse.getEntity();
- responseBody = EntityUtils.toString(entity);
- } catch (IOException e) {
- msoLogger.debug("IOException getting Camunda response body", e);
- }
-
- ObjectMapper mapper = new ObjectMapper();
- try {
- response = mapper.readValue(responseBody, CamundaResponse.class);
- } catch (IOException e) {
- msoLogger.debug("IOException getting Camunda response body", e);
- }
- msoLogger.debug("json response is: " + responseBody);
- if(response!=null){
- responseBody = response.getResponse();
- }
- msoLogger.debug(RESPONSE_BODY_MSG + responseBody);
-
-
+ HttpEntity entity = httpResponse.getEntity();
+ content = EntityUtils.toString(entity);
+ } catch (IOException e) {
+ msoLogger.debug("IOException getting Camunda response content", e);
+ }
+
+ ObjectMapper mapper = new RootIgnoringObjectMapper<CamundaResponse>(CamundaResponse.class);
+
+ try {
+ response = mapper.readValue(content, CamundaResponse.class);
+ } catch (IOException e) {
+ msoLogger.debug("IOException getting Camunda response content", e);
+ }
+ msoLogger.debug("json response is: " + content);
+ if(response!=null){
+ content = response.getContent();
+ }
+ msoLogger.debug(RESPONSE_CONTENT_MSG + content);
+
+
if(status!=HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), responseBody, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda");
+ msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "Camunda", String.valueOf(status), content, "Camunda", "parseCamunda", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda");
}
}
@@ -99,16 +102,16 @@ public class ResponseHandler {
try {
if (bpelEntity!=null) {
- responseBody = EntityUtils.toString(bpelEntity);
- msoLogger.debug(RESPONSE_BODY_MSG + responseBody);
+ content = EntityUtils.toString(bpelEntity);
+ msoLogger.debug(RESPONSE_CONTENT_MSG + content);
}
if(status!=HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), responseBody, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL");
+ msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "BPEL", String.valueOf(status), content, "BPEL", "parseBpel", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from BPEL");
}
}
catch (IOException e) {
- msoLogger.debug("IOException getting BPEL response body", e);
+ msoLogger.debug("IOException getting BPEL response content", e);
}
}
@@ -118,16 +121,16 @@ public class ResponseHandler {
try {
if (camundataskEntity!=null) {
- responseBody = EntityUtils.toString(camundataskEntity);
- msoLogger.debug(RESPONSE_BODY_MSG + responseBody);
+ content = EntityUtils.toString(camundataskEntity);
+ msoLogger.debug(RESPONSE_CONTENT_MSG + content);
}
if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
- msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), responseBody, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task");
+ msoLogger.error(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, "CAMUNDATASK", String.valueOf(status), content, "CAMUNDATASK", "parseCamundaTask", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH from Camunda Task");
}
}
catch (IOException e) {
- msoLogger.debug("IOException getting Camunda Task response body", e);
+ msoLogger.debug("IOException getting Camunda Task response content", e);
}
}
@@ -175,18 +178,17 @@ public class ResponseHandler {
}
- public String getResponseBody() {
- return responseBody;
+ public String getContent() {
+ return content;
}
- public void setResponseBody(String responseBody) {
- this.responseBody = responseBody;
+ public void setContent(String content) {
+ this.content = content;
}
public int getStatus() {
return status;
}
-
}