Change code in appc dispatcher for new LCMs in R6
[appc.git] / appc-dispatcher / appc-request-handler / appc-request-handler-core / src / main / java / org / onap / appc / requesthandler / conv / Converter.java
index 84605ff..3a02e4d 100644 (file)
@@ -2,30 +2,29 @@
  * ============LICENSE_START=======================================================
  * ONAP : APPC
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * ================================================================================
- * Modifications Copyright (C) 2018 Orange
+ * Modifications Copyright (C) 2018-2019 Orange
  * =============================================================================
  * 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.onap.appc.requesthandler.conv;
 
-import com.att.aft.dme2.internal.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 
@@ -67,21 +66,24 @@ public class Converter {
         isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
     }
 
-    public static Builder<?> convAsyncResponseToBuilder(VNFOperation vnfOperation, String rpcName, ResponseContext response) {
+    public static Builder<?> convAsyncResponseToBuilder(
+            VNFOperation vnfOperation, String rpcName, ResponseContext response) {
         Builder<?> outObj = null;
-        if(response == null){
+        if (response == null) {
             throw new IllegalArgumentException("empty asyncResponse");
         }
-        if(vnfOperation == null){
+        if (vnfOperation == null) {
             throw new IllegalArgumentException("empty asyncResponse.action");
         }
-        logger.debug("Entered Converter.convAsyncResponseToBuilder()");
-        Action action = Action.valueOf(vnfOperation.name());
+        logger.debug("Entered Converter.convAsyncResponseToBuilder(): Operation Name " + vnfOperation.name());
+        org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action action =
+                org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action.valueOf(vnfOperation.name());
+        logger.debug("After resolving action");
         CommonHeader commonHeader = convAsyncResponseTorev160108CommonHeader(response);
         Status status = convAsyncResponseTorev160108Status(response);
         Payload payload = convAsyncResponseTorev160108Payload(response);
-        logger.debug("Extracted action, status, payload ");
-        switch (action){
+        logger.debug("Extracted action, status, payload");
+        switch (action) {
             case Rollback:
                 outObj = new RollbackOutputBuilder();
                 ((RollbackOutputBuilder)outObj).setCommonHeader(commonHeader);
@@ -92,9 +94,10 @@ public class Converter {
                 ((SnapshotOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((SnapshotOutputBuilder)outObj).setStatus(status);
                 try {
-                    ((SnapshotOutputBuilder) outObj).setSnapshotId(response.getAdditionalContext().get("output.snapshot-id"));
+                    ((SnapshotOutputBuilder) outObj)
+                            .setSnapshotId(response.getAdditionalContext().get("output.snapshot-id"));
                 } catch (NullPointerException ignored) {
-                    // in case of negative response, snapshotID does not populated, so just ignore NPL
+                    // in case of negative response, snapshotID is not populated, so just ignore NPL
                 }
                 return outObj;
             case Audit:
@@ -108,7 +111,7 @@ public class Converter {
                 ((HealthCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((HealthCheckOutputBuilder)outObj).setStatus(status);
                 ((HealthCheckOutputBuilder)outObj).setPayload(payload);
-                logger.debug("In HealthCheck case- created outObj, returning");
+                logger.debug("In HealthCheck case: created outObj, returning");
                 return outObj;
             case LiveUpgrade:
                 outObj = new LiveUpgradeOutputBuilder();
@@ -226,26 +229,31 @@ public class Converter {
                 outObj = new StopApplicationOutputBuilder();
                 ((StopApplicationOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((StopApplicationOutputBuilder)outObj).setStatus(status);
+                ((StopApplicationOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case StartApplication:
                 outObj = new StartApplicationOutputBuilder();
                 ((StartApplicationOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((StartApplicationOutputBuilder)outObj).setStatus(status);
+                ((StartApplicationOutputBuilder)outObj).setPayload(payload);
                 return outObj;
-    case QuiesceTraffic:
+            case QuiesceTraffic:
                 outObj = new QuiesceTrafficOutputBuilder();
                 ((QuiesceTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((QuiesceTrafficOutputBuilder)outObj).setStatus(status);
+                ((QuiesceTrafficOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case ResumeTraffic:
                 outObj = new ResumeTrafficOutputBuilder();
                 ((ResumeTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((ResumeTrafficOutputBuilder)outObj).setStatus(status);
+                ((ResumeTrafficOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case UpgradeSoftware:
                 outObj = new UpgradeSoftwareOutputBuilder();
                 ((UpgradeSoftwareOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((UpgradeSoftwareOutputBuilder)outObj).setStatus(status);
+                ((UpgradeSoftwareOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case UpgradePostCheck:
                 outObj = new UpgradePostCheckOutputBuilder();
@@ -257,11 +265,13 @@ public class Converter {
                 outObj = new UpgradeBackupOutputBuilder();
                 ((UpgradeBackupOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((UpgradeBackupOutputBuilder)outObj).setStatus(status);
+                ((UpgradeBackupOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case UpgradeBackout:
                 outObj = new UpgradeBackoutOutputBuilder();
                 ((UpgradeBackoutOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((UpgradeBackoutOutputBuilder)outObj).setStatus(status);
+                ((UpgradeBackoutOutputBuilder)outObj).setPayload(payload);
                 return outObj;
             case UpgradePreCheck:
                 outObj = new UpgradePreCheckOutputBuilder();
@@ -273,7 +283,7 @@ public class Converter {
                 outObj = new AttachVolumeOutputBuilder();
                 ((AttachVolumeOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((AttachVolumeOutputBuilder)outObj).setStatus(status);
-                return outObj;  
+                return outObj;
             case DetachVolume:
                 outObj = new DetachVolumeOutputBuilder();
                 ((DetachVolumeOutputBuilder)outObj).setCommonHeader(commonHeader);
@@ -284,42 +294,125 @@ public class Converter {
                 ((DistributeTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
                 ((DistributeTrafficOutputBuilder)outObj).setStatus(status);
                 return outObj;
+            case DistributeTrafficCheck:
+                outObj = new DistributeTrafficCheckOutputBuilder();
+                ((DistributeTrafficCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((DistributeTrafficCheckOutputBuilder)outObj).setStatus(status);
+                return outObj;
+            case PreConfigure:
+                outObj = new PreConfigureOutputBuilder();
+                ((PreConfigureOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PreConfigureOutputBuilder)outObj).setStatus(status);
+                ((PreConfigureOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case GetConfig:
+                outObj = new GetConfigOutputBuilder();
+                ((GetConfigOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((GetConfigOutputBuilder)outObj).setStatus(status);
+                ((GetConfigOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PostEvacuate:
+                outObj = new PostEvacuateOutputBuilder();
+                ((PostEvacuateOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PostEvacuateOutputBuilder)outObj).setStatus(status);
+                ((PostEvacuateOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PreMigrate:
+                outObj = new PreMigrateOutputBuilder();
+                ((PreMigrateOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PreMigrateOutputBuilder)outObj).setStatus(status);
+                ((PreMigrateOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PostMigrate:
+                outObj = new PostMigrateOutputBuilder();
+                ((PostMigrateOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PostMigrateOutputBuilder)outObj).setStatus(status);
+                ((PostMigrateOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PreRebuild:
+                outObj = new PreRebuildOutputBuilder();
+                ((PreRebuildOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PreRebuildOutputBuilder)outObj).setStatus(status);
+                ((PreRebuildOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case Provisioning:
+                outObj = new ProvisioningOutputBuilder();
+                ((ProvisioningOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((ProvisioningOutputBuilder)outObj).setStatus(status);
+                ((ProvisioningOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PostRebuild:
+                outObj = new PostRebuildOutputBuilder();
+                ((PostRebuildOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PostRebuildOutputBuilder)outObj).setStatus(status);
+                ((PostRebuildOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case PreEvacuate:
+                outObj = new PreEvacuateOutputBuilder();
+                ((PreEvacuateOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((PreEvacuateOutputBuilder)outObj).setStatus(status);
+                ((PreEvacuateOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case StartTraffic:
+                outObj = new StartTrafficOutputBuilder();
+                ((StartTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((StartTrafficOutputBuilder)outObj).setStatus(status);
+                ((StartTrafficOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case StatusTraffic:
+                outObj = new StatusTrafficOutputBuilder();
+                ((StatusTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((StatusTrafficOutputBuilder)outObj).setStatus(status);
+                ((StatusTrafficOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case StopTraffic:
+                outObj = new StopTrafficOutputBuilder();
+                ((StopTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((StopTrafficOutputBuilder)outObj).setStatus(status);
+                ((StopTrafficOutputBuilder)outObj).setPayload(payload);
+                return outObj;
+            case LicenseManagement:
+                outObj = new LicenseManagementOutputBuilder();
+                ((LicenseManagementOutputBuilder)outObj).setCommonHeader(commonHeader);
+                ((LicenseManagementOutputBuilder)outObj).setStatus(status);
+                ((LicenseManagementOutputBuilder)outObj).setPayload(payload);
+                return outObj;
             default:
                 throw new IllegalArgumentException(action+" action is not supported");
         }
     }
 
-    public static Payload convAsyncResponseTorev160108Payload(ResponseContext inObj)  {
-       logger.debug("Entering convAsyncResponseTorev160108Payload" );
+    public static Payload convAsyncResponseTorev160108Payload(ResponseContext inObj) {
+        logger.debug("Entering convAsyncResponseTorev160108Payload");
         Payload payload = null;
-        if(inObj.getPayload() != null) {
+        if (inObj.getPayload() != null) {
             payload = new Payload(inObj.getPayload());
         }
-        logger.debug("Exiting convAsyncResponseTorev160108Payload" );
+        logger.debug("Exiting convAsyncResponseTorev160108Payload");
         return payload;
     }
 
     public static String convPayloadObjectToJsonString(Object inObj) throws ParseException {
         String payloadAsString = null;
-        if(inObj != null) {
+        if (inObj != null) {
 
-                if(inObj instanceof String){
-                    payloadAsString = (String)inObj;
-                }else {
-                    try {
-                        ObjectMapper objectMapper = new ObjectMapper();
-                        payloadAsString = objectMapper.writeValueAsString(inObj);
-                    } catch (JsonProcessingException e) {
-                        String errMsg = "Error serialize payload json to string";
-                        throw new ParseException(errMsg + "-" + e.toString(), 0);
-                    }
+            if (inObj instanceof String) {
+                payloadAsString = (String)inObj;
+            } else {
+                try {
+                    ObjectMapper objectMapper = new ObjectMapper();
+                    payloadAsString = objectMapper.writeValueAsString(inObj);
+                } catch (JsonProcessingException e) {
+                    String errMsg = "Error serialize payload json to string";
+                    throw new ParseException(errMsg + "-" + e.toString(), 0);
                 }
+            }
         }
         return payloadAsString;
     }
 
     public static Status convAsyncResponseTorev160108Status(ResponseContext inObj) {
-       logger.debug("Entering convAsyncResponseTorev160108Status");
+        logger.debug("Entering convAsyncResponseTorev160108Status");
         StatusBuilder statusBuilder = new StatusBuilder();
         statusBuilder.setCode(inObj.getStatus().getCode());
         statusBuilder.setMessage(inObj.getStatus().getMessage());
@@ -328,15 +421,15 @@ public class Converter {
     }
 
     public static CommonHeader convAsyncResponseTorev160108CommonHeader(ResponseContext inObj) {
-       logger.debug("Entered into convAsyncResponseTorev160108CommonHeader");
+        logger.debug("Entered into convAsyncResponseTorev160108CommonHeader");
         CommonHeader outObj = null;
-        if(inObj == null){
+        if (inObj == null) {
             throw new IllegalArgumentException("empty asyncResponse");
         }
 
         CommonHeaderBuilder commonHeaderBuilder = new CommonHeaderBuilder();
         org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags commonHeaderFlags;
-        if(inObj.getCommonHeader().getFlags() != null){
+        if (inObj.getCommonHeader().getFlags() != null) {
             commonHeaderFlags = Converter.convFlagsMapTorev160108Flags(inObj.getCommonHeader().getFlags());
             commonHeaderBuilder.setFlags(commonHeaderFlags);
         }
@@ -344,15 +437,15 @@ public class Converter {
         logger.debug("Before setApiVer");
         commonHeaderBuilder.setApiVer(inObj.getCommonHeader().getApiVer());
         commonHeaderBuilder.setRequestId(inObj.getCommonHeader().getRequestId());
-        if(inObj.getCommonHeader().getSubRequestId() != null){
+        if (inObj.getCommonHeader().getSubRequestId() != null) {
             commonHeaderBuilder.setSubRequestId(inObj.getCommonHeader().getSubRequestId());
         }
         logger.debug("Before getOriginatorId");
-        if(inObj.getCommonHeader().getOriginatorId() != null){
+        if (inObj.getCommonHeader().getOriginatorId() != null) {
             commonHeaderBuilder.setOriginatorId(inObj.getCommonHeader().getOriginatorId());
         }
         logger.debug("Before getTimeStamp");
-        if(inObj.getCommonHeader().getTimeStamp() != null){
+        if (inObj.getCommonHeader().getTimeStamp() != null) {
             String zuluTimestampStr = Converter.convDateToZuluString(inObj.getCommonHeader().getTimeStamp());
             logger.debug("After invoking convDateToZuluString()");
             ZULU zuluTimestamp = new ZULU(zuluTimestampStr);
@@ -360,7 +453,7 @@ public class Converter {
             commonHeaderBuilder.setTimestamp(zuluTimestamp);
         }
         outObj = commonHeaderBuilder.build();
-        logger.debug("Exiting from convAsyncResponseTorev160108CommonHeader: Returning outObj::"+outObj.toString());
+        logger.debug("Exiting from convAsyncResponseTorev160108CommonHeader: Returning outObj: " + outObj.toString());
         return outObj;
 
     }
@@ -370,31 +463,34 @@ public class Converter {
     }
 
     public static org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags
-    convFlagsMapTorev160108Flags(org.onap.appc.domainmodel.lcm.Flags flags) {
+            convFlagsMapTorev160108Flags(org.onap.appc.domainmodel.lcm.Flags flags) {
         Flags rev160108flags;
         boolean anyFlag = false;
         FlagsBuilder flagsBuilder = new FlagsBuilder();
         /*
-         * TODO: The below flags are related to APP-C request and should not be sent back - uncomment when response flags are introduced.
+         * TODO: The below flags are related to APP-C request and should not be sent back -
+         * uncomment when response flags are introduced.
          */
         /*
-        if(flags.containsKey(FORCE_FLAG)){
+        if (flags.containsKey(FORCE_FLAG)) {
             org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags.Force force =
-                    org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags.Force.valueOf(flags.get(FORCE_FLAG).toString());
+                    org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header
+                        .Flags.Force.valueOf(flags.get(FORCE_FLAG).toString());
             flagsBuilder.setForce(force);
             anyFlag = true;
         }
-        if(flags.containsKey(MODE_FLAG)){
+        if (flags.containsKey(MODE_FLAG)) {
             org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags.Mode mode =
-                    org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags.Mode.valueOf(flags.get(MODE_FLAG).toString());
+                    org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header
+                        .Flags.Mode.valueOf(flags.get(MODE_FLAG).toString());
             flagsBuilder.setMode(mode);
             anyFlag = true;
         }
-        if(flags.containsKey(TTL_FLAG)){
+        if (flags.containsKey(TTL_FLAG)) {
             flagsBuilder.setTtl(Integer.valueOf(flags.get(TTL_FLAG).toString()));
             anyFlag = true;
         }
-        if(anyFlag){
+        if (anyFlag) {
             rev160108flags = flagsBuilder.build();
         }
          */
@@ -403,60 +499,75 @@ public class Converter {
         return rev160108flags;
     }
 
-    public static String convAsyncResponseToJsonStringBody(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
+    public static String convAsyncResponseToJsonStringBody(
+            VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+            throws JsonProcessingException {
         Builder<?> builder = Converter.convAsyncResponseToBuilder(vnfOperation, rpcName, asyncResponse);
         Object message = builder.build();
         ObjectMapper objectMapper = new ObjectMapper();
-        objectMapper.addMixInAnnotations(message.getClass(), MixInFlagsMessage.class);
-        objectMapper.addMixInAnnotations(CommonHeader.class, MixInCommonHeader.class);
-        objectMapper.addMixInAnnotations(Flags.class, MixIn.class);
-        objectMapper.addMixInAnnotations(Status.class, MixIn.class);
-        objectMapper.addMixInAnnotations(Payload.class, MixIn.class);
-        objectMapper.addMixInAnnotations(ZULU.class, MixIn.class);
+        objectMapper.addMixIn(message.getClass(), MixInFlagsMessage.class);
+        objectMapper.addMixIn(CommonHeader.class, MixInCommonHeader.class);
+        objectMapper.addMixIn(Flags.class, MixIn.class);
+        objectMapper.addMixIn(Status.class, MixIn.class);
+        objectMapper.addMixIn(Payload.class, MixIn.class);
+        objectMapper.addMixIn(ZULU.class, MixIn.class);
 
-//                .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true)
-        ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true)
-                .writer(SerializationFeature.WRAP_ROOT_VALUE).withRootName(DMaaP_ROOT_VALUE).withoutFeatures(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
+//                .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY, true)
+        ObjectWriter writer = objectMapper
+                .setSerializationInclusion(JsonInclude.Include.NON_NULL)
+                .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
+                .writer(SerializationFeature.WRAP_ROOT_VALUE)
+                .withRootName(DMaaP_ROOT_VALUE)
+                .withoutFeatures(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
         return writer.writeValueAsString(message);
     }
 
-    public static String convAsyncResponseToDmaapOutgoingMessageJsonString(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
+    public static String convAsyncResponseToDmaapOutgoingMessageJsonString(
+            VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+            throws JsonProcessingException {
         logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
-       DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
+        DmaapOutgoingMessage dmaapOutgoingMessage =
+                convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
         ObjectMapper objectMapper = new ObjectMapper();
-        objectMapper.addMixInAnnotations(dmaapOutgoingMessage.getBody().getOutput().getClass(), MixInFlagsMessage.class);
-        objectMapper.addMixInAnnotations(CommonHeader.class, MixInCommonHeader.class);
-        objectMapper.addMixInAnnotations(Flags.class, MixIn.class);
-        objectMapper.addMixInAnnotations(Status.class, MixIn.class);
-        objectMapper.addMixInAnnotations(Payload.class, MixIn.class);
-        objectMapper.addMixInAnnotations(ZULU.class, MixIn.class);
+        objectMapper.addMixIn(dmaapOutgoingMessage.getBody().getOutput().getClass(), MixInFlagsMessage.class);
+        objectMapper.addMixIn(CommonHeader.class, MixInCommonHeader.class);
+        objectMapper.addMixIn(Flags.class, MixIn.class);
+        objectMapper.addMixIn(Status.class, MixIn.class);
+        objectMapper.addMixIn(Payload.class, MixIn.class);
+        objectMapper.addMixIn(ZULU.class, MixIn.class);
 
-//                .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true)
-        ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true).writer();
+//                .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY, true)
+        ObjectWriter writer = objectMapper
+                .setSerializationInclusion(JsonInclude.Include.NON_NULL)
+                .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
+                .writer();
         logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
         return writer.writeValueAsString(dmaapOutgoingMessage);
     }
 
-    public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
-       logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessage()");
-       DmaapOutgoingMessage outObj = new DmaapOutgoingMessage();
+    public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(
+            VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+            throws JsonProcessingException {
+        logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessage()");
+        DmaapOutgoingMessage outObj = new DmaapOutgoingMessage();
         String correlationID = getCorrelationID(asyncResponse);
         outObj.setCorrelationID(correlationID);
         outObj.setType("response");
         outObj.setRpcName(rpcName);
-        logger.debug("In onverter.convAsyncResponseToDmaapOutgoingMessage() before invoking convAsyncResponseToBuilder");
+        logger.debug("In Converter.convAsyncResponseToDmaapOutgoingMessage()"
+                + " before invoking convAsyncResponseToBuilder");
         Builder<?> builder = Converter.convAsyncResponseToBuilder(vnfOperation, rpcName, asyncResponse);
         Object messageBody = builder.build();
         DmaapOutgoingMessage.Body body = new DmaapOutgoingMessage.Body(messageBody);
         outObj.setBody(body);
-        logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage():messageBody is :::"+body.toString());
+        logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage(): messageBody is: " + body.toString());
         return outObj;
     }
 
     private static String getCorrelationID(ResponseContext context) {
         return context.getCommonHeader().getRequestId()
                 + (context.getCommonHeader().getSubRequestId() == null ?
-                    "":"-" + context.getCommonHeader().getSubRequestId());
+                    "" : "-" + context.getCommonHeader().getSubRequestId());
     }
 
     abstract class MixIn {
@@ -479,6 +590,6 @@ public class Converter {
     }
     abstract class MixInFlagsMessage extends MixIn {
         @JsonProperty("common-header")
-        abstract  CommonHeader getCommonHeader();
+        abstract CommonHeader getCommonHeader();
     }
 }