Reformat catalog-be
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / components / impl / ServiceBusinessLogic.java
index ad1f818..a87fdb6 100644 (file)
@@ -19,7 +19,6 @@
  * Modifications copyright (c) 2019 Nokia
  * ================================================================================
  */
-
 package org.openecomp.sdc.be.components.impl;
 
 import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
@@ -165,10 +164,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.context.WebApplicationContext;
 
-
 @org.springframework.stereotype.Component("serviceBusinessLogic")
 public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
+    static final String IS_VALID = "isValid";
     private static final String THE_SERVICE_WITH_SYSTEM_NAME_LOCKED = "The service with system name {} locked. ";
     private static final String FAILED_TO_LOCK_SERVICE_RESPONSE_IS = "Failed to lock service {}. Response is {}. ";
     private static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response";
@@ -176,71 +175,40 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     private static final String INITIAL_VERSION = "0.1";
     private static final String STATUS_SUCCESS_200 = "200";
     private static final String STATUS_DEPLOYED = "DEPLOYED";
-    static final String IS_VALID = "isValid";
     private static final String PLACE_HOLDER_RESOURCE_TYPES = "validForResourceTypes";
-
-    private ForwardingPathOperation forwardingPathOperation;
-    private AuditCassandraDao auditCassandraDao;
-
     private final IDistributionEngine distributionEngine;
     private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
     private final ServiceDistributionValidation serviceDistributionValidation;
     private final ForwardingPathValidator forwardingPathValidator;
     private final UiComponentDataConverter uiComponentDataConverter;
-
+    private ForwardingPathOperation forwardingPathOperation;
+    private AuditCassandraDao auditCassandraDao;
     private ServiceTypeValidator serviceTypeValidator;
     private List<ServiceCreationPlugin> serviceCreationPluginList;
-
-    @Autowired
-    public void setServiceTypeValidator(ServiceTypeValidator serviceTypeValidator) {
-        this.serviceTypeValidator = serviceTypeValidator;
-    }
-
-
     private ServiceFunctionValidator serviceFunctionValidator;
-
-    @Autowired
-    public void setServiceFunctionValidator(ServiceFunctionValidator serviceFunctionValidator) {
-        this.serviceFunctionValidator = serviceFunctionValidator;
-    }
-
     @Autowired
     private ServiceRoleValidator serviceRoleValidator;
-
     @Autowired
     private ServiceInstantiationTypeValidator serviceInstantiationTypeValidator;
-
     @Autowired
     private ServiceCategoryValidator serviceCategoryValidator;
-
     @Autowired
     private ServiceValidator serviceValidator;
 
-
     @Autowired
-    public ServiceBusinessLogic(IElementOperation elementDao,
-                                IGroupOperation groupOperation,
-                                IGroupInstanceOperation groupInstanceOperation,
-                                IGroupTypeOperation groupTypeOperation,
-                                GroupBusinessLogic groupBusinessLogic,
-                                InterfaceOperation interfaceOperation,
-                                InterfaceLifecycleOperation interfaceLifecycleTypeOperation,
-                                ArtifactsBusinessLogic artifactsBusinessLogic,
+    public ServiceBusinessLogic(IElementOperation elementDao, IGroupOperation groupOperation, IGroupInstanceOperation groupInstanceOperation,
+                                IGroupTypeOperation groupTypeOperation, GroupBusinessLogic groupBusinessLogic, InterfaceOperation interfaceOperation,
+                                InterfaceLifecycleOperation interfaceLifecycleTypeOperation, ArtifactsBusinessLogic artifactsBusinessLogic,
                                 IDistributionEngine distributionEngine, ComponentInstanceBusinessLogic componentInstanceBusinessLogic,
                                 ServiceDistributionValidation serviceDistributionValidation, ForwardingPathValidator forwardingPathValidator,
-                                UiComponentDataConverter uiComponentDataConverter,
-                                ArtifactsOperations artifactToscaOperation,
-                                ComponentContactIdValidator componentContactIdValidator,
-                                ComponentNameValidator componentNameValidator,
-                                ComponentTagsValidator componentTagsValidator,
-                                ComponentValidator componentValidator,
-                                ComponentIconValidator componentIconValidator,
-                                ComponentProjectCodeValidator componentProjectCodeValidator,
+                                UiComponentDataConverter uiComponentDataConverter, ArtifactsOperations artifactToscaOperation,
+                                ComponentContactIdValidator componentContactIdValidator, ComponentNameValidator componentNameValidator,
+                                ComponentTagsValidator componentTagsValidator, ComponentValidator componentValidator,
+                                ComponentIconValidator componentIconValidator, ComponentProjectCodeValidator componentProjectCodeValidator,
                                 ComponentDescriptionValidator componentDescriptionValidator) {
-        super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic,
-            interfaceOperation, interfaceLifecycleTypeOperation, artifactsBusinessLogic, artifactToscaOperation, componentContactIdValidator,
-                componentNameValidator, componentTagsValidator, componentValidator,
-                componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator);
+        super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, interfaceOperation,
+            interfaceLifecycleTypeOperation, artifactsBusinessLogic, artifactToscaOperation, componentContactIdValidator, componentNameValidator,
+            componentTagsValidator, componentValidator, componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator);
         this.distributionEngine = distributionEngine;
         this.componentInstanceBusinessLogic = componentInstanceBusinessLogic;
         this.serviceDistributionValidation = serviceDistributionValidation;
@@ -248,12 +216,20 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         this.uiComponentDataConverter = uiComponentDataConverter;
     }
 
+    @Autowired
+    public void setServiceTypeValidator(ServiceTypeValidator serviceTypeValidator) {
+        this.serviceTypeValidator = serviceTypeValidator;
+    }
+
+    @Autowired
+    public void setServiceFunctionValidator(ServiceFunctionValidator serviceFunctionValidator) {
+        this.serviceFunctionValidator = serviceFunctionValidator;
+    }
 
     public Either<List<Map<String, Object>>, ResponseFormat> getComponentAuditRecords(String componentVersion, String componentUUID, String userId) {
         validateUserExists(userId);
         Either<List<Map<String, Object>>, ActionStatus> result;
         try {
-
             // Certified Version
             if (componentVersion.endsWith(".0")) {
                 Either<List<ResourceAdminEvent>, ActionStatus> eitherAuditingForCertified = auditCassandraDao.getByServiceInstanceId(componentUUID);
@@ -271,229 +247,154 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             log.debug("get Audit Records failed with exception {}", e);
             result = Either.right(ActionStatus.GENERAL_ERROR);
         }
-
         if (result.isRight()) {
             return Either.right(componentsUtils.getResponseFormat(result.right().value()));
         } else {
             return Either.left(result.left().value());
         }
-
     }
 
-    public Either<List<Operation>, ResponseFormat> addServiceConsumptionData(String serviceId,
-                                                                             String serviceInstanceId,
-                                                                             String operationId,
-                                                                             List<ServiceConsumptionData> serviceConsumptionDataList,
-                                                                             String userId) {
+    public Either<List<Operation>, ResponseFormat> addServiceConsumptionData(String serviceId, String serviceInstanceId, String operationId,
+                                                                             List<ServiceConsumptionData> serviceConsumptionDataList, String userId) {
         List<Operation> operationList = new ArrayList<>();
-
-        Either<Service, StorageOperationStatus> serviceEither =
-                toscaOperationFacade.getToscaElement(serviceId);
-        if(serviceEither.isRight()) {
-            return Either.right(componentsUtils.getResponseFormat
-                    (serviceEither.right().value()));
+        Either<Service, StorageOperationStatus> serviceEither = toscaOperationFacade.getToscaElement(serviceId);
+        if (serviceEither.isRight()) {
+            return Either.right(componentsUtils.getResponseFormat(serviceEither.right().value()));
         }
-
         Service service = serviceEither.left().value();
-
-
-        StorageOperationStatus storageOperationStatus =
-                graphLockOperation.lockComponent(service.getUniqueId(), NodeTypeEnum.Service);
+        StorageOperationStatus storageOperationStatus = graphLockOperation.lockComponent(service.getUniqueId(), NodeTypeEnum.Service);
         if (storageOperationStatus != StorageOperationStatus.OK) {
             return Either.right(componentsUtils.getResponseFormat(storageOperationStatus));
         }
-
         try {
             for (ServiceConsumptionData serviceConsumptionData : serviceConsumptionDataList) {
-                Either<Operation, ResponseFormat> operationEither =
-                        addPropertyServiceConsumption(serviceId, serviceInstanceId, operationId,
-                                userId, serviceConsumptionData);
-
+                Either<Operation, ResponseFormat> operationEither = addPropertyServiceConsumption(serviceId, serviceInstanceId, operationId, userId,
+                    serviceConsumptionData);
                 if (operationEither.isRight()) {
                     return Either.right(operationEither.right().value());
                 }
-
                 operationList.add(operationEither.left().value());
             }
-
             janusGraphDao.commit();
             return Either.left(operationList);
         } catch (Exception e) {
             janusGraphDao.rollback();
             return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
-
         } finally {
             graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
-
         }
     }
 
-    public Either <Operation, ResponseFormat> addPropertyServiceConsumption(String serviceId,
-                                                                            String serviceInstanceId,
-                                                                            String operationId,
-                                                                            String userId,
-                                                                            ServiceConsumptionData serviceConsumptionData) {
+    public Either<Operation, ResponseFormat> addPropertyServiceConsumption(String serviceId, String serviceInstanceId, String operationId,
+                                                                           String userId, ServiceConsumptionData serviceConsumptionData) {
         validateUserExists(userId);
-
-        Either<Service, StorageOperationStatus> serviceEither =
-                toscaOperationFacade.getToscaElement(serviceId);
-        if(serviceEither.isRight()) {
-            return Either.right(componentsUtils.getResponseFormat(serviceEither.right
-                    ().value()));
+        Either<Service, StorageOperationStatus> serviceEither = toscaOperationFacade.getToscaElement(serviceId);
+        if (serviceEither.isRight()) {
+            return Either.right(componentsUtils.getResponseFormat(serviceEither.right().value()));
         }
-
         Service parentService = serviceEither.left().value();
-
         List<ComponentInstance> componentInstances = parentService.getComponentInstances();
-        if(CollectionUtils.isEmpty(componentInstances)) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        if (CollectionUtils.isEmpty(componentInstances)) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
-        Optional<ComponentInstance> serviceInstanceCandidate =
-                componentInstances.stream().filter(instance -> instance.getUniqueId().equals
-                        (serviceInstanceId)).findAny();
-
-        if(!serviceInstanceCandidate.isPresent()) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        Optional<ComponentInstance> serviceInstanceCandidate = componentInstances.stream()
+            .filter(instance -> instance.getUniqueId().equals(serviceInstanceId)).findAny();
+        if (!serviceInstanceCandidate.isPresent()) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
-        Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces =
-                parentService.getComponentInstancesInterfaces();
-        if(MapUtils.isEmpty(componentInstancesInterfaces)) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces = parentService.getComponentInstancesInterfaces();
+        if (MapUtils.isEmpty(componentInstancesInterfaces)) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
         List<InterfaceDefinition> interfaces = new ArrayList<>();
-        for(ComponentInstanceInterface componentInstanceInterface :
-                componentInstancesInterfaces.get(serviceInstanceId)) {
+        for (ComponentInstanceInterface componentInstanceInterface : componentInstancesInterfaces.get(serviceInstanceId)) {
             interfaces.add(componentInstanceInterface);
         }
-
         ComponentInstance serviceInstance = serviceInstanceCandidate.get();
-        Optional<InterfaceDefinition> interfaceCandidate = InterfaceOperationUtils
-                .getInterfaceDefinitionFromOperationId(interfaces, operationId);
-
-        if(!interfaceCandidate.isPresent()) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        Optional<InterfaceDefinition> interfaceCandidate = InterfaceOperationUtils.getInterfaceDefinitionFromOperationId(interfaces, operationId);
+        if (!interfaceCandidate.isPresent()) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
         InterfaceDefinition interfaceDefinition = interfaceCandidate.get();
         Map<String, Operation> operations = interfaceDefinition.getOperationsMap();
-        if(MapUtils.isEmpty(operations)) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        if (MapUtils.isEmpty(operations)) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
         Operation operation = operations.get(operationId);
         Either<Operation, ResponseFormat> operationEither = Either.left(operation);
-
         ListDataDefinition<OperationInputDefinition> inputs = operation.getInputs();
-        Optional<OperationInputDefinition> inputCandidate =
-                getOperationInputByInputId(serviceConsumptionData, inputs);
-
-        if(!inputCandidate.isPresent()) {
+        Optional<OperationInputDefinition> inputCandidate = getOperationInputByInputId(serviceConsumptionData, inputs);
+        if (!inputCandidate.isPresent()) {
             return Either.right(new ResponseFormat(HttpStatus.NOT_FOUND.value()));
         }
-
         OperationInputDefinition operationInputDefinition = inputCandidate.get();
         // add data to operation
-
-        if(Objects.nonNull(serviceConsumptionData.getValue()))  {
-            operationEither =
-                    handleConsumptionValue(parentService, serviceInstanceId, serviceConsumptionData, operation,
-                            operationInputDefinition);
+        if (Objects.nonNull(serviceConsumptionData.getValue())) {
+            operationEither = handleConsumptionValue(parentService, serviceInstanceId, serviceConsumptionData, operation, operationInputDefinition);
         }
-
-        if(operationEither.isRight()) {
+        if (operationEither.isRight()) {
             return Either.right(operationEither.right().value());
         }
-
         Operation updatedOperation = operationEither.left().value();
         operations.remove(operationId);
         operations.put(operationId, updatedOperation);
         interfaceDefinition.setOperationsMap(operations);
-
         parentService.getComponentInstances().remove(serviceInstance);
-        if(CollectionUtils.isEmpty(parentService.getComponentInstances())) {
+        if (CollectionUtils.isEmpty(parentService.getComponentInstances())) {
             parentService.setComponentInstances(new ArrayList<>());
         }
-
         Map<String, Object> instanceInterfaces =
-                MapUtils.isEmpty(serviceInstance.getInterfaces())? new HashMap<>() : serviceInstance.getInterfaces();
+            MapUtils.isEmpty(serviceInstance.getInterfaces()) ? new HashMap<>() : serviceInstance.getInterfaces();
         instanceInterfaces.remove(interfaceDefinition.getUniqueId());
         instanceInterfaces.put(interfaceDefinition.getUniqueId(), interfaceDefinition);
         serviceInstance.setInterfaces(instanceInterfaces);
-
         removeComponentInstanceInterfaceByInterfaceId(interfaceDefinition.getUniqueId(), componentInstancesInterfaces.get(serviceInstanceId));
-        componentInstancesInterfaces.get(serviceInstanceId).add(new ComponentInstanceInterface(interfaceDefinition.getUniqueId(), interfaceDefinition));
-
+        componentInstancesInterfaces.get(serviceInstanceId)
+            .add(new ComponentInstanceInterface(interfaceDefinition.getUniqueId(), interfaceDefinition));
         parentService.getComponentInstances().add(serviceInstance);
-
         StorageOperationStatus status = toscaOperationFacade.updateComponentInstanceInterfaces(parentService, serviceInstanceId);
-
-        if(status != StorageOperationStatus.OK) {
-            return Either.right(componentsUtils.getResponseFormat(ActionStatus
-                    .INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
+        if (status != StorageOperationStatus.OK) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, serviceInstanceId));
         }
-
         return Either.left(operation);
     }
 
-    private void removeComponentInstanceInterfaceByInterfaceId(String interfaceIdToRemove,
-                                                               List<ComponentInstanceInterface> instanceInterfaces) {
-        if(CollectionUtils.isEmpty(instanceInterfaces)) {
+    private void removeComponentInstanceInterfaceByInterfaceId(String interfaceIdToRemove, List<ComponentInstanceInterface> instanceInterfaces) {
+        if (CollectionUtils.isEmpty(instanceInterfaces)) {
             return;
         }
-
-        Optional<ComponentInstanceInterface> interfaceToRemove =
-                instanceInterfaces.stream().filter(instInterface -> instInterface.getUniqueId().equals
-                        (interfaceIdToRemove)).findAny();
-
-        if(interfaceToRemove.isPresent()) {
+        Optional<ComponentInstanceInterface> interfaceToRemove = instanceInterfaces.stream()
+            .filter(instInterface -> instInterface.getUniqueId().equals(interfaceIdToRemove)).findAny();
+        if (interfaceToRemove.isPresent()) {
             instanceInterfaces.remove(interfaceToRemove.get());
         }
-
     }
 
-    private Either<Operation, ResponseFormat> handleConsumptionValue(Service containerService,
-                                                                     String serviceInstanceId,
-                                                                     ServiceConsumptionData serviceConsumptionData,
-                                                                     Operation operation,
-                                                                     OperationInputDefinition
-                                                                             operationInputDefinition) {
+    private Either<Operation, ResponseFormat> handleConsumptionValue(Service containerService, String serviceInstanceId,
+                                                                     ServiceConsumptionData serviceConsumptionData, Operation operation,
+                                                                     OperationInputDefinition operationInputDefinition) {
         String source = serviceConsumptionData.getSource();
         String consumptionValue = serviceConsumptionData.getValue();
         String type = serviceConsumptionData.getType();
-        String operationIdentifier = consumptionValue.contains(".")
-                ? consumptionValue.substring(0, consumptionValue.lastIndexOf('.'))
-                : consumptionValue;
-
+        String operationIdentifier =
+            consumptionValue.contains(".") ? consumptionValue.substring(0, consumptionValue.lastIndexOf('.')) : consumptionValue;
         ServiceConsumptionSource sourceValue = ServiceConsumptionSource.getSourceValue(source);
-
-        if(STATIC.equals(sourceValue)) {
+        if (STATIC.equals(sourceValue)) {
             // Validate constraint on input value
-            Either<Boolean, ResponseFormat> constraintValidationResult =
-                    validateOperationInputConstraint(operationInputDefinition, consumptionValue, type);
-
+            Either<Boolean, ResponseFormat> constraintValidationResult = validateOperationInputConstraint(operationInputDefinition, consumptionValue,
+                type);
             if (constraintValidationResult.isRight()) {
                 return Either.right(constraintValidationResult.right().value());
             }
-            return handleConsumptionStaticValue(consumptionValue, type, operation,
-                    operationInputDefinition);
+            return handleConsumptionStaticValue(consumptionValue, type, operation, operationInputDefinition);
         }
-
         if (Objects.isNull(sourceValue)) {
             List<PropertyDefinition> propertyDefinitions;
             Map<String, List<CapabilityDefinition>> capabilities = null;
             String componentName;
             List<OperationOutputDefinition> outputs = null;
             if (source.equals(containerService.getUniqueId())) {
-                Either<Service, StorageOperationStatus> serviceToTakePropEither =
-                        toscaOperationFacade.getToscaElement(source);
+                Either<Service, StorageOperationStatus> serviceToTakePropEither = toscaOperationFacade.getToscaElement(source);
                 if (serviceToTakePropEither.isRight()) {
                     return Either.right(componentsUtils.getResponseFormat(serviceToTakePropEither.right().value()));
                 }
@@ -502,13 +403,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 sourceValue = SERVICE_INPUT;
                 propertyDefinitions = service.getProperties();
                 componentName = service.getName();
-                outputs = InterfaceOperationUtils.getOtherOperationOutputsOfComponent(operationIdentifier,
-                        service.getInterfaces()).getListToscaDataDefinition();
+                outputs = InterfaceOperationUtils.getOtherOperationOutputsOfComponent(operationIdentifier, service.getInterfaces())
+                    .getListToscaDataDefinition();
             } else {
                 Optional<ComponentInstance> getComponentInstance = containerService.getComponentInstanceById(source);
-                if(!getComponentInstance.isPresent()){
-                    return Either.right(componentsUtils.getResponseFormat(
-                            ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, source));
+                if (!getComponentInstance.isPresent()) {
+                    return Either.right(componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, source));
                 }
                 ComponentInstance componentInstance = getComponentInstance.get();
                 operationInputDefinition.setSource(componentInstance.getUniqueId());
@@ -516,185 +416,143 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 capabilities = componentInstance.getCapabilities();
                 componentName = source.equals(serviceInstanceId) ? SELF : componentInstance.getName();
                 if (MapUtils.isNotEmpty(componentInstance.getInterfaces())) {
-                    Map<String, InterfaceDataDefinition> componentInstanceInterfaces =
-                            componentInstance.getInterfaces().entrySet().stream()
-                                    .collect(Collectors.toMap((Map.Entry::getKey),
-                                            (interfaceEntry -> (InterfaceDataDefinition) interfaceEntry.getValue())));
-                    outputs = InterfaceOperationUtils.getOtherOperationOutputsOfComponent(operationIdentifier,
-                            componentInstanceInterfaces).getListToscaDataDefinition();
+                    Map<String, InterfaceDataDefinition> componentInstanceInterfaces = componentInstance.getInterfaces().entrySet().stream()
+                        .collect(Collectors.toMap((Map.Entry::getKey), (interfaceEntry -> (InterfaceDataDefinition) interfaceEntry.getValue())));
+                    outputs = InterfaceOperationUtils.getOtherOperationOutputsOfComponent(operationIdentifier, componentInstanceInterfaces)
+                        .getListToscaDataDefinition();
                 }
             }
-
-            if(sourceValue == ServiceConsumptionSource.SERVICE_INPUT) {
+            if (sourceValue == ServiceConsumptionSource.SERVICE_INPUT) {
                 //The operation input in service consumption has been mapped to an input in the parent service
-                return handleConsumptionInputValue(consumptionValue, containerService, operation,
-                        operationInputDefinition);
+                return handleConsumptionInputValue(consumptionValue, containerService, operation, operationInputDefinition);
             }
-            return handleConsumptionPropertyValue(operation, operationInputDefinition,
-                    serviceConsumptionData, propertyDefinitions, capabilities, outputs, componentName);
+            return handleConsumptionPropertyValue(operation, operationInputDefinition, serviceConsumptionData, propertyDefinitions, capabilities,
+                outputs, componentName);
         }
-
         operationInputDefinition.setToscaPresentationValue(JsonPresentationFields.SOURCE, source);
         operationInputDefinition.setSource(source);
-
         return Either.left(operation);
     }
 
     private Optional<OperationInputDefinition> getOperationInputByInputId(ServiceConsumptionData serviceConsumptionData,
                                                                           ListDataDefinition<OperationInputDefinition> inputs) {
-
-        if(CollectionUtils.isEmpty(inputs.getListToscaDataDefinition())) {
+        if (CollectionUtils.isEmpty(inputs.getListToscaDataDefinition())) {
             return Optional.empty();
         }
-
-        return inputs.getListToscaDataDefinition().stream().filter(operationInput -> operationInput.getInputId().equals
-                (serviceConsumptionData.getInputId()))
-                .findAny();
+        return inputs.getListToscaDataDefinition().stream()
+            .filter(operationInput -> operationInput.getInputId().equals(serviceConsumptionData.getInputId())).findAny();
     }
 
-    private Either<Operation, ResponseFormat> handleConsumptionPropertyValue(
-            Operation operation, OperationInputDefinition operationInputDefinition,
-            ServiceConsumptionData serviceConsumptionData, List<PropertyDefinition> properties,Map<String,
-            List<CapabilityDefinition>> capabilities,
-            List<OperationOutputDefinition> outputs,  String componentName) {
-
+    private Either<Operation, ResponseFormat> handleConsumptionPropertyValue(Operation operation, OperationInputDefinition operationInputDefinition,
+                                                                             ServiceConsumptionData serviceConsumptionData,
+                                                                             List<PropertyDefinition> properties,
+                                                                             Map<String, List<CapabilityDefinition>> capabilities,
+                                                                             List<OperationOutputDefinition> outputs, String componentName) {
         if (CollectionUtils.isEmpty(properties) && CollectionUtils.isEmpty(outputs)) {
             return Either.left(operation);
         }
         String consumptionValue = serviceConsumptionData.getValue();
-
-        if (CollectionUtils.isNotEmpty(outputs)
-                && isOperationInputMappedToOtherOperationOutput(getOperationOutputName(consumptionValue), outputs)) {
-            return handleConsumptionInputMappedToOperationOutput(operation, operationInputDefinition, outputs,
-                    consumptionValue, componentName);
+        if (CollectionUtils.isNotEmpty(outputs) && isOperationInputMappedToOtherOperationOutput(getOperationOutputName(consumptionValue), outputs)) {
+            return handleConsumptionInputMappedToOperationOutput(operation, operationInputDefinition, outputs, consumptionValue, componentName);
         }
-
         if (CollectionUtils.isNotEmpty(properties) && PropertiesUtils.isNodeProperty(consumptionValue, properties)) {
-            return handleConsumptionInputMappedToProperty(operation, operationInputDefinition, serviceConsumptionData,
-                    properties, componentName);
+            return handleConsumptionInputMappedToProperty(operation, operationInputDefinition, serviceConsumptionData, properties, componentName);
         }
-
         if (MapUtils.isNotEmpty(capabilities)) {
-            return handleConsumptionInputMappedToCapabilityProperty(operation, operationInputDefinition,
-                    serviceConsumptionData, capabilities, componentName);
+            return handleConsumptionInputMappedToCapabilityProperty(operation, operationInputDefinition, serviceConsumptionData, capabilities,
+                componentName);
         }
-
         return Either.left(operation);
     }
 
     private Either<Operation, ResponseFormat> handleConsumptionInputMappedToProperty(Operation operation,
-                                                                                     OperationInputDefinition operationInputDefinition, ServiceConsumptionData serviceConsumptionData,
+                                                                                     OperationInputDefinition operationInputDefinition,
+                                                                                     ServiceConsumptionData serviceConsumptionData,
                                                                                      List<PropertyDefinition> properties, String componentName) {
-        Optional<PropertyDefinition> servicePropertyCandidate =
-                properties.stream().filter(property -> property.getName()
-                        .equals(serviceConsumptionData.getValue())).findAny();
-
+        Optional<PropertyDefinition> servicePropertyCandidate = properties.stream()
+            .filter(property -> property.getName().equals(serviceConsumptionData.getValue())).findAny();
         if (servicePropertyCandidate.isPresent()) {
-            boolean isInputTypeSimilarToOperation =
-                    isAssignedValueFromValidType(operationInputDefinition.getType(),
-                            servicePropertyCandidate.get());
-
+            boolean isInputTypeSimilarToOperation = isAssignedValueFromValidType(operationInputDefinition.getType(), servicePropertyCandidate.get());
             if (!isInputTypeSimilarToOperation) {
-                return Either.right(componentsUtils.getResponseFormat(
-                        ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
+                return Either.right(componentsUtils.getResponseFormat(ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
             }
-
-            addPropertyToInputValue(componentName, operation, operationInputDefinition,
-                    servicePropertyCandidate.get());
+            addPropertyToInputValue(componentName, operation, operationInputDefinition, servicePropertyCandidate.get());
         }
         return Either.left(operation);
     }
 
     private Either<Operation, ResponseFormat> handleConsumptionInputMappedToOperationOutput(Operation operation,
-                                                                                            OperationInputDefinition operationInputDefinition, List<OperationOutputDefinition> outputs,
+                                                                                            OperationInputDefinition operationInputDefinition,
+                                                                                            List<OperationOutputDefinition> outputs,
                                                                                             String consumptionValue, String componentName) {
         String outputName = getOperationOutputName(consumptionValue);
-        Optional<OperationOutputDefinition> servicePropertyOutputCandidate = outputs.stream()
-                .filter(output -> output.getName().equals(outputName)).findAny();
+        Optional<OperationOutputDefinition> servicePropertyOutputCandidate = outputs.stream().filter(output -> output.getName().equals(outputName))
+            .findAny();
         if (servicePropertyOutputCandidate.isPresent()) {
-            boolean isInputTypeSimilarToOperation =
-                    isAssignedValueFromValidType(operationInputDefinition.getType(),
-                            servicePropertyOutputCandidate.get());
+            boolean isInputTypeSimilarToOperation = isAssignedValueFromValidType(operationInputDefinition.getType(),
+                servicePropertyOutputCandidate.get());
             if (!isInputTypeSimilarToOperation) {
-                return Either.right(componentsUtils.getResponseFormat(
-                        ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
+                return Either.right(componentsUtils.getResponseFormat(ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
             }
             addOutputToInputValue(componentName, consumptionValue, operation, operationInputDefinition);
         }
         return Either.left(operation);
     }
 
-    private void addPropertyToInputValue(String componentName, Operation operation,
-                                         OperationInputDefinition operationInputDefinition,
+    private void addPropertyToInputValue(String componentName, Operation operation, OperationInputDefinition operationInputDefinition,
                                          PropertyDefinition serviceProperty) {
         Map<String, List<String>> getProperty = new HashMap<>();
         List<String> getPropertyValues = new ArrayList<>();
         getPropertyValues.add(componentName);
         getPropertyValues.add(serviceProperty.getName());
         getProperty.put(ToscaFunctions.GET_PROPERTY.getFunctionName(), getPropertyValues);
-
         operationInputDefinition.setSourceProperty(serviceProperty.getUniqueId());
         operation.getInputs().delete(operationInputDefinition);
-        operationInputDefinition.setToscaPresentationValue(JsonPresentationFields.GET_PROPERTY,
-                getPropertyValues);
+        operationInputDefinition.setToscaPresentationValue(JsonPresentationFields.GET_PROPERTY, getPropertyValues);
         operationInputDefinition.setValue((new Gson()).toJson(getProperty));
         operation.getInputs().add(operationInputDefinition);
     }
 
-    private void addOutputToInputValue(String componentName, String consumptionValue,
-                                       Operation operation, OperationInputDefinition operationInputDefinition) {
-        Map<String, List<String>> getOperationOutput =
-                InterfaceOperationUtils.createMappedOutputDefaultValue(componentName, consumptionValue);
+    private void addOutputToInputValue(String componentName, String consumptionValue, Operation operation,
+                                       OperationInputDefinition operationInputDefinition) {
+        Map<String, List<String>> getOperationOutput = InterfaceOperationUtils.createMappedOutputDefaultValue(componentName, consumptionValue);
         operation.getInputs().delete(operationInputDefinition);
-        operationInputDefinition.setToscaPresentationValue(JsonPresentationFields.GET_OPERATION_OUTPUT,
-                getOperationOutput);
+        operationInputDefinition.setToscaPresentationValue(JsonPresentationFields.GET_OPERATION_OUTPUT, getOperationOutput);
         operationInputDefinition.setValue((new Gson()).toJson(getOperationOutput));
         operation.getInputs().add(operationInputDefinition);
     }
 
-    public Either<Operation, ResponseFormat> handleConsumptionStaticValue(String value, String type,
-                                                                          Operation operation,
-                                                                          OperationInputDefinition
-                                                                                  operationInputDefinition) {
-        boolean isInputTypeSimilarToOperation =
-                isAssignedValueFromValidType(type, value);
-
-        if(!isInputTypeSimilarToOperation) {
-            return Either.right(componentsUtils.getResponseFormat(
-                    ActionStatus.INVALID_CONSUMPTION_TYPE, type));
+    public Either<Operation, ResponseFormat> handleConsumptionStaticValue(String value, String type, Operation operation,
+                                                                          OperationInputDefinition operationInputDefinition) {
+        boolean isInputTypeSimilarToOperation = isAssignedValueFromValidType(type, value);
+        if (!isInputTypeSimilarToOperation) {
+            return Either.right(componentsUtils.getResponseFormat(ActionStatus.INVALID_CONSUMPTION_TYPE, type));
+        }
+        //Validate Constraint and Value
+        Either<Boolean, ResponseFormat> constraintValidationResponse = validateOperationInputConstraint(operationInputDefinition, value, type);
+        if (constraintValidationResponse.isRight()) {
+            return Either.right(constraintValidationResponse.right().value());
         }
-
-               //Validate Constraint and Value
-               Either<Boolean, ResponseFormat> constraintValidationResponse =
-                               validateOperationInputConstraint(operationInputDefinition, value, type);
-               if(constraintValidationResponse.isRight()) {
-                       return Either.right(constraintValidationResponse.right().value());
-               }
-
         addStaticValueToInputOperation(value, operation, operationInputDefinition);
-
         return Either.left(operation);
     }
 
-       private Either<Boolean, ResponseFormat> validateOperationInputConstraint(
-                       OperationInputDefinition operationInputDefinition, String value, String type) {
-               ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
-               propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
-
-               InputDefinition inputDefinition = new InputDefinition();
-               inputDefinition.setDefaultValue(value);
-               inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
-               inputDefinition.setType(type);
-               if (Objects.nonNull(operationInputDefinition.getParentPropertyType())) {
-                inputDefinition.setProperties(Collections.singletonList(propertyDefinition));
-               }
-
-               return PropertyValueConstraintValidationUtil.getInstance()
-                               .validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
-       }
+    private Either<Boolean, ResponseFormat> validateOperationInputConstraint(OperationInputDefinition operationInputDefinition, String value,
+                                                                             String type) {
+        ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
+        propertyDefinition.setType(operationInputDefinition.getParentPropertyType());
+        InputDefinition inputDefinition = new InputDefinition();
+        inputDefinition.setDefaultValue(value);
+        inputDefinition.setInputPath(operationInputDefinition.getSubPropertyInputPath());
+        inputDefinition.setType(type);
+        if (Objects.nonNull(operationInputDefinition.getParentPropertyType())) {
+            inputDefinition.setProperties(Collections.singletonList(propertyDefinition));
+        }
+        return PropertyValueConstraintValidationUtil.getInstance()
+            .validatePropertyConstraints(Collections.singletonList(inputDefinition), applicationDataTypeCache);
+    }
 
-       private void addStaticValueToInputOperation(String value, Operation operation,
-                                                OperationInputDefinition operationInputDefinition) {
+    private void addStaticValueToInputOperation(String value, Operation operation, OperationInputDefinition operationInputDefinition) {
         operation.getInputs().delete(operationInputDefinition);
         operationInputDefinition.setSource(STATIC.getSource());
         operationInputDefinition.setSourceProperty(null);
@@ -702,31 +560,21 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         operation.getInputs().add(operationInputDefinition);
     }
 
-    private Either<Operation, ResponseFormat>  handleConsumptionInputValue(String inputId,
-                                                                           Service service,
-                                                                           Operation operation,
-                                                                           OperationInputDefinition
-                                                                                   operationInputDefinition) {
+    private Either<Operation, ResponseFormat> handleConsumptionInputValue(String inputId, Service service, Operation operation,
+                                                                          OperationInputDefinition operationInputDefinition) {
         List<InputDefinition> serviceInputs = service.getInputs();
-        Optional<InputDefinition> inputForValue =
-                serviceInputs.stream().filter(input -> input.getUniqueId().contains(inputId)).findAny();
-
-        if(inputForValue.isPresent()) {
-            boolean isInputTypeSimilarToOperation =
-                    isAssignedValueFromValidType(operationInputDefinition.getType(), inputForValue.get());
-
-            if(!isInputTypeSimilarToOperation) {
-                return Either.right(componentsUtils.getResponseFormat(
-                        ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
+        Optional<InputDefinition> inputForValue = serviceInputs.stream().filter(input -> input.getUniqueId().contains(inputId)).findAny();
+        if (inputForValue.isPresent()) {
+            boolean isInputTypeSimilarToOperation = isAssignedValueFromValidType(operationInputDefinition.getType(), inputForValue.get());
+            if (!isInputTypeSimilarToOperation) {
+                return Either.right(componentsUtils.getResponseFormat(ActionStatus.INVALID_CONSUMPTION_TYPE, operationInputDefinition.getType()));
             }
             addGetInputValueToOperationInput(operation, operationInputDefinition, inputForValue.get());
         }
-
         return Either.left(operation);
     }
 
-    private void addGetInputValueToOperationInput(Operation operation,
-                                                  OperationInputDefinition operationInputDefinition,
+    private void addGetInputValueToOperationInput(Operation operation, OperationInputDefinition operationInputDefinition,
                                                   InputDefinition inputForValue) {
         operation.getInputs().delete(operationInputDefinition);
         Map<String, String> getInputMap = new HashMap<>();
@@ -739,38 +587,31 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     private Either<List<Map<String, Object>>, ActionStatus> getAuditRecordsForUncertifiedComponent(String componentUUID, String componentVersion) {
         // First Query
-        Either<List<ResourceAdminEvent>, ActionStatus> eitherprevVerAudit = auditCassandraDao.getAuditByServiceIdAndPrevVersion(componentUUID, componentVersion);
-
+        Either<List<ResourceAdminEvent>, ActionStatus> eitherprevVerAudit = auditCassandraDao
+            .getAuditByServiceIdAndPrevVersion(componentUUID, componentVersion);
         if (eitherprevVerAudit.isRight()) {
             return Either.right(eitherprevVerAudit.right().value());
         }
-
         // Second Query
-        Either<List<ResourceAdminEvent>, ActionStatus> eitherCurrVerAudit = auditCassandraDao.getAuditByServiceIdAndCurrVersion(componentUUID, componentVersion);
+        Either<List<ResourceAdminEvent>, ActionStatus> eitherCurrVerAudit = auditCassandraDao
+            .getAuditByServiceIdAndCurrVersion(componentUUID, componentVersion);
         if (eitherCurrVerAudit.isRight()) {
             return Either.right(eitherCurrVerAudit.right().value());
         }
-
-
         Either<List<ResourceAdminEvent>, ActionStatus> eitherArchiveRestoreList = getArchiveRestoreEventList(componentUUID);
         if (eitherArchiveRestoreList.isRight()) {
             return Either.right(eitherArchiveRestoreList.right().value());
         }
-
         List<Map<String, Object>> prevVerAuditList = getAuditingFieldsList(eitherprevVerAudit.left().value());
         List<Map<String, Object>> currVerAuditList = getAuditingFieldsList(eitherCurrVerAudit.left().value());
-
         List<Map<String, Object>> duplicateElements = new ArrayList<>();
         duplicateElements.addAll(prevVerAuditList);
         duplicateElements.retainAll(currVerAuditList);
-
         List<Map<String, Object>> joinedNonDuplicatedList = new ArrayList<>();
         joinedNonDuplicatedList.addAll(prevVerAuditList);
         joinedNonDuplicatedList.removeAll(duplicateElements);
         joinedNonDuplicatedList.addAll(currVerAuditList);
         joinedNonDuplicatedList.addAll(getAuditingFieldsList(eitherArchiveRestoreList.left().value()));
-
-
         return Either.left(joinedNonDuplicatedList);
     }
 
@@ -780,17 +621,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (eitherArchiveAudit.isRight()) {
             return Either.right(eitherArchiveAudit.right().value());
         }
-
         // Restore Query
         Either<List<ResourceAdminEvent>, ActionStatus> eitherRestoreAudit = auditCassandraDao.getRestoreAuditByServiceInstanceId(componentUUID);
         if (eitherRestoreAudit.isRight()) {
             return Either.right(eitherRestoreAudit.right().value());
         }
-
         List<ResourceAdminEvent> archiveAudit = new ArrayList<>();
         archiveAudit.addAll(eitherArchiveAudit.left().value());
         archiveAudit.addAll(eitherRestoreAudit.left().value());
-
         return Either.left(archiveAudit);
     }
 
@@ -805,7 +643,6 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     private List<Map<String, Object>> getAuditingFieldsList(List<? extends AuditingGenericEvent> prevVerAuditList) {
-
         List<Map<String, Object>> prevVerAudit = new ArrayList<>();
         for (AuditingGenericEvent auditEvent : prevVerAuditList) {
             auditEvent.fillFields();
@@ -817,17 +654,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     /**
      * createService
      *
-     * @param service
-     *            - Service
-     * @param user
-     *            - modifier data (userId)
+     * @param service - Service
+     * @param user    - modifier data (userId)
      * @return Either<Service, responseFormat>
      */
     public Either<Service, ResponseFormat> createService(Service service, User user) {
-
         // get user details
         user = validateUser(user, "Create Service", service, AuditingActionEnum.CREATE_RESOURCE, false);
-        log.debug("User returned from validation: "+ user.toString());
+        log.debug("User returned from validation: " + user.toString());
         // validate user role
         validateUserRole(user, service, new ArrayList<>(), AuditingActionEnum.CREATE_RESOURCE, null);
         service.setCreatorUserId(user.getUserId());
@@ -844,11 +678,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (createServiceResponse.isRight()) {
             return createServiceResponse;
         }
-        return createServiceByDao(service, user)
-                .left()
-                .bind(c -> updateCatalog(c, ChangeTypeEnum.LIFECYCLE)
-                        .left()
-                        .map (r -> (Service) r));
+        return createServiceByDao(service, user).left().bind(c -> updateCatalog(c, ChangeTypeEnum.LIFECYCLE).left().map(r -> (Service) r));
     }
 
     private void checkFieldsForOverideAttampt(Service service) {
@@ -860,17 +690,13 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     private Either<Service, ResponseFormat> createServiceByDao(final Service service, final User user) {
         log.debug("send service {} to dao for create", service.getComponentMetadataDefinition().getMetadataDataDefinition().getName());
-
         Either<Boolean, ResponseFormat> lockResult = lockComponentByName(service.getSystemName(), service, "Create Service");
         if (lockResult.isRight()) {
             ResponseFormat responseFormat = lockResult.right().value();
-            componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE,
-                ComponentTypeEnum.SERVICE);
+            componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE, ComponentTypeEnum.SERVICE);
             return Either.right(responseFormat);
         }
-
         log.debug("System name locked is {}, status = {}", service.getSystemName(), lockResult);
-
         try {
             createMandatoryArtifactsData(service, user);
             createServiceApiArtifactsData(service, user);
@@ -879,20 +705,19 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             generatePropertiesFromGenericType(service, genericType);
             generateAndAddInputsFromGenericTypeProperties(service, genericType);
             beforeCreate(service);
-
             Either<Service, StorageOperationStatus> dataModelResponse = toscaOperationFacade.createToscaComponent(service);
             if (dataModelResponse.isLeft()) {
                 log.debug("Service '{}' created successfully", service.getName());
                 ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CREATED);
-                componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE,
-                    ComponentTypeEnum.SERVICE);
+                componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE, ComponentTypeEnum.SERVICE);
                 ASDCKpiApi.countCreatedServicesKPI();
                 return Either.left(dataModelResponse.left().value());
             }
-            ResponseFormat responseFormat = componentsUtils.getResponseFormatByComponent(componentsUtils.convertFromStorageResponse(dataModelResponse.right().value()), service, ComponentTypeEnum.SERVICE);
+            ResponseFormat responseFormat = componentsUtils
+                .getResponseFormatByComponent(componentsUtils.convertFromStorageResponse(dataModelResponse.right().value()), service,
+                    ComponentTypeEnum.SERVICE);
             log.debug(AUDIT_BEFORE_SENDING_RESPONSE);
-            componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE,
-                ComponentTypeEnum.SERVICE);
+            componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_RESOURCE, ComponentTypeEnum.SERVICE);
             return Either.right(responseFormat);
         } finally {
             graphLockOperation.unlockComponentByName(service.getSystemName(), service.getUniqueId(), NodeTypeEnum.Service);
@@ -903,36 +728,29 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (CollectionUtils.isEmpty(serviceCreationPluginList)) {
             return;
         }
-        serviceCreationPluginList.stream()
-            .sorted(Comparator.comparingInt(ServiceCreationPlugin::getOrder))
-            .forEach(serviceCreationPlugin -> {
-                try {
-                    serviceCreationPlugin.beforeCreate(service);
-                } catch (final Exception e) {
-                    log.error("An error has occurred while running the serviceCreationPlugin '{}'",
-                        serviceCreationPlugin.getClass(), e);
-                }
-            });
+        serviceCreationPluginList.stream().sorted(Comparator.comparingInt(ServiceCreationPlugin::getOrder)).forEach(serviceCreationPlugin -> {
+            try {
+                serviceCreationPlugin.beforeCreate(service);
+            } catch (final Exception e) {
+                log.error("An error has occurred while running the serviceCreationPlugin '{}'", serviceCreationPlugin.getClass(), e);
+            }
+        });
     }
 
     private void generatePropertiesFromGenericType(final Service service, final Resource genericType) {
         if (CollectionUtils.isEmpty(genericType.getProperties())) {
             return;
         }
-        final List<PropertyDefinition> genericTypePropertyList = genericType.getProperties().stream()
-            .map(PropertyDefinition::new)
-            .peek(propertyDefinition -> propertyDefinition.setUniqueId(null))
-            .collect(Collectors.toList());
+        final List<PropertyDefinition> genericTypePropertyList = genericType.getProperties().stream().map(PropertyDefinition::new)
+            .peek(propertyDefinition -> propertyDefinition.setUniqueId(null)).collect(Collectors.toList());
         if (service.getProperties() == null) {
             service.setProperties(new ArrayList<>(genericTypePropertyList));
         } else {
             List<PropertyDefinition> servicePropertyList = service.getProperties();
             genericTypePropertyList.stream()
-                .filter(property -> servicePropertyList.stream()
-                    .noneMatch(property1 -> property1.getName().equals(property.getName())))
+                .filter(property -> servicePropertyList.stream().noneMatch(property1 -> property1.getName().equals(property.getName())))
                 .forEach(servicePropertyList::add);
         }
-
         service.getProperties().forEach(propertyDefinition -> propertyDefinition.setUniqueId(null));
     }
 
@@ -941,15 +759,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         // create mandatory artifacts
 
         // TODO it must be removed after that artifact uniqueId creation will be
+
         // moved to ArtifactOperation
         String serviceUniqueId = service.getUniqueId();
         Map<String, ArtifactDefinition> artifactMap = service.getServiceApiArtifacts();
-        if (artifactMap == null)
+        if (artifactMap == null) {
             artifactMap = new HashMap<>();
-
+        }
         Map<String, Object> serviceApiArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration().getServiceApiArtifacts();
         List<String> exludeServiceCategory = ConfigurationManager.getConfigurationManager().getConfiguration().getExcludeServiceCategory();
-
         List<CategoryDefinition> categories = service.getCategories();
         boolean isCreateArtifact = true;
         if (categories != null && exludeServiceCategory != null && !exludeServiceCategory.isEmpty()) {
@@ -959,59 +777,53 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                     break;
                 }
             }
-
         }
-
         if (serviceApiArtifacts != null && isCreateArtifact) {
             Set<String> keys = serviceApiArtifacts.keySet();
             for (String serviceApiArtifactName : keys) {
                 Map<String, Object> artifactInfoMap = (Map<String, Object>) serviceApiArtifacts.get(serviceApiArtifactName);
-                ArtifactDefinition artifactDefinition = createArtifactDefinition(serviceUniqueId, serviceApiArtifactName, artifactInfoMap, user, true);
+                ArtifactDefinition artifactDefinition = createArtifactDefinition(serviceUniqueId, serviceApiArtifactName, artifactInfoMap, user,
+                    true);
                 artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.SERVICE_API);
                 artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition);
             }
-
             service.setServiceApiArtifacts(artifactMap);
         }
     }
 
     @VisibleForTesting
     protected Either<Service, ResponseFormat> validateServiceBeforeCreate(Service service, User user, AuditingActionEnum actionEnum) {
-
         try {
-            serviceValidator.validate(user,service,actionEnum);
+            serviceValidator.validate(user, service, actionEnum);
         } catch (ComponentException exp) {
             ResponseFormat responseFormat = componentsUtils.getResponseFormat(exp);
-            componentsUtils.auditComponentAdmin(responseFormat, user, service,
-                    AuditingActionEnum.CREATE_SERVICE, ComponentTypeEnum.SERVICE);
+            componentsUtils.auditComponentAdmin(responseFormat, user, service, AuditingActionEnum.CREATE_SERVICE, ComponentTypeEnum.SERVICE);
             throw exp;
         }
-
         service.setCreatorFullName(user.getFirstName() + " " + user.getLastName());
         service.setContactId(service.getContactId().toLowerCase());
-
         // Generate invariant UUID - must be here and not in operation since it
+
         // should stay constant during clone
         String invariantUUID = UniqueIdBuilder.buildInvariantUUID();
         service.setInvariantUUID(invariantUUID);
-
         return Either.left(service);
     }
 
     public Either<Map<String, Boolean>, ResponseFormat> validateServiceNameExists(String serviceName, String userId) {
         validateUserExists(userId);
-
-        Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(serviceName, null, ComponentTypeEnum.SERVICE);
+        Either<Boolean, StorageOperationStatus> dataModelResponse = toscaOperationFacade
+            .validateComponentNameUniqueness(serviceName, null, ComponentTypeEnum.SERVICE);
         // DE242223
         janusGraphDao.commit();
-
         if (dataModelResponse.isLeft()) {
             Map<String, Boolean> result = new HashMap<>();
             result.put(IS_VALID, dataModelResponse.left().value());
             log.debug("validation was successfully performed.");
             return Either.left(result);
         }
-        ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(dataModelResponse.right().value()));
+        ResponseFormat responseFormat = componentsUtils
+            .getResponseFormat(componentsUtils.convertFromStorageResponse(dataModelResponse.right().value()));
         return Either.right(responseFormat);
     }
 
@@ -1036,19 +848,16 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         user = validateUser(user, "updateServiceMetadata", serviceUpdate, null, false);
         // validate user role
         validateUserRole(user, serviceUpdate, new ArrayList<>(), null, null);
-
         Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaElement(serviceId);
         if (storageStatus.isRight()) {
-            return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
+            return Either.right(componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
         }
-
         Service currentService = storageStatus.left().value();
-
         if (!ComponentValidationUtils.canWorkOnComponent(currentService, user.getUserId())) {
             log.info("Restricted operation for user: {}, on service: {}", user.getUserId(), currentService.getCreatorUserId());
             return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION));
         }
-
         Either<Service, ResponseFormat> validationRsponse = validateAndUpdateServiceMetadata(user, currentService, serviceUpdate);
         if (validationRsponse.isRight()) {
             log.info("service update metadata: validations field.");
@@ -1056,30 +865,23 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         }
         Service serviceToUpdate = validationRsponse.left().value();
         // lock resource
-
         lockComponent(serviceId, currentService, "Update Service Metadata");
         try {
-            return toscaOperationFacade.updateToscaElement(serviceToUpdate)
-                    .right()
-                    .map(rf -> {
-                        janusGraphDao.rollback();
-                        BeEcompErrorManager.getInstance().logBeSystemError("Update Service Metadata");
-                        log.debug("failed to update sevice {}", serviceToUpdate.getUniqueId());
-                        return (componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
-                       })
-                    .left()
-                    .bind(c ->  updateCatalogAndCommit(c));
-
+            return toscaOperationFacade.updateToscaElement(serviceToUpdate).right().map(rf -> {
+                janusGraphDao.rollback();
+                BeEcompErrorManager.getInstance().logBeSystemError("Update Service Metadata");
+                log.debug("failed to update sevice {}", serviceToUpdate.getUniqueId());
+                return (componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR));
+            }).left().bind(c -> updateCatalogAndCommit(c));
         } finally {
             graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service);
         }
     }
 
-    private Either<Service, ResponseFormat> updateCatalogAndCommit(Service service){
-        Either<Service, ResponseFormat> res = updateCatalog(service, ChangeTypeEnum.LIFECYCLE).left().map(s -> (Service)s);
+    private Either<Service, ResponseFormat> updateCatalogAndCommit(Service service) {
+        Either<Service, ResponseFormat> res = updateCatalog(service, ChangeTypeEnum.LIFECYCLE).left().map(s -> (Service) s);
         janusGraphDao.commit();
         return res;
-
     }
 
     public Set<String> deleteForwardingPaths(String serviceId, Set<String> pathIdsToDelete, User user, boolean lock) {
@@ -1089,7 +891,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         validateUserRole(user, serviceToDelete, new ArrayList<>(), null, null);
         Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaElement(serviceId);
         if (storageStatus.isRight()) {
-            throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "");
+            throw new ByActionStatusComponentException(
+                componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "");
         }
         Service service = storageStatus.left().value();
         Either<Set<String>, StorageOperationStatus> result = null;
@@ -1098,27 +901,26 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 lockComponent(service.getUniqueId(), service, "Delete Forwarding Path on Service");
             } catch (ComponentException e) {
                 janusGraphDao.rollback();
-                throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse
-                        (storageStatus.right().value(), ComponentTypeEnum.SERVICE), "");
+                throw new ByActionStatusComponentException(
+                    componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "");
             }
         }
-        try{
-            result = forwardingPathOperation.deleteForwardingPath(service ,pathIdsToDelete);
+        try {
+            result = forwardingPathOperation.deleteForwardingPath(servicepathIdsToDelete);
             if (result.isRight()) {
                 log.debug(FAILED_TO_LOCK_SERVICE_RESPONSE_IS, service.getName(), result.right().value());
                 janusGraphDao.rollback();
-                throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse
-                        (storageStatus.right().value(), ComponentTypeEnum.SERVICE));
+                throw new ByActionStatusComponentException(
+                    componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE));
             }
             janusGraphDao.commit();
             log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, service.getSystemName());
-
-        } catch (ComponentException e){
+        } catch (ComponentException e) {
             log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e);
             janusGraphDao.rollback();
             throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
         } finally {
-              graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
+            graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service);
         }
         return result.left().value();
     }
@@ -1127,19 +929,19 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         Service serviceToDelete = new Service();
         serviceToDelete.setUniqueId(serviceId);
         serviceToDelete.setForwardingPaths(new HashMap<>());
-        pathIdsToDelete.forEach(pathIdToDelete ->  serviceToDelete.getForwardingPaths().put(pathIdToDelete, new ForwardingPathDataDefinition()));
+        pathIdsToDelete.forEach(pathIdToDelete -> serviceToDelete.getForwardingPaths().put(pathIdToDelete, new ForwardingPathDataDefinition()));
         return serviceToDelete;
     }
 
     public Service updateForwardingPath(String serviceId, Service serviceUpdate, User user, boolean lock) {
-        return createOrUpdateForwardingPath(serviceId, serviceUpdate, user, true,"updateForwardingPath", lock);
+        return createOrUpdateForwardingPath(serviceId, serviceUpdate, user, true, "updateForwardingPath", lock);
     }
 
     public Service createForwardingPath(String serviceId, Service serviceUpdate, User user, boolean lock) {
         return createOrUpdateForwardingPath(serviceId, serviceUpdate, user, false, "createForwardingPath", lock);
     }
 
-    private ForwardingPathDataDefinition  getTrimmedValues(ForwardingPathDataDefinition path){
+    private ForwardingPathDataDefinition getTrimmedValues(ForwardingPathDataDefinition path) {
         ForwardingPathDataDefinition dataDefinition = new ForwardingPathDataDefinition(path.getName());
         dataDefinition.setName(Strings.nullToEmpty(path.getName()).trim());
         dataDefinition.setProtocol(Strings.nullToEmpty(path.getProtocol()).trim());
@@ -1148,46 +950,38 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         dataDefinition.setPathElements(path.getPathElements());
         dataDefinition.setDescription(path.getDescription());
         dataDefinition.setToscaResourceName(path.getToscaResourceName());
-        return  dataDefinition;
+        return dataDefinition;
     }
 
-    private Service createOrUpdateForwardingPath(String serviceId, Service serviceUpdate, User user, boolean isUpdate, String errorContext, boolean lock) {
+    private Service createOrUpdateForwardingPath(String serviceId, Service serviceUpdate, User user, boolean isUpdate, String errorContext,
+                                                 boolean lock) {
         validateUserAndRole(serviceUpdate, user, errorContext);
-
         Map<String, ForwardingPathDataDefinition> forwardingPaths = serviceUpdate.getForwardingPaths();
-
-        Map<String, ForwardingPathDataDefinition> trimmedForwardingPaths =
-                forwardingPaths.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
-                        entry -> new ForwardingPathDataDefinition(getTrimmedValues(entry.getValue()))));
-
-        forwardingPathValidator.validateForwardingPaths(trimmedForwardingPaths.values(),
-                serviceId, isUpdate);
-
+        Map<String, ForwardingPathDataDefinition> trimmedForwardingPaths = forwardingPaths.entrySet().stream()
+            .collect(Collectors.toMap(Map.Entry::getKey, entry -> new ForwardingPathDataDefinition(getTrimmedValues(entry.getValue()))));
+        forwardingPathValidator.validateForwardingPaths(trimmedForwardingPaths.values(), serviceId, isUpdate);
         Either<Service, StorageOperationStatus> serviceStorageOperationStatusEither = toscaOperationFacade.getToscaElement(serviceId);
-
-        if(serviceStorageOperationStatusEither.isRight()){
+        if (serviceStorageOperationStatusEither.isRight()) {
             StorageOperationStatus errorStatus = serviceStorageOperationStatusEither.right().value();
             log.debug("Failed to fetch service information by service id, error {}", errorStatus);
             throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(errorStatus));
         }
         Service storedService = serviceStorageOperationStatusEither.left().value();
-
         Either<ForwardingPathDataDefinition, StorageOperationStatus> result;
         Component component = getForwardingPathOriginComponent();
         final String toscaResourceName;
-        if (  component.getComponentType() == ComponentTypeEnum.RESOURCE) {
+        if (component.getComponentType() == ComponentTypeEnum.RESOURCE) {
             toscaResourceName = ((Resource) component).getToscaResourceName();
         } else {
             toscaResourceName = "";
         }
         if (lock) {
-           lockComponent(storedService.getUniqueId(), storedService, "Add or Update Forwarding Path on Service");
-           log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, storedService.getSystemName());
+            lockComponent(storedService.getUniqueId(), storedService, "Add or Update Forwarding Path on Service");
+            log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, storedService.getSystemName());
         }
         Map<String, ForwardingPathDataDefinition> resultMap = new HashMap<>();
         try {
             trimmedForwardingPaths.values().forEach(fp -> fp.setToscaResourceName(toscaResourceName));
-
             populateForwardingPaths(serviceId, isUpdate, trimmedForwardingPaths, resultMap);
             janusGraphDao.commit();
         } finally {
@@ -1199,7 +993,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     private Component getForwardingPathOriginComponent() {
-        Either<Component, StorageOperationStatus> forwardingPathOrigin = toscaOperationFacade.getLatestByName(ForwardingPathUtils.FORWARDING_PATH_NODE_NAME);
+        Either<Component, StorageOperationStatus> forwardingPathOrigin = toscaOperationFacade
+            .getLatestByName(ForwardingPathUtils.FORWARDING_PATH_NODE_NAME);
         if (forwardingPathOrigin.isRight()) {
             StorageOperationStatus errorStatus = forwardingPathOrigin.right().value();
             log.debug("Failed to fetch normative forwarding path resource by tosca name, error {}", errorStatus);
@@ -1208,7 +1003,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return forwardingPathOrigin.left().value();
     }
 
-    private void populateForwardingPaths(String serviceId, boolean isUpdate, Map<String, ForwardingPathDataDefinition> trimmedForwardingPaths, Map<String, ForwardingPathDataDefinition> resultMap) {
+    private void populateForwardingPaths(String serviceId, boolean isUpdate, Map<String, ForwardingPathDataDefinition> trimmedForwardingPaths,
+                                         Map<String, ForwardingPathDataDefinition> resultMap) {
         Either<ForwardingPathDataDefinition, StorageOperationStatus> result;
         try {
             for (ForwardingPathDataDefinition forwardingPathDataDefinition : trimmedForwardingPaths.values()) {
@@ -1219,24 +1015,22 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 }
                 if (result.isRight()) {
                     janusGraphDao.rollback();
-                    throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(
-                        componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE),
-                        ""));
+                    throw new ByResponseFormatComponentException(componentsUtils
+                        .getResponseFormat(componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), ""));
                 } else {
                     ForwardingPathDataDefinition fpDataDefinition = result.left().value();
                     resultMap.put(fpDataDefinition.getUniqueId(), forwardingPathDataDefinition);
                 }
             }
-
         } catch (ComponentException e) {
             janusGraphDao.rollback();
-            log.error("Exception occurred during add or update forwarding path property values: {}",
-                    e.getMessage(), e);
+            log.error("Exception occurred during add or update forwarding path property values: {}", e.getMessage(), e);
             throw new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR);
         }
     }
 
-    private Service createServiceWithForwardingPathForResponse(String serviceId, Map<String,ForwardingPathDataDefinition> forwardingPathDataDefinitionMap) {
+    private Service createServiceWithForwardingPathForResponse(String serviceId,
+                                                               Map<String, ForwardingPathDataDefinition> forwardingPathDataDefinitionMap) {
         Service service = new Service();
         service.setUniqueId(serviceId);
         service.setForwardingPaths(forwardingPathDataDefinitionMap);
@@ -1250,87 +1044,70 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     @VisibleForTesting
     Either<Service, ResponseFormat> validateAndUpdateServiceMetadata(User user, Service currentService, Service serviceUpdate) {
-
         try {
             boolean hasBeenCertified = ValidationUtils.hasBeenCertified(currentService.getVersion());
-            Either<Boolean, ResponseFormat> response = validateAndUpdateCategory(user, currentService, serviceUpdate, hasBeenCertified, UPDATE_SERVICE_METADATA);
+            Either<Boolean, ResponseFormat> response = validateAndUpdateCategory(user, currentService, serviceUpdate, hasBeenCertified,
+                UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 ResponseFormat errorResponse = response.right().value();
                 return Either.right(errorResponse);
             }
-
             verifyValuesAreIdentical(serviceUpdate.getCreatorUserId(), currentService.getCreatorUserId(), "creatorUserId");
             verifyValuesAreIdentical(serviceUpdate.getCreatorFullName(), currentService.getCreatorFullName(), "creatorFullName");
             verifyValuesAreIdentical(serviceUpdate.getLastUpdaterUserId(), currentService.getLastUpdaterUserId(), "lastUpdaterUserId");
             verifyValuesAreIdentical(serviceUpdate.getLastUpdaterFullName(), currentService.getLastUpdaterFullName(), "lastUpdaterFullName");
-
             response = validateAndUpdateServiceName(user, currentService, serviceUpdate, hasBeenCertified, null);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             verifyValuesAreIdentical(serviceUpdate.getDistributionStatus(), currentService.getDistributionStatus(), "distributionStatus");
-
             if (serviceUpdate.getProjectCode() != null) {
                 response = validateAndUpdateProjectCode(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
                 if (response.isRight()) {
                     return Either.right(response.right().value());
                 }
             }
-
             response = validateAndUpdateIcon(user, currentService, serviceUpdate, hasBeenCertified, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             verifyValuesAreIdentical(serviceUpdate.getCreationDate(), currentService.getCreationDate(), "creationDate");
             verifyValuesAreIdentical(serviceUpdate.getVersion(), currentService.getVersion(), "version");
-
             response = validateAndUpdateDescription(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             response = validateAndUpdateTags(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             response = validateAndUpdateContactId(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             verifyValuesAreIdentical(serviceUpdate.getLastUpdateDate(), currentService.getLastUpdateDate(), "lastUpdateDate");
             verifyValuesAreIdentical(serviceUpdate.getLifecycleState(), currentService.getLifecycleState(), "lifecycleState");
             verifyValuesAreIdentical(serviceUpdate.isHighestVersion(), currentService.isHighestVersion(), "isHighestVersion");
             verifyValuesAreIdentical(serviceUpdate.getUUID(), currentService.getUUID(), "uuid");
-
             validateAndUpdateServiceType(currentService, serviceUpdate);
             validateAndUpdateServiceFunction(currentService, serviceUpdate);
-
             response = validateAndUpdateServiceRole(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             response = validateAndUpdateInstantiationTypeValue(user, currentService, serviceUpdate, UPDATE_SERVICE_METADATA);
             if (response.isRight()) {
                 return Either.right(response.right().value());
             }
-
             verifyValuesAreIdentical(serviceUpdate.getInvariantUUID(), currentService.getInvariantUUID(), "invariantUUID");
-
             validateAndUpdateEcompNaming(currentService, serviceUpdate);
-
             currentService.setEnvironmentContext(serviceUpdate.getEnvironmentContext());
             currentService.setCategorySpecificMetadata(serviceUpdate.getCategorySpecificMetadata());
             return Either.left(currentService);
-
         } catch (ComponentException exception) {
             ResponseFormat responseFormat = componentsUtils.getResponseFormat(exception);
-            componentsUtils.auditComponentAdmin(responseFormat, user, serviceUpdate,
-                    AuditingActionEnum.UPDATE_SERVICE_METADATA, ComponentTypeEnum.SERVICE);
+            componentsUtils
+                .auditComponentAdmin(responseFormat, user, serviceUpdate, AuditingActionEnum.UPDATE_SERVICE_METADATA, ComponentTypeEnum.SERVICE);
             return Either.right(responseFormat);
         }
     }
@@ -1358,7 +1135,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         }
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateContactId(User user, Service currentService, Service serviceUpdate, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateContactId(User user, Service currentService, Service serviceUpdate,
+                                                                       AuditingActionEnum audatingAction) {
         String contactIdUpdated = serviceUpdate.getContactId();
         String contactIdCurrent = currentService.getContactId();
         if (!contactIdCurrent.equals(contactIdUpdated)) {
@@ -1368,7 +1146,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateTags(User user, Service currentService, Service serviceUpdate, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateTags(User user, Service currentService, Service serviceUpdate,
+                                                                  AuditingActionEnum audatingAction) {
         List<String> tagsUpdated = serviceUpdate.getTags();
         List<String> tagsCurrent = currentService.getTags();
         if (tagsUpdated == null || tagsUpdated.isEmpty()) {
@@ -1376,7 +1155,6 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             componentsUtils.auditComponentAdmin(responseFormat, user, serviceUpdate, audatingAction, ComponentTypeEnum.SERVICE);
             return Either.right(responseFormat);
         }
-
         if (!(tagsCurrent.containsAll(tagsUpdated) && tagsUpdated.containsAll(tagsCurrent))) {
             componentTagsValidator.validateAndCorrectField(user, serviceUpdate, audatingAction);
             currentService.setTags(tagsUpdated);
@@ -1384,7 +1162,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateDescription(User user, Service currentService, Service serviceUpdate, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateDescription(User user, Service currentService, Service serviceUpdate,
+                                                                         AuditingActionEnum audatingAction) {
         String descriptionUpdated = serviceUpdate.getDescription();
         String descriptionCurrent = currentService.getDescription();
         if (!descriptionCurrent.equals(descriptionUpdated)) {
@@ -1394,12 +1173,11 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateProjectCode(User user, Service currentService, Service serviceUpdate, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateProjectCode(User user, Service currentService, Service serviceUpdate,
+                                                                         AuditingActionEnum audatingAction) {
         String projectCodeUpdated = serviceUpdate.getProjectCode();
         String projectCodeCurrent = currentService.getProjectCode();
-        if (StringUtils.isEmpty(projectCodeCurrent)
-                || !projectCodeCurrent.equals(projectCodeUpdated)) {
-
+        if (StringUtils.isEmpty(projectCodeCurrent) || !projectCodeCurrent.equals(projectCodeUpdated)) {
             try {
                 componentProjectCodeValidator.validateAndCorrectField(user, serviceUpdate, audatingAction);
             } catch (ComponentException exp) {
@@ -1407,12 +1185,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 return Either.right(errorRespons);
             }
             currentService.setProjectCode(projectCodeUpdated);
-
         }
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateIcon(User user, Service currentService, Service serviceUpdate, boolean hasBeenCertified, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateIcon(User user, Service currentService, Service serviceUpdate, boolean hasBeenCertified,
+                                                                  AuditingActionEnum audatingAction) {
         String iconUpdated = serviceUpdate.getIcon();
         String iconCurrent = currentService.getIcon();
         if (!iconCurrent.equals(iconUpdated)) {
@@ -1428,7 +1206,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateServiceName(User user, Service currentService, Service serviceUpdate, boolean hasBeenCertified, AuditingActionEnum auditingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateServiceName(User user, Service currentService, Service serviceUpdate,
+                                                                         boolean hasBeenCertified, AuditingActionEnum auditingAction) {
         String serviceNameUpdated = serviceUpdate.getName();
         String serviceNameCurrent = currentService.getName();
         if (!serviceNameCurrent.equals(serviceNameUpdated)) {
@@ -1440,9 +1219,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                     return Either.right(exp.getResponseFormat());
                 }
                 currentService.setName(serviceNameUpdated);
-                currentService.getComponentMetadataDefinition().getMetadataDataDefinition().setNormalizedName(ValidationUtils.normaliseComponentName(serviceNameUpdated));
-                currentService.getComponentMetadataDefinition().getMetadataDataDefinition().setSystemName(ValidationUtils.convertToSystemName(serviceNameUpdated));
-
+                currentService.getComponentMetadataDefinition().getMetadataDataDefinition()
+                    .setNormalizedName(ValidationUtils.normaliseComponentName(serviceNameUpdated));
+                currentService.getComponentMetadataDefinition().getMetadataDataDefinition()
+                    .setSystemName(ValidationUtils.convertToSystemName(serviceNameUpdated));
             } else {
                 log.info("service name {} cannot be updated once the service has been certified once.", serviceNameUpdated);
                 ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.SERVICE_NAME_CANNOT_BE_CHANGED);
@@ -1470,7 +1250,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         }
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateServiceRole(User user, Service currentService, Service updatedService, AuditingActionEnum auditingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateServiceRole(User user, Service currentService, Service updatedService,
+                                                                         AuditingActionEnum auditingAction) {
         String updatedServiceRole = updatedService.getServiceRole();
         String currentServiceRole = currentService.getServiceRole();
         if (!currentServiceRole.equals(updatedServiceRole)) {
@@ -1486,8 +1267,9 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateInstantiationTypeValue(User user, Service currentService, Service updatedService, AuditingActionEnum auditingAction) {
-        String updatedInstaType= updatedService.getInstantiationType();
+    private Either<Boolean, ResponseFormat> validateAndUpdateInstantiationTypeValue(User user, Service currentService, Service updatedService,
+                                                                                    AuditingActionEnum auditingAction) {
+        String updatedInstaType = updatedService.getInstantiationType();
         String currentInstaType = currentService.getInstantiationType();
         if (!currentInstaType.equals(updatedInstaType)) {
             try {
@@ -1502,7 +1284,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private Either<Boolean, ResponseFormat> validateAndUpdateCategory(User user, Service currentService, Service serviceUpdate, boolean hasBeenCertified, AuditingActionEnum audatingAction) {
+    private Either<Boolean, ResponseFormat> validateAndUpdateCategory(User user, Service currentService, Service serviceUpdate,
+                                                                      boolean hasBeenCertified, AuditingActionEnum audatingAction) {
         try {
             List<CategoryDefinition> categoryUpdated = serviceUpdate.getCategories();
             List<CategoryDefinition> categoryCurrent = currentService.getCategories();
@@ -1520,32 +1303,27 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             return Either.right(exp.getResponseFormat());
         }
         return Either.left(true);
-
     }
 
     public Either<ServiceRelations, ResponseFormat> getServiceComponentsRelations(String serviceId, User user) {
         Either<Service, ResponseFormat> serviceResponseFormatEither = getService(serviceId, user);
-        if (serviceResponseFormatEither.isRight()){
+        if (serviceResponseFormatEither.isRight()) {
             return Either.right(serviceResponseFormatEither.right().value());
         }
-        final ServiceRelations serviceRelations = new ForwardingPathUtils().convertServiceToServiceRelations(serviceResponseFormatEither.left().value());
+        final ServiceRelations serviceRelations = new ForwardingPathUtils()
+            .convertServiceToServiceRelations(serviceResponseFormatEither.left().value());
         return Either.left(serviceRelations);
-
-
     }
 
     public ResponseFormat deleteService(String serviceId, User user) {
         ResponseFormat responseFormat;
-
         validateUserExists(user);
         Either<Service, StorageOperationStatus> serviceStatus = toscaOperationFacade.getToscaElement(serviceId);
         if (serviceStatus.isRight()) {
             log.debug("failed to get service {}", serviceId);
             return componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceStatus.right().value()), "");
         }
-
         Service service = serviceStatus.left().value();
-
         StorageOperationStatus result = StorageOperationStatus.OK;
         try {
             lockComponent(service, "Mark service to delete");
@@ -1557,9 +1335,9 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 responseFormat = componentsUtils.getResponseFormatByResource(actionStatus, service.getName());
             }
             return responseFormat;
-        }catch (ComponentException e){
+        } catch (ComponentException e) {
             return e.getResponseFormat();
-        }finally {
+        } finally {
             if (result == null || result != StorageOperationStatus.OK) {
                 log.warn("operation failed. do rollback");
                 BeEcompErrorManager.getInstance().logBeSystemError("Delete Service");
@@ -1577,15 +1355,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         String ecompErrorContext = "delete service";
         validateUserNotEmpty(user, ecompErrorContext);
         user = validateUserExists(user);
-
         Either<Service, ResponseFormat> getResult = getServiceByNameAndVersion(serviceName, version, user.getUserId());
         if (getResult.isRight()) {
             return getResult.right().value();
         }
         Service service = getResult.left().value();
-
         StorageOperationStatus result = StorageOperationStatus.OK;
-
         try {
             lockComponent(service, "Mark service to delete");
             result = markComponentToDelete(service);
@@ -1596,11 +1371,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 responseFormat = componentsUtils.getResponseFormatByResource(actionStatus, service.getName());
             }
             return responseFormat;
-
-        }catch (ComponentException e){
+        } catch (ComponentException e) {
             result = StorageOperationStatus.GENERAL_ERROR;
             return componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
-        }finally {
+        } finally {
             if (result == null || result != StorageOperationStatus.OK) {
                 log.warn("operation failed. do rollback");
                 BeEcompErrorManager.getInstance().logBeSystemError("Delete Service");
@@ -1617,30 +1391,29 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         String ecompErrorContext = "Get service";
         validateUserNotEmpty(user, ecompErrorContext);
         validateUserExists(user);
-
         Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaElement(serviceId);
         if (storageStatus.isRight()) {
             log.debug("failed to get service by id {}", serviceId);
-            return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), serviceId));
+            return Either.right(componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), serviceId));
         }
-
-        if(!(storageStatus.left().value() instanceof Service)){
-            return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND), serviceId));
+        if (!(storageStatus.left().value() instanceof Service)) {
+            return Either
+                .right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(StorageOperationStatus.NOT_FOUND), serviceId));
         }
         Service service = storageStatus.left().value();
         return Either.left(service);
-
-
-
-
     }
 
     public Either<Service, ResponseFormat> getServiceByNameAndVersion(String serviceName, String serviceVersion, String userId) {
         validateUserExists(userId);
-        Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getComponentByNameAndVersion(ComponentTypeEnum.SERVICE, serviceName, serviceVersion);
+        Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade
+            .getComponentByNameAndVersion(ComponentTypeEnum.SERVICE, serviceName, serviceVersion);
         if (storageStatus.isRight()) {
             log.debug("failed to get service by name {} and version {}", serviceName, serviceVersion);
-            return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), serviceName));
+            return Either.right(componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE),
+                    serviceName));
         }
         Service service = storageStatus.left().value();
         return Either.left(service);
@@ -1651,15 +1424,16 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         // create mandatory artifacts
 
         // TODO it must be removed after that artifact uniqueId creation will be
+
         // moved to ArtifactOperation
         String serviceUniqueId = service.getUniqueId();
         Map<String, ArtifactDefinition> artifactMap = service.getArtifacts();
-        if (artifactMap == null)
+        if (artifactMap == null) {
             artifactMap = new HashMap<>();
-
-        Map<String, Object> informationalServiceArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration().getInformationalServiceArtifacts();
+        }
+        Map<String, Object> informationalServiceArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration()
+            .getInformationalServiceArtifacts();
         List<String> exludeServiceCategory = ConfigurationManager.getConfigurationManager().getConfiguration().getExcludeServiceCategory();
-
         String category = service.getCategories().get(0).getName();
         boolean isCreateArtifact = true;
         if (category != null && exludeServiceCategory != null && !exludeServiceCategory.isEmpty()) {
@@ -1669,26 +1443,23 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                     break;
                 }
             }
-
         }
-
         if (informationalServiceArtifacts != null && isCreateArtifact) {
             Set<String> keys = informationalServiceArtifacts.keySet();
             for (String informationalServiceArtifactName : keys) {
                 Map<String, Object> artifactInfoMap = (Map<String, Object>) informationalServiceArtifacts.get(informationalServiceArtifactName);
-                ArtifactDefinition artifactDefinition = createArtifactDefinition(serviceUniqueId, informationalServiceArtifactName, artifactInfoMap, user, false);
+                ArtifactDefinition artifactDefinition = createArtifactDefinition(serviceUniqueId, informationalServiceArtifactName, artifactInfoMap,
+                    user, false);
                 artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition);
-
             }
-
             service.setArtifacts(artifactMap);
         }
     }
 
-    private ArtifactDefinition createArtifactDefinition(String serviceId, String logicalName, Map<String, Object> artifactInfoMap, User user, Boolean isServiceApi) {
-
-        ArtifactDefinition artifactInfo = artifactsBusinessLogic.createArtifactPlaceHolderInfo(serviceId, logicalName, artifactInfoMap, user, ArtifactGroupTypeEnum.INFORMATIONAL);
-
+    private ArtifactDefinition createArtifactDefinition(String serviceId, String logicalName, Map<String, Object> artifactInfoMap, User user,
+                                                        Boolean isServiceApi) {
+        ArtifactDefinition artifactInfo = artifactsBusinessLogic
+            .createArtifactPlaceHolderInfo(serviceId, logicalName, artifactInfoMap, user, ArtifactGroupTypeEnum.INFORMATIONAL);
         if (isServiceApi) {
             artifactInfo.setMandatory(false);
             artifactInfo.setServiceApi(true);
@@ -1702,21 +1473,21 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return configuredEnvName;
     }
 
-    public Either<String, ResponseFormat> activateServiceOnTenantEnvironment(String serviceId, String envId, User modifier, ServiceDistributionReqInfo data) {
-
-        Either<ActivationRequestInformation, ResponseFormat> activationRequestInformationEither = serviceDistributionValidation.validateActivateServiceRequest(serviceId, envId, modifier, data);
+    public Either<String, ResponseFormat> activateServiceOnTenantEnvironment(String serviceId, String envId, User modifier,
+                                                                             ServiceDistributionReqInfo data) {
+        Either<ActivationRequestInformation, ResponseFormat> activationRequestInformationEither = serviceDistributionValidation
+            .validateActivateServiceRequest(serviceId, envId, modifier, data);
         if (activationRequestInformationEither.isRight()) {
             return Either.right(activationRequestInformationEither.right().value());
         }
-
         ActivationRequestInformation activationRequestInformation = activationRequestInformationEither.left().value();
-
         String did = ThreadLocalsHolder.getUuid();
         Service service = activationRequestInformation.getServiceToActivate();
         return buildAndSendServiceNotification(service, envId, did, activationRequestInformation.getWorkloadContext(), modifier);
     }
 
-    private Either<String, ResponseFormat> buildAndSendServiceNotification(Service service, String envId, String did, String workloadContext, User modifier) {
+    private Either<String, ResponseFormat> buildAndSendServiceNotification(Service service, String envId, String did, String workloadContext,
+                                                                           User modifier) {
         String envName = getEnvNameFromConfiguration();
         INotificationData notificationData = distributionEngine.buildServiceForDistribution(service, did, workloadContext);
         ActionStatus notifyServiceResponse = distributionEngine.notifyService(did, service, notificationData, envId, envName, modifier);
@@ -1731,21 +1502,19 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     public Either<Service, ResponseFormat> activateDistribution(String serviceId, String envName, User modifier, HttpServletRequest request) {
-
         User user = validateUserExists(modifier.getUserId());
         validateUserRole(user, Collections.singletonList(Role.DESIGNER));
         Either<Service, ResponseFormat> result;
         ResponseFormat response;
         Service updatedService;
         String did = ThreadLocalsHolder.getUuid();
-         // DE194021
+        // DE194021
         String configuredEnvName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0);
         if (configuredEnvName != null && !configuredEnvName.equals(envName)) {
             log.trace("Update environment name to be {} instead of {}", configuredEnvName, envName);
             envName = configuredEnvName;
         }
         // DE194021
-
         ServletContext servletContext = request.getSession().getServletContext();
         boolean isDistributionEngineUp = getHealthCheckBL(servletContext).isDistributionEngineUp(); // DE
         if (!isDistributionEngineUp) {
@@ -1754,16 +1523,13 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             response = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
             return Either.right(response);
         }
-
         Either<Service, StorageOperationStatus> serviceRes = toscaOperationFacade.getToscaElement(serviceId);
         if (serviceRes.isRight()) {
             log.debug("failed retrieving service");
-            response = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceRes.right().value(), ComponentTypeEnum.SERVICE), serviceId);
+            response = componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(serviceRes.right().value(), ComponentTypeEnum.SERVICE), serviceId);
             componentsUtils.auditComponent(response, user, null, AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST,
-                    new ResourceCommonInfo(ComponentTypeEnum.SERVICE.getValue()),
-                    ResourceVersionInfo.newBuilder()
-                            .build(),
-                    did);
+                new ResourceCommonInfo(ComponentTypeEnum.SERVICE.getValue()), ResourceVersionInfo.newBuilder().build(), did);
             return Either.right(response);
         }
         Service service = serviceRes.left().value();
@@ -1773,7 +1539,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         }
         if (service.getLifecycleState() != LifecycleStateEnum.CERTIFIED) {
             log.info("service {} is  not available for distribution. Should be in certified state", service.getUniqueId());
-            ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, service.getVersion(), service.getName());
+            ResponseFormat responseFormat = componentsUtils
+                .getResponseFormat(ActionStatus.SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, service.getVersion(), service.getName());
             return Either.right(responseFormat);
         }
         String dcurrStatus = service.getDistributionStatus().name();
@@ -1783,7 +1550,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             INotificationData notificationData = distributionEngine.buildServiceForDistribution(service, did, null);
             ActionStatus notifyServiceResponse = distributionEngine.notifyService(did, service, notificationData, envName, user);
             if (notifyServiceResponse == ActionStatus.OK) {
-                Either<Service, ResponseFormat> updateStateRes = updateDistributionStatusForActivation(service, user, DistributionStatusEnum.DISTRIBUTED);
+                Either<Service, ResponseFormat> updateStateRes = updateDistributionStatusForActivation(service, user,
+                    DistributionStatusEnum.DISTRIBUTED);
                 if (updateStateRes.isLeft() && updateStateRes.left().value() != null) {
                     updatedService = updateStateRes.left().value();
                     updatedStatus = updatedService.getDistributionStatus().name();
@@ -1801,28 +1569,22 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 result = Either.right(response);
             }
         } else {
-            response = componentsUtils.getResponseFormatByDE(componentsUtils.convertFromStorageResponse(readyForDistribution, ComponentTypeEnum.SERVICE), envName);
+            response = componentsUtils
+                .getResponseFormatByDE(componentsUtils.convertFromStorageResponse(readyForDistribution, ComponentTypeEnum.SERVICE), envName);
             result = Either.right(response);
         }
         componentsUtils.auditComponent(response, user, service, AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST,
-                new ResourceCommonInfo(service.getName(),ComponentTypeEnum.SERVICE.getValue()),
-                ResourceVersionInfo.newBuilder()
-                        .distributionStatus(dcurrStatus)
-                        .build(),
-                ResourceVersionInfo.newBuilder()
-                        .distributionStatus(updatedStatus)
-                        .build(),
-                null, null, did);
+            new ResourceCommonInfo(service.getName(), ComponentTypeEnum.SERVICE.getValue()),
+            ResourceVersionInfo.newBuilder().distributionStatus(dcurrStatus).build(),
+            ResourceVersionInfo.newBuilder().distributionStatus(updatedStatus).build(), null, null, did);
         return result;
     }
 
     // convert to private after deletion of temp url
     public Either<Service, ResponseFormat> updateDistributionStatusForActivation(Service service, User user, DistributionStatusEnum state) {
-
         validateUserExists(user.getUserId());
-
         String serviceId = service.getUniqueId();
-         lockComponent(serviceId, service, "updateDistributionStatusForActivation");
+        lockComponent(serviceId, service, "updateDistributionStatusForActivation");
         try {
             Either<Service, StorageOperationStatus> result = toscaOperationFacade.updateDistributionStatus(service, user, state);
             if (result.isRight()) {
@@ -1840,38 +1602,33 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     public Either<Service, ResponseFormat> markDistributionAsDeployed(String serviceId, String did, User user) {
-
         validateUserExists(user.getUserId());
         log.debug("mark distribution deployed");
-
         AuditingActionEnum auditAction = AuditingActionEnum.DISTRIBUTION_DEPLOY;
         Either<Service, StorageOperationStatus> getServiceResponse = toscaOperationFacade.getToscaElement(serviceId);
         if (getServiceResponse.isRight()) {
-            BeEcompErrorManager.getInstance().logBeComponentMissingError("markDistributionAsDeployed", ComponentTypeEnum.SERVICE.getValue(), serviceId);
+            BeEcompErrorManager.getInstance()
+                .logBeComponentMissingError("markDistributionAsDeployed", ComponentTypeEnum.SERVICE.getValue(), serviceId);
             log.debug("service {} not found", serviceId);
-            ResponseFormat responseFormat = auditDeployError(did, user, auditAction, null, componentsUtils.convertFromStorageResponse(getServiceResponse.right().value(), ComponentTypeEnum.SERVICE), "");
-
+            ResponseFormat responseFormat = auditDeployError(did, user, auditAction, null,
+                componentsUtils.convertFromStorageResponse(getServiceResponse.right().value(), ComponentTypeEnum.SERVICE), "");
             return Either.right(responseFormat);
         }
-
         Service service = getServiceResponse.left().value();
         user = validateRoleForDeploy(did, user, auditAction, service);
         return checkDistributionAndDeploy(did, user, auditAction, service);
-
     }
 
     public Either<Service, ResponseFormat> generateVfModuleArtifacts(Service service, User modifier, boolean shouldLock, boolean inTransaction) {
         Function<ComponentInstance, List<ArtifactGenerator<ArtifactDefinition>>> artifactTaskGeneratorCreator = ri ->
-                // Only one VF Module Artifact per instance - add it to a list of one
-                buildArtifactGenList(service, modifier, shouldLock, inTransaction, ri);
-
+            // Only one VF Module Artifact per instance - add it to a list of one
+            buildArtifactGenList(service, modifier, shouldLock, inTransaction, ri);
         return generateDeploymentArtifacts(service, artifactTaskGeneratorCreator);
-
     }
 
-    private List<ArtifactGenerator<ArtifactDefinition>> buildArtifactGenList(Service service, User modifier, boolean shouldLock, boolean inTransaction, ComponentInstance ri) {
+    private List<ArtifactGenerator<ArtifactDefinition>> buildArtifactGenList(Service service, User modifier, boolean shouldLock,
+                                                                             boolean inTransaction, ComponentInstance ri) {
         List<ArtifactGenerator<ArtifactDefinition>> asList = new ArrayList<>();
-
         if (ri.getOriginType() == OriginTypeEnum.VF) {
             asList = Arrays.asList(new VfModuleArtifactGenerator(modifier, ri, service, shouldLock, inTransaction));
         }
@@ -1880,25 +1637,25 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     private List<GroupInstance> collectGroupsInstanceForCompInstance(ComponentInstance currVF) {
         Map<String, ArtifactDefinition> deploymentArtifacts = currVF.getDeploymentArtifacts();
-        if(currVF.getGroupInstances() != null){
+        if (currVF.getGroupInstances() != null) {
             currVF.getGroupInstances().forEach(gi -> gi.alignArtifactsUuid(deploymentArtifacts));
         }
         return currVF.getGroupInstances();
     }
 
-    private ArtifactDefinition getVfModuleInstArtifactForCompInstance(ComponentInstance currVF, Service service, Wrapper<String> payloadWrapper, Wrapper<ResponseFormat> responseWrapper) {
+    private ArtifactDefinition getVfModuleInstArtifactForCompInstance(ComponentInstance currVF, Service service, Wrapper<String> payloadWrapper,
+                                                                      Wrapper<ResponseFormat> responseWrapper) {
         ArtifactDefinition vfModuleAertifact = null;
         if (MapUtils.isNotEmpty(currVF.getDeploymentArtifacts())) {
-            final Optional<ArtifactDefinition> optionalVfModuleArtifact =
-                currVF.getDeploymentArtifacts().values().stream()
-                    .filter(p -> p.getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA.getType()))
-                    .findAny();
+            final Optional<ArtifactDefinition> optionalVfModuleArtifact = currVF.getDeploymentArtifacts().values().stream()
+                .filter(p -> p.getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA.getType())).findAny();
             if (optionalVfModuleArtifact.isPresent()) {
                 vfModuleAertifact = optionalVfModuleArtifact.get();
             }
         }
         if (vfModuleAertifact == null) {
-            Either<ArtifactDefinition, ResponseFormat> createVfModuleArtifact = createVfModuleArtifact(currVF, service, payloadWrapper.getInnerElement());
+            Either<ArtifactDefinition, ResponseFormat> createVfModuleArtifact = createVfModuleArtifact(currVF, service,
+                payloadWrapper.getInnerElement());
             if (createVfModuleArtifact.isLeft()) {
                 vfModuleAertifact = createVfModuleArtifact.left().value();
             } else {
@@ -1916,16 +1673,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 vfModulePayloads.add(modulePayload);
             }
             vfModulePayloads.sort(VfModuleArtifactPayload::compareByGroupName);
-
             final Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
             String vfModulePayloadString = gson.toJson(vfModulePayloads);
             payloadWrapper.setInnerElement(vfModulePayloadString);
         }
-
     }
 
-    private Either<ArtifactDefinition, ResponseFormat> generateVfModuleInstanceArtifact(User modifier, ComponentInstance currVFInstance, Service service, boolean shouldLock, boolean inTransaction) {
+    private Either<ArtifactDefinition, ResponseFormat> generateVfModuleInstanceArtifact(User modifier, ComponentInstance currVFInstance,
+                                                                                        Service service, boolean shouldLock, boolean inTransaction) {
         ArtifactDefinition vfModuleArtifact = null;
         Wrapper<ResponseFormat> responseWrapper = new Wrapper<>();
         Wrapper<String> payloadWrapper = new Wrapper<>();
@@ -1937,23 +1692,27 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             vfModuleArtifact = getVfModuleInstArtifactForCompInstance(currVFInstance, service, payloadWrapper, responseWrapper);
         }
         if (responseWrapper.isEmpty() && vfModuleArtifact != null) {
-            vfModuleArtifact = fillVfModulePayload(modifier, currVFInstance, vfModuleArtifact, shouldLock, inTransaction, payloadWrapper, responseWrapper, service);
+            vfModuleArtifact = fillVfModulePayload(modifier, currVFInstance, vfModuleArtifact, shouldLock, inTransaction, payloadWrapper,
+                responseWrapper, service);
         }
-
         Either<ArtifactDefinition, ResponseFormat> result;
         if (responseWrapper.isEmpty()) {
             result = Either.left(vfModuleArtifact);
         } else {
             result = Either.right(responseWrapper.getInnerElement());
         }
-
         return result;
     }
 
-    private ArtifactDefinition fillVfModulePayload(User modifier, ComponentInstance currVF, ArtifactDefinition vfModuleArtifact, boolean shouldLock, boolean inTransaction, Wrapper<String> payloadWrapper, Wrapper<ResponseFormat> responseWrapper, Service service) {
+    private ArtifactDefinition fillVfModulePayload(User modifier, ComponentInstance currVF, ArtifactDefinition vfModuleArtifact, boolean shouldLock,
+                                                   boolean inTransaction, Wrapper<String> payloadWrapper, Wrapper<ResponseFormat> responseWrapper,
+                                                   Service service) {
         ArtifactDefinition result = null;
-        Either<ArtifactDefinition, ResponseFormat> eitherPayload = artifactsBusinessLogic.generateArtifactPayload(vfModuleArtifact, ComponentTypeEnum.RESOURCE_INSTANCE, service, currVF.getName(), modifier, shouldLock, inTransaction, System::currentTimeMillis,
-                () -> Either.left(artifactsBusinessLogic.createEsArtifactData(vfModuleArtifact, payloadWrapper.getInnerElement().getBytes(StandardCharsets.UTF_8))), currVF.getUniqueId());
+        Either<ArtifactDefinition, ResponseFormat> eitherPayload = artifactsBusinessLogic
+            .generateArtifactPayload(vfModuleArtifact, ComponentTypeEnum.RESOURCE_INSTANCE, service, currVF.getName(), modifier, shouldLock,
+                inTransaction, System::currentTimeMillis, () -> Either.left(
+                    artifactsBusinessLogic.createEsArtifactData(vfModuleArtifact, payloadWrapper.getInnerElement().getBytes(StandardCharsets.UTF_8))),
+                currVF.getUniqueId());
         if (eitherPayload.isLeft()) {
             result = eitherPayload.left().value();
         } else {
@@ -1962,15 +1721,13 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (result == null) {
             result = vfModuleArtifact;
         }
-
         return result;
     }
 
-    private Either<ArtifactDefinition, ResponseFormat> createVfModuleArtifact(ComponentInstance currVF, Service service, String vfModulePayloadString) {
-
+    private Either<ArtifactDefinition, ResponseFormat> createVfModuleArtifact(ComponentInstance currVF, Service service,
+                                                                              String vfModulePayloadString) {
         ArtifactDefinition vfModuleArtifactDefinition = new ArtifactDefinition();
         String newCheckSum = null;
-
         vfModuleArtifactDefinition.setDescription("Auto-generated VF Modules information artifact");
         vfModuleArtifactDefinition.setArtifactDisplayName("Vf Modules Metadata");
         vfModuleArtifactDefinition.setArtifactType(ArtifactTypeEnum.VF_MODULES_METADATA.getType());
@@ -1983,54 +1740,54 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             newCheckSum = GeneralUtility.calculateMD5Base64EncodedByByteArray(vfModulePayloadString.getBytes());
         }
         vfModuleArtifactDefinition.setArtifactChecksum(newCheckSum);
-
-        Either<ArtifactDefinition, StorageOperationStatus> addArtifactToComponent = artifactToscaOperation.addArtifactToComponent(
-                vfModuleArtifactDefinition, service, NodeTypeEnum.ResourceInstance, true, currVF.getUniqueId());
-
+        Either<ArtifactDefinition, StorageOperationStatus> addArtifactToComponent = artifactToscaOperation
+            .addArtifactToComponent(vfModuleArtifactDefinition, service, NodeTypeEnum.ResourceInstance, true, currVF.getUniqueId());
         Either<ArtifactDefinition, ResponseFormat> result;
         if (addArtifactToComponent.isLeft()) {
             result = Either.left(addArtifactToComponent.left().value());
         } else {
-            result = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addArtifactToComponent.right().value())));
+            result = Either
+                .right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addArtifactToComponent.right().value())));
         }
-
         return result;
     }
 
     public Either<Service, ResponseFormat> generateHeatEnvArtifacts(Service service, User modifier, boolean shouldLock, boolean inTransaction) {
-
         Function<ComponentInstance, List<ArtifactGenerator<ArtifactDefinition>>> artifactTaskGeneratorCreator = resourceInstance ->
-                // Get All Deployment Artifacts
-                service.getComponentInstances().stream().filter(ri -> ri != null && ri == resourceInstance).filter(ri -> ri.getDeploymentArtifacts() != null).flatMap(ri -> ri.getDeploymentArtifacts().values().stream()).
-                        // Filter in Only Heat Env
-                                filter(depArtifact -> ArtifactTypeEnum.HEAT_ENV.getType().equals(depArtifact.getArtifactType())).
-                        // Create ArtifactGenerator from those Artifacts
-                                map(depArtifact -> new HeatEnvArtifactGenerator(depArtifact, service, resourceInstance.getName(), modifier, shouldLock, inTransaction, resourceInstance.getUniqueId())).collect(Collectors.toList());
-
+            // Get All Deployment Artifacts
+            service.getComponentInstances().stream().filter(ri -> ri != null && ri == resourceInstance)
+                .filter(ri -> ri.getDeploymentArtifacts() != null).flatMap(ri -> ri.getDeploymentArtifacts().values().stream()).
+                // Filter in Only Heat Env
+                    filter(depArtifact -> ArtifactTypeEnum.HEAT_ENV.getType().equals(depArtifact.getArtifactType())).
+                // Create ArtifactGenerator from those Artifacts
+                    map(
+                    depArtifact -> new HeatEnvArtifactGenerator(depArtifact, service, resourceInstance.getName(), modifier, shouldLock, inTransaction,
+                        resourceInstance.getUniqueId())).collect(Collectors.toList());
         return generateDeploymentArtifacts(service, artifactTaskGeneratorCreator);
-
     }
 
-    private <CallVal> Either<Service, ResponseFormat> generateDeploymentArtifacts(Service service, Function<ComponentInstance, List<ArtifactGenerator<CallVal>>> artifactTaskGeneratorCreator) {
-
+    private <CallVal> Either<Service, ResponseFormat> generateDeploymentArtifacts(Service service,
+                                                                                  Function<ComponentInstance, List<ArtifactGenerator<CallVal>>> artifactTaskGeneratorCreator) {
         // Get Flat List of (Callable) ArtifactGenerator for all the RI in the
+
         // service
         if (service.getComponentInstances() != null) {
-            List<ArtifactGenerator<CallVal>> artifactGenList = service.getComponentInstances().stream().flatMap(ri -> artifactTaskGeneratorCreator.apply(ri).stream()).collect(Collectors.toList());
+            List<ArtifactGenerator<CallVal>> artifactGenList = service.getComponentInstances().stream()
+                .flatMap(ri -> artifactTaskGeneratorCreator.apply(ri).stream()).collect(Collectors.toList());
             if (artifactGenList != null && !artifactGenList.isEmpty()) {
                 Either<Service, ResponseFormat> callRes = checkDeploymentArtifact(artifactGenList);
-                if (callRes != null) return callRes;
+                if (callRes != null) {
+                    return callRes;
+                }
             }
         }
         Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaFullElement(service.getUniqueId());
         if (storageStatus.isRight()) {
-            return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
+            return Either.right(componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), ""));
         }
-
         Service currentService = storageStatus.left().value();
-
         return Either.left(currentService);
-
     }
 
     private <CallVal> Either<Service, ResponseFormat> checkDeploymentArtifact(List<ArtifactGenerator<CallVal>> artifactGenList) {
@@ -2050,61 +1807,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return null;
     }
 
-    abstract class ArtifactGenerator<CallVal> implements Callable<Either<CallVal, ResponseFormat>> {
-
-    }
-
-    @Getter
-    class HeatEnvArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> {
-        private ArtifactDefinition artifactDefinition;
-        private Service service;
-        private String resourceInstanceName;
-        private User modifier;
-        private String instanceId;
-        private boolean shouldLock;
-        private boolean inTransaction;
-
-        HeatEnvArtifactGenerator(ArtifactDefinition artifactDefinition, Service service, String resourceInstanceName, User modifier, boolean shouldLock, boolean inTransaction, String instanceId) {
-            this.artifactDefinition = artifactDefinition;
-            this.service = service;
-            this.resourceInstanceName = resourceInstanceName;
-            this.modifier = modifier;
-            this.shouldLock = shouldLock;
-            this.instanceId = instanceId;
-            this.inTransaction = inTransaction;
-        }
-
-        @Override
-        public Either<ArtifactDefinition, ResponseFormat> call() throws Exception {
-            return artifactsBusinessLogic.forceGenerateHeatEnvArtifact(artifactDefinition, ComponentTypeEnum.RESOURCE_INSTANCE, service, resourceInstanceName, modifier, shouldLock, inTransaction, instanceId);
-        }
-
-    }
-
-    class VfModuleArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> {
-        private User user;
-        private ComponentInstance componentInstance;
-        private Service service;
-        boolean shouldLock;
-        boolean inTransaction;
-
-        @Override
-        public Either<ArtifactDefinition, ResponseFormat> call() throws Exception {
-            return generateVfModuleInstanceArtifact(user, componentInstance, service, shouldLock, inTransaction);
-        }
-
-        private VfModuleArtifactGenerator(User user, ComponentInstance componentInstance, Service service, boolean shouldLock, boolean inTransaction) {
-            super();
-            this.user = user;
-            this.componentInstance = componentInstance;
-            this.service = service;
-            this.shouldLock = shouldLock;
-            this.inTransaction = inTransaction;
-        }
-
-    }
-
-    private synchronized Either<Service, ResponseFormat> checkDistributionAndDeploy(String distributionId, User user, AuditingActionEnum auditAction, Service service) {
+    private synchronized Either<Service, ResponseFormat> checkDistributionAndDeploy(String distributionId, User user, AuditingActionEnum auditAction,
+                                                                                    Service service) {
         boolean isDeployed = isDistributionDeployed(distributionId);
         if (isDeployed) {
             return Either.left(service);
@@ -2113,15 +1817,16 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (distributionSuccess.isRight()) {
             return Either.right(distributionSuccess.right().value());
         }
-
         log.debug("mark distribution {} as deployed - success", distributionId);
-        componentsUtils.auditServiceDistributionDeployed(service.getName(), service.getVersion(), service.getUUID(), distributionId, STATUS_DEPLOYED, "OK", user);
+        componentsUtils
+            .auditServiceDistributionDeployed(service.getName(), service.getVersion(), service.getUUID(), distributionId, STATUS_DEPLOYED, "OK",
+                user);
         return Either.left(service);
     }
 
     private boolean isDistributionDeployed(String distributionId) {
-        Either<List<DistributionDeployEvent>, ActionStatus> alreadyDeployed = auditCassandraDao.getDistributionDeployByStatus(distributionId, AuditingActionEnum.DISTRIBUTION_DEPLOY.getName(), STATUS_DEPLOYED);
-
+        Either<List<DistributionDeployEvent>, ActionStatus> alreadyDeployed = auditCassandraDao
+            .getDistributionDeployByStatus(distributionId, AuditingActionEnum.DISTRIBUTION_DEPLOY.getName(), STATUS_DEPLOYED);
         boolean isDeployed = false;
         if (alreadyDeployed.isLeft() && !alreadyDeployed.left().value().isEmpty()) {
             // already deployed
@@ -2132,16 +1837,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     protected Either<Boolean, ResponseFormat> checkDistributionSuccess(String did, User user, AuditingActionEnum auditAction, Service service) {
-
         log.trace("checkDistributionSuccess");
         // get all "DRequest" records for this distribution
-
-        Either<List<ResourceAdminEvent>, ActionStatus> distRequestsResponse = auditCassandraDao.getDistributionRequest(did, AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST.getName());
+        Either<List<ResourceAdminEvent>, ActionStatus> distRequestsResponse = auditCassandraDao
+            .getDistributionRequest(did, AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST.getName());
         if (distRequestsResponse.isRight()) {
             ResponseFormat error = auditDeployError(did, user, auditAction, service, distRequestsResponse.right().value());
             return Either.right(error);
         }
-
         List<ResourceAdminEvent> distributionRequests = distRequestsResponse.left().value();
         if (distributionRequests.isEmpty()) {
             BeEcompErrorManager.getInstance().logBeDistributionMissingError("markDistributionAsDeployed", did);
@@ -2157,14 +1860,13 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 break;
             }
         }
-
         // get all "DNotify" records for this distribution
-        Either<List<DistributionNotificationEvent>, ActionStatus> distNotificationsResponse = auditCassandraDao.getDistributionNotify(did, AuditingActionEnum.DISTRIBUTION_NOTIFY.getName());
+        Either<List<DistributionNotificationEvent>, ActionStatus> distNotificationsResponse = auditCassandraDao
+            .getDistributionNotify(did, AuditingActionEnum.DISTRIBUTION_NOTIFY.getName());
         if (distNotificationsResponse.isRight()) {
             ResponseFormat error = auditDeployError(did, user, auditAction, service, distNotificationsResponse.right().value());
             return Either.right(error);
         }
-
         List<DistributionNotificationEvent> distributionNotifications = distNotificationsResponse.left().value();
         boolean isNotificationsSucceeded = false;
         for (DistributionNotificationEvent event : distributionNotifications) {
@@ -2174,10 +1876,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 break;
             }
         }
-
         // if request failed OR there are notifications that failed
         if (!(isRequestSucceeded && isNotificationsSucceeded)) {
-
             log.info("distribution {} has failed", did);
             ResponseFormat error = componentsUtils.getResponseFormat(ActionStatus.DISTRIBUTION_REQUESTED_FAILED, did);
             auditDeployError(did, user, auditAction, service, ActionStatus.DISTRIBUTION_REQUESTED_FAILED, did);
@@ -2186,17 +1886,18 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(true);
     }
 
-    private ResponseFormat auditDeployError(String did, User user, AuditingActionEnum auditAction, Service service, ActionStatus status, String... params) {
-
+    private ResponseFormat auditDeployError(String did, User user, AuditingActionEnum auditAction, Service service, ActionStatus status,
+                                            String... params) {
         ResponseFormat error = componentsUtils.getResponseFormat(status, params);
         String message = "";
         if (error.getMessageId() != null) {
             message = error.getMessageId() + ": ";
         }
         message += error.getFormattedMessage();
-
         if (service != null) {
-            componentsUtils.auditServiceDistributionDeployed(service.getName(), service.getVersion(), service.getUUID(), did, error.getStatus().toString(), message, user);
+            componentsUtils
+                .auditServiceDistributionDeployed(service.getName(), service.getVersion(), service.getUUID(), did, error.getStatus().toString(),
+                    message, user);
         } else {
             componentsUtils.auditServiceDistributionDeployed("", "", "", did, error.getStatus().toString(), message, user);
         }
@@ -2209,9 +1910,9 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         List<Role> roles = new ArrayList<>();
         roles.add(Role.ADMIN);
         roles.add(Role.DESIGNER);
-        try{
+        try {
             validateUserRole(user, service, roles, auditAction, null);
-        } catch (ByActionStatusComponentException e){
+        } catch (ByActionStatusComponentException e) {
             log.info("role {} is not allowed to perform this action", user.getRole());
             auditDeployError(did, user, auditAction, service, e.getActionStatus());
             throw e;
@@ -2221,28 +1922,27 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     @Override
     public void setDeploymentArtifactsPlaceHolder(Component component, User user) {
-        if(component instanceof Service){
+        if (component instanceof Service) {
             Service service = (Service) component;
             Map<String, ArtifactDefinition> artifactMap = service.getDeploymentArtifacts();
             if (artifactMap == null) {
                 artifactMap = new HashMap<>();
             }
             service.setDeploymentArtifacts(artifactMap);
-        }else if(component instanceof Resource){
+        } else if (component instanceof Resource) {
             Resource resource = (Resource) component;
             Map<String, ArtifactDefinition> artifactMap = resource.getDeploymentArtifacts();
             if (artifactMap == null) {
                 artifactMap = new HashMap<>();
             }
-            Map<String, Object> deploymentResourceArtifacts = ConfigurationManager.getConfigurationManager()
-                                                                      .getConfiguration().getDeploymentResourceArtifacts();
+            Map<String, Object> deploymentResourceArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration()
+                .getDeploymentResourceArtifacts();
             if (deploymentResourceArtifacts != null) {
                 Map<String, ArtifactDefinition> finalArtifactMap = artifactMap;
-                deploymentResourceArtifacts.forEach((k, v)->processDeploymentResourceArtifacts(user, resource, finalArtifactMap, k,v));
+                deploymentResourceArtifacts.forEach((k, v) -> processDeploymentResourceArtifacts(user, resource, finalArtifactMap, k, v));
             }
             resource.setDeploymentArtifacts(artifactMap);
         }
-
     }
 
     private void processDeploymentResourceArtifacts(User user, Resource resource, Map<String, ArtifactDefinition> artifactMap, String k, Object v) {
@@ -2254,15 +1954,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 return;
             }
         } else {
-            log.info("resource types for artifact placeholder {} were not defined. default is all resources",
-                    k);
+            log.info("resource types for artifact placeholder {} were not defined. default is all resources", k);
         }
         if (artifactsBusinessLogic != null) {
-            ArtifactDefinition artifactDefinition = artifactsBusinessLogic.createArtifactPlaceHolderInfo(
-                    resource.getUniqueId(), k, (Map<String, Object>) v,
-                    user, ArtifactGroupTypeEnum.DEPLOYMENT);
-            if (artifactDefinition != null
-                    && !artifactMap.containsKey(artifactDefinition.getArtifactLabel())) {
+            ArtifactDefinition artifactDefinition = artifactsBusinessLogic
+                .createArtifactPlaceHolderInfo(resource.getUniqueId(), k, (Map<String, Object>) v, user, ArtifactGroupTypeEnum.DEPLOYMENT);
+            if (artifactDefinition != null && !artifactMap.containsKey(artifactDefinition.getArtifactLabel())) {
                 artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition);
             }
         }
@@ -2274,7 +1971,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     private HealthCheckBusinessLogic getHealthCheckBL(ServletContext context) {
-        WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR);
+        WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context
+            .getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR);
         WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context);
         return webApplicationContext.getBean(HealthCheckBusinessLogic.class);
     }
@@ -2286,16 +1984,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
 
     @Override
     public Either<List<ComponentInstance>, ResponseFormat> getComponentInstancesFilteredByPropertiesAndInputs(String componentId, String userId) {
-
         validateUserExists(userId);
         Either<Component, StorageOperationStatus> getComponentRes = toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll);
         if (getComponentRes.isRight()) {
-            ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getComponentRes.right().value()));
+            ResponseFormat responseFormat = componentsUtils
+                .getResponseFormat(componentsUtils.convertFromStorageResponse(getComponentRes.right().value()));
             return Either.right(responseFormat);
         }
-
         List<ComponentInstance> componentInstances = getComponentRes.left().value().getComponentInstances();
-
         return Either.left(componentInstances);
     }
 
@@ -2305,11 +2001,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     }
 
     /**
-     * updates group instance with new property values in case of successful update of group instance related component instance will be updated with new modification time and related service will be updated with new last update date
-     *
+     * updates group instance with new property values in case of successful update of group instance related component instance will be updated with
+     * new modification time and related service will be updated with new last update date
      */
-    public Either<List<GroupInstanceProperty>, ResponseFormat> updateGroupInstancePropertyValues(User modifier, String serviceId, String componentInstanceId, String groupInstanceId, List<GroupInstanceProperty> newProperties) {
-
+    public Either<List<GroupInstanceProperty>, ResponseFormat> updateGroupInstancePropertyValues(User modifier, String serviceId,
+                                                                                                 String componentInstanceId, String groupInstanceId,
+                                                                                                 List<GroupInstanceProperty> newProperties) {
         Either<List<GroupInstanceProperty>, ResponseFormat> actionResult = null;
         Either<ImmutablePair<Component, User>, ResponseFormat> validateUserAndComponentRes;
         Component component = null;
@@ -2332,9 +2029,11 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 }
             }
             if (actionResult == null) {
-                actionResult = validateAndUpdateGroupInstancePropertyValuesAndContainingParents(component, componentInstanceId, groupInstanceId, newProperties);
+                actionResult = validateAndUpdateGroupInstancePropertyValuesAndContainingParents(component, componentInstanceId, groupInstanceId,
+                    newProperties);
                 if (actionResult.isRight()) {
-                    log.debug("Failed to validate and update group instance {} property values and containing parents. The message is {}. ", groupInstanceId, actionResult.right().value().getFormattedMessage());
+                    log.debug("Failed to validate and update group instance {} property values and containing parents. The message is {}. ",
+                        groupInstanceId, actionResult.right().value().getFormattedMessage());
                 }
             }
         } catch (Exception e) {
@@ -2348,8 +2047,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return actionResult;
     }
 
-    private Either<List<GroupInstanceProperty>, ResponseFormat> validateAndUpdateGroupInstancePropertyValuesAndContainingParents(Component component, String componentInstanceId, String groupInstanceId, List<GroupInstanceProperty> newProperties) {
-
+    private Either<List<GroupInstanceProperty>, ResponseFormat> validateAndUpdateGroupInstancePropertyValuesAndContainingParents(Component component,
+                                                                                                                                 String componentInstanceId,
+                                                                                                                                 String groupInstanceId,
+                                                                                                                                 List<GroupInstanceProperty> newProperties) {
         Either<List<GroupInstanceProperty>, ResponseFormat> actionResult = null;
         Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat> findGroupInstanceRes;
         Either<ImmutablePair<ComponentMetadataData, ComponentInstanceData>, ResponseFormat> updateParentsModificationTimeRes;
@@ -2366,18 +2067,23 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         if (actionResult == null) {
             oldGroupInstance = findGroupInstanceRes.left().value().getValue();
             relatedComponentInstance = findGroupInstanceRes.left().value().getKey();
-            updateGroupInstanceResult = groupBusinessLogic.validateAndUpdateGroupInstancePropertyValues(component.getUniqueId(), componentInstanceId, oldGroupInstance, newProperties);
+            updateGroupInstanceResult = groupBusinessLogic
+                .validateAndUpdateGroupInstancePropertyValues(component.getUniqueId(), componentInstanceId, oldGroupInstance, newProperties);
             if (updateGroupInstanceResult.isRight()) {
-                log.debug("#validateAndUpdateGroupInstancePropertyValuesAndContainingParents - Failed to update group instance {} property values. ", oldGroupInstance.getName());
+                log.debug("#validateAndUpdateGroupInstancePropertyValuesAndContainingParents - Failed to update group instance {} property values. ",
+                    oldGroupInstance.getName());
                 actionResult = Either.right(updateGroupInstanceResult.right().value());
             }
         }
         if (actionResult == null) {
             updatedGroupInstance = updateGroupInstanceResult.left().value();
             if (!oldGroupInstance.getModificationTime().equals(updatedGroupInstance.getModificationTime())) {
-                updateParentsModificationTimeRes = updateParentsModificationTimeAndCustomizationUuid(component, relatedComponentInstance, updatedGroupInstance, inTransaction);
+                updateParentsModificationTimeRes = updateParentsModificationTimeAndCustomizationUuid(component, relatedComponentInstance,
+                    updatedGroupInstance, inTransaction);
                 if (updateParentsModificationTimeRes.isRight()) {
-                    log.debug("#validateAndUpdateGroupInstancePropertyValuesAndContainingParents - Failed to update modification time for group instance {}. ", oldGroupInstance.getName());
+                    log.debug(
+                        "#validateAndUpdateGroupInstancePropertyValuesAndContainingParents - Failed to update modification time for group instance {}. ",
+                        oldGroupInstance.getName());
                     actionResult = Either.right(updateParentsModificationTimeRes.right().value());
                 }
             }
@@ -2388,30 +2094,33 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return actionResult;
     }
 
-    private Either<ImmutablePair<ComponentMetadataData, ComponentInstanceData>, ResponseFormat> updateParentsModificationTimeAndCustomizationUuid(Component component, ComponentInstance relatedComponentInstance, GroupInstance updatedGroupInstance,
-                                                                                                                                                  boolean inTranscation) {
-
+    private Either<ImmutablePair<ComponentMetadataData, ComponentInstanceData>, ResponseFormat> updateParentsModificationTimeAndCustomizationUuid(
+        Component component, ComponentInstance relatedComponentInstance, GroupInstance updatedGroupInstance, boolean inTranscation) {
         Either<ImmutablePair<ComponentMetadataData, ComponentInstanceData>, ResponseFormat> actionResult;
         Either<ComponentMetadataData, StorageOperationStatus> serviceMetadataUpdateResult;
-        Either<ComponentInstanceData, ResponseFormat> updateComponentInstanceRes = componentInstanceBusinessLogic.updateComponentInstanceModificationTimeAndCustomizationUuid(relatedComponentInstance, NodeTypeEnum.ResourceInstance,
+        Either<ComponentInstanceData, ResponseFormat> updateComponentInstanceRes = componentInstanceBusinessLogic
+            .updateComponentInstanceModificationTimeAndCustomizationUuid(relatedComponentInstance, NodeTypeEnum.ResourceInstance,
                 updatedGroupInstance.getModificationTime(), inTranscation);
         if (updateComponentInstanceRes.isRight()) {
-            log.debug("Failed to update component instance {} after update of group instance {}. ", relatedComponentInstance.getName(), updatedGroupInstance.getName());
+            log.debug("Failed to update component instance {} after update of group instance {}. ", relatedComponentInstance.getName(),
+                updatedGroupInstance.getName());
             actionResult = Either.right(updateComponentInstanceRes.right().value());
         } else {
             serviceMetadataUpdateResult = toscaOperationFacade.updateComponentLastUpdateDateOnGraph(component);
             if (serviceMetadataUpdateResult.isRight()) {
-                log.debug("Failed to update service {} after update of component instance {} with new property values of group instance {}. ", component.getName(), relatedComponentInstance.getName(), updatedGroupInstance.getName());
-                actionResult = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceMetadataUpdateResult.right().value())));
+                log.debug("Failed to update service {} after update of component instance {} with new property values of group instance {}. ",
+                    component.getName(), relatedComponentInstance.getName(), updatedGroupInstance.getName());
+                actionResult = Either.right(
+                    componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceMetadataUpdateResult.right().value())));
             } else {
-                actionResult = Either.left(new ImmutablePair<>(serviceMetadataUpdateResult.left().value(), updateComponentInstanceRes.left().value()));
+                actionResult = Either
+                    .left(new ImmutablePair<>(serviceMetadataUpdateResult.left().value(), updateComponentInstanceRes.left().value()));
             }
         }
         return actionResult;
     }
 
     private Either<ImmutablePair<Component, User>, ResponseFormat> validateUserAndComponent(String serviceId, User modifier) {
-
         Either<ImmutablePair<Component, User>, ResponseFormat> result = null;
         User currUser = null;
         Component component = null;
@@ -2425,7 +2134,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
             try {
                 component = validateComponentExists(serviceId, ComponentTypeEnum.SERVICE, null);
                 if (!ComponentValidationUtils.canWorkOnComponent(component, currUser.getUserId())) {
-                    log.info("#validateUserAndComponent - Restricted operation for user: {}, on service: {}", currUser.getUserId(), component.getCreatorUserId());
+                    log.info("#validateUserAndComponent - Restricted operation for user: {}, on service: {}", currUser.getUserId(),
+                        component.getCreatorUserId());
                     return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION));
                 }
             } catch (ComponentException e) {
@@ -2433,27 +2143,31 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
                 result = Either.right(e.getResponseFormat());
             }
         }
-
         if (result == null) {
             result = Either.left(new ImmutablePair<>(component, currUser));
         }
         return result;
     }
 
-    private Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat> findGroupInstanceOnRelatedComponentInstance(Component component, String componentInstanceId, String groupInstanceId) {
-
+    private Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat> findGroupInstanceOnRelatedComponentInstance(Component component,
+                                                                                                                                String componentInstanceId,
+                                                                                                                                String groupInstanceId) {
         Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat> actionResult = null;
         GroupInstance groupInstance = null;
         ComponentInstance foundComponentInstance = findRelatedComponentInstance(component, componentInstanceId);
         if (foundComponentInstance == null) {
             log.debug("Component instance {} not found on service {}. ", componentInstanceId, component.getName());
-            actionResult = Either.right(componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, componentInstanceId, "resource instance", "service", component.getName()));
-        }
-        else if (isNotEmpty(foundComponentInstance.getGroupInstances())) {
-            groupInstance = foundComponentInstance.getGroupInstances().stream().filter(gi -> gi.getUniqueId().equals(groupInstanceId)).findFirst().orElse(null);
+            actionResult = Either.right(componentsUtils
+                .getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, componentInstanceId, "resource instance", "service",
+                    component.getName()));
+        } else if (isNotEmpty(foundComponentInstance.getGroupInstances())) {
+            groupInstance = foundComponentInstance.getGroupInstances().stream().filter(gi -> gi.getUniqueId().equals(groupInstanceId)).findFirst()
+                .orElse(null);
             if (groupInstance == null) {
                 log.debug("Group instance {} not found on component instance {}. ", groupInstanceId, foundComponentInstance.getName());
-                actionResult = Either.right(componentsUtils.getResponseFormat(ActionStatus.GROUP_INSTANCE_NOT_FOUND_ON_COMPONENT_INSTANCE, groupInstanceId, foundComponentInstance.getName()));
+                actionResult = Either.right(componentsUtils
+                    .getResponseFormat(ActionStatus.GROUP_INSTANCE_NOT_FOUND_ON_COMPONENT_INSTANCE, groupInstanceId,
+                        foundComponentInstance.getName()));
             }
         }
         if (actionResult == null) {
@@ -2465,7 +2179,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
     private ComponentInstance findRelatedComponentInstance(Component component, String componentInstanceId) {
         ComponentInstance componentInstance = null;
         if (isNotEmpty(component.getComponentInstances())) {
-            componentInstance = component.getComponentInstances().stream().filter(ci -> ci.getUniqueId().equals(componentInstanceId)).findFirst().orElse(null);
+            componentInstance = component.getComponentInstances().stream().filter(ci -> ci.getUniqueId().equals(componentInstanceId)).findFirst()
+                .orElse(null);
         }
         return componentInstance;
     }
@@ -2479,28 +2194,24 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         return Either.left(user);
     }
 
-    public Either<UiComponentDataTransfer, ResponseFormat> getUiComponentDataTransferByComponentId(String serviceId, List<String> dataParamsToReturn) {
-
+    public Either<UiComponentDataTransfer, ResponseFormat> getUiComponentDataTransferByComponentId(String serviceId,
+                                                                                                   List<String> dataParamsToReturn) {
         ComponentParametersView paramsToReturn = new ComponentParametersView(dataParamsToReturn);
         paramsToReturn.setIgnoreComponentInstancesProperties(false);
         Either<Service, StorageOperationStatus> serviceResultEither = toscaOperationFacade.getToscaElement(serviceId, paramsToReturn);
-
         if (serviceResultEither.isRight()) {
-            if(serviceResultEither.right().value() == StorageOperationStatus.NOT_FOUND) {
+            if (serviceResultEither.right().value() == StorageOperationStatus.NOT_FOUND) {
                 log.debug("#getUiComponentDataTransferByComponentId - Failed to find service with id {} ", serviceId);
                 return Either.right(componentsUtils.getResponseFormat(ActionStatus.SERVICE_NOT_FOUND, serviceId));
             }
-
             log.debug("#getUiComponentDataTransferByComponentId - failed to get service by id {} with filters {}", serviceId, dataParamsToReturn);
-            return Either.right(componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(serviceResultEither.right().value()), ""));
+            return Either.right(
+                componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(serviceResultEither.right().value()), ""));
         }
-
         Service service = serviceResultEither.left().value();
-               if (dataParamsToReturn.contains(ComponentFieldsEnum.INPUTS.getValue())) {
-                       ListUtils.emptyIfNull(service.getInputs())
-                                       .forEach(input -> input.setConstraints(setInputConstraint(input)));
-               }
-
+        if (dataParamsToReturn.contains(ComponentFieldsEnum.INPUTS.getValue())) {
+            ListUtils.emptyIfNull(service.getInputs()).forEach(input -> input.setConstraints(setInputConstraint(input)));
+        }
         UiComponentDataTransfer dataTransfer = uiComponentDataConverter.getUiDataTransferFromServiceByParams(service, dataParamsToReturn);
         return Either.left(dataTransfer);
     }
@@ -2514,4 +2225,62 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic {
         Either<Service, StorageOperationStatus> latestByName = toscaOperationFacade.getLatestByServiceName(serviceName);
         return latestByName.isLeft();
     }
+
+    abstract class ArtifactGenerator<CallVal> implements Callable<Either<CallVal, ResponseFormat>> {
+
+    }
+
+    @Getter
+    class HeatEnvArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> {
+
+        private ArtifactDefinition artifactDefinition;
+        private Service service;
+        private String resourceInstanceName;
+        private User modifier;
+        private String instanceId;
+        private boolean shouldLock;
+        private boolean inTransaction;
+
+        HeatEnvArtifactGenerator(ArtifactDefinition artifactDefinition, Service service, String resourceInstanceName, User modifier,
+                                 boolean shouldLock, boolean inTransaction, String instanceId) {
+            this.artifactDefinition = artifactDefinition;
+            this.service = service;
+            this.resourceInstanceName = resourceInstanceName;
+            this.modifier = modifier;
+            this.shouldLock = shouldLock;
+            this.instanceId = instanceId;
+            this.inTransaction = inTransaction;
+        }
+
+        @Override
+        public Either<ArtifactDefinition, ResponseFormat> call() throws Exception {
+            return artifactsBusinessLogic
+                .forceGenerateHeatEnvArtifact(artifactDefinition, ComponentTypeEnum.RESOURCE_INSTANCE, service, resourceInstanceName, modifier,
+                    shouldLock, inTransaction, instanceId);
+        }
+    }
+
+    class VfModuleArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> {
+
+        boolean shouldLock;
+        boolean inTransaction;
+        private User user;
+        private ComponentInstance componentInstance;
+        private Service service;
+
+        private VfModuleArtifactGenerator(User user, ComponentInstance componentInstance, Service service, boolean shouldLock,
+                                          boolean inTransaction) {
+            super();
+            this.user = user;
+            this.componentInstance = componentInstance;
+            this.service = service;
+            this.shouldLock = shouldLock;
+            this.inTransaction = inTransaction;
+        }
+
+        @Override
+        public Either<ArtifactDefinition, ResponseFormat> call() throws Exception {
+            return generateVfModuleInstanceArtifact(user, componentInstance, service, shouldLock, inTransaction);
+        }
+    }
 }