aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java110
1 files changed, 55 insertions, 55 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
index d8c785dcb3..d6d999b4b5 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
@@ -23,9 +23,7 @@
package org.onap.so.apihandler.common;
import java.io.IOException;
-
import javax.xml.bind.DatatypeConverter;
-
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@@ -33,64 +31,66 @@ import org.apache.http.entity.StringEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class CamundaTaskClient extends RequestClient{
- private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
+public class CamundaTaskClient extends RequestClient {
+ private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
+
+ public CamundaTaskClient() {
+ super(CommonConstants.CAMUNDATASK);
+ }
+
+ @Override
+ public HttpResponse post(String jsonReq) throws IOException {
+ HttpPost post = new HttpPost(url);
+ logger.debug("Camunda Task url is: {}", url);
- public CamundaTaskClient() {
- super(CommonConstants.CAMUNDATASK);
- }
-
- @Override
- public HttpResponse post(String jsonReq) throws IOException{
- HttpPost post = new HttpPost(url);
- logger.debug("Camunda Task url is: {}", url);
+ StringEntity input = new StringEntity(jsonReq);
+ input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
+ String encryptedCredentials;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader("Authorization",
+ "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
+ }
+ }
+ }
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + DatatypeConverter
- .printBase64Binary(userCredentials.getBytes()));
- }
- }
- }
+ post.setEntity(input);
+ return client.execute(post);
+ }
- post.setEntity(input);
- return client.execute(post);
- }
-
- @Override
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
- throw new UnsupportedOperationException("Method not supported.");
- }
+ @Override
+ public HttpResponse post(String camundaReqXML, String requestId, String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
- @Override
- public HttpResponse post(RequestClientParameter params) {
- throw new UnsupportedOperationException("Method not supported.");
- }
+ @Override
+ public HttpResponse post(RequestClientParameter params) {
+ throw new UnsupportedOperationException("Method not supported.");
+ }
- @Override
- public HttpResponse get() throws IOException {
- HttpGet get = new HttpGet(url);
- logger.debug("Camunda Task url is: {}", url);
- String encryptedCredentials;
- if(props!=null){
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if(encryptedCredentials != null){
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter
- .printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
- return client.execute(get);
- }
+ @Override
+ public HttpResponse get() throws IOException {
+ HttpGet get = new HttpGet(url);
+ logger.debug("Camunda Task url is: {}", url);
+ String encryptedCredentials;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ get.addHeader("Authorization",
+ "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+ return client.execute(get);
+ }
}