Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / onap / so / apihandlerinfra / tenantisolation / dmaap / DmaapOperationalEnvClient.java
index 55b1ea6..340d143 100644 (file)
@@ -21,9 +21,7 @@
 package org.onap.so.apihandlerinfra.tenantisolation.dmaap;
 
 import java.io.IOException;
-
 import javax.inject.Provider;
-
 import org.apache.http.HttpStatus;
 import org.onap.so.apihandler.common.ErrorNumbers;
 import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -33,49 +31,53 @@ import org.onap.so.logger.ErrorCode;
 import org.onap.so.logger.MessageEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 @Component
 public class DmaapOperationalEnvClient {
 
-       @Autowired 
-       private Provider<OperationalEnvironmentPublisher> dmaapPublisher;
-       
-       protected String buildRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String tenantContext, String workloadContext, String action ) 
-                                       throws ApiException {
-               final CreateEcompOperationEnvironmentBean operationalEnv = new CreateEcompOperationEnvironmentBean();
-               operationalEnv.withOperationalEnvironmentId(operationalEnvironmentId)
-                  .withOperationalEnvironmentName(operationalEnvironmentName)          
-                          .withOperationalEnvironmentType(operationalEnvironmentType)
-                          .withTenantContext(tenantContext)
-                          .withWorkloadContext(workloadContext)
-                          .withaction(action);
-               try {
-                       return this.getJson(operationalEnv);
-               }catch(JsonProcessingException ex){
-                       ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
-                       ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(),
-                                       HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex).errorInfo(errorLoggerInfo).build();
+    @Autowired
+    private Provider<OperationalEnvironmentPublisher> dmaapPublisher;
+
+    protected String buildRequest(String operationalEnvironmentId, String operationalEnvironmentName,
+            String operationalEnvironmentType, String tenantContext, String workloadContext, String action)
+            throws ApiException {
+        final CreateEcompOperationEnvironmentBean operationalEnv = new CreateEcompOperationEnvironmentBean();
+        operationalEnv.withOperationalEnvironmentId(operationalEnvironmentId)
+                .withOperationalEnvironmentName(operationalEnvironmentName)
+                .withOperationalEnvironmentType(operationalEnvironmentType).withTenantContext(tenantContext)
+                .withWorkloadContext(workloadContext).withaction(action);
+        try {
+            return this.getJson(operationalEnv);
+        } catch (JsonProcessingException ex) {
+            ErrorLoggerInfo errorLoggerInfo =
+                    new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+                            .build();
+            ValidateException validateException =
+                    new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(),
+                            HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex)
+                                    .errorInfo(errorLoggerInfo).build();
+
+            throw validateException;
+        }
+    }
+
+    protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException {
+
+        final ObjectMapper mapper = new ObjectMapper();
+        return mapper.writeValueAsString(obj);
 
-                       throw validateException;
-               }
-       }
+    }
 
-       protected String getJson(CreateEcompOperationEnvironmentBean obj) throws JsonProcessingException {
-               
-               final ObjectMapper mapper = new ObjectMapper();
-               return mapper.writeValueAsString(obj);
-               
-       }
-       
-       public void dmaapPublishOperationalEnvRequest(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, 
-                                       String tenantContext, String workloadContext, String action ) throws ApiException, IOException, InterruptedException {
+    public void dmaapPublishOperationalEnvRequest(String operationalEnvironmentId, String operationalEnvironmentName,
+            String operationalEnvironmentType, String tenantContext, String workloadContext, String action)
+            throws ApiException, IOException, InterruptedException {
 
-               String request = this.buildRequest(operationalEnvironmentId, operationalEnvironmentName, operationalEnvironmentType, tenantContext, workloadContext, action);
-               dmaapPublisher.get().send(request);
+        String request = this.buildRequest(operationalEnvironmentId, operationalEnvironmentName,
+                operationalEnvironmentType, tenantContext, workloadContext, action);
+        dmaapPublisher.get().send(request);
 
-       }
+    }
 
 }