diff options
author | 2018-05-24 11:32:30 +0200 | |
---|---|---|
committer | 2018-05-24 11:49:26 +0200 | |
commit | 155f10aee25fc1f89929e13a4a62a8335ee33279 (patch) | |
tree | 8c7a34799293f1497c3bd68387415743e061aa48 /mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java | |
parent | 3ad1f7e9fd56d2d0eb9f0bde46b5b48cea9ed97a (diff) |
Revert correlationId impl
This reverts commit c40b51651eff7997eb1bc823644a059b5406868c.
Change-Id: I99e03cf9be05110ca7b4609a35ce7106f3c30b3b
Issue-ID: SO-640
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java | 109 |
1 files changed, 83 insertions, 26 deletions
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 d03aaef258..9cc89530c4 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,12 +20,13 @@ 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; @@ -50,7 +51,8 @@ public class CamundaClient extends RequestClient{ @Override public HttpResponse post(String camundaReqXML, String requestId, - String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException { + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) + throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); @@ -75,7 +77,7 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(String jsonReq) throws IOException { + public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); @@ -100,13 +102,21 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(RequestClientParamater params) throws IOException { + 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{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); - String jsonReq = wrapVIDRequest(params); + String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, + serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, + serviceType, vnfType, vfModuleType, networkType, requestDetails, recipeParamXsd); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); @@ -118,10 +128,12 @@ public class CamundaClient extends RequestClient{ } } } + post.setEntity(input); + return client.execute(post); } - + @Override public HttpResponse get() { return null; @@ -138,6 +150,8 @@ public class CamundaClient extends RequestClient{ if(schemaVersion == null){ schemaVersion = ""; } + + try{ CamundaRequest camundaRequest = new CamundaRequest(); CamundaInput camundaInput = new CamundaInput(); @@ -169,8 +183,52 @@ public class CamundaClient extends RequestClient{ return jsonReq; } - private String wrapVIDRequest(RequestClientParamater requestClientParamater) { + 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){ 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(); @@ -180,7 +238,6 @@ 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(); @@ -191,23 +248,23 @@ public class CamundaClient extends RequestClient{ CamundaInput vfModuleTypeInput = new CamundaInput(); CamundaInput networkTypeInput = new CamundaInput(); CamundaInput recipeParamsInput = new CamundaInput(); - 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())); + 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); camundaRequest.setServiceInput(serviceInput); camundaRequest.setHost(host); camundaRequest.setRequestId(requestIdInput); @@ -216,7 +273,6 @@ 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); @@ -250,4 +306,5 @@ public class CamundaClient extends RequestClient{ return host; } + } |