diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java index b0af789f28..f8d487169a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AnnotationBusinessLogic.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,9 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.components.impl; +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.openecomp.sdc.be.components.validation.AnnotationValidator; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.elements.Annotation; @@ -30,29 +36,19 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.apache.commons.collections.CollectionUtils.isNotEmpty; - @Component public class AnnotationBusinessLogic { private final AnnotationTypeOperations annotationTypeOperations; - private final AnnotationValidator annotationValidator; - public AnnotationBusinessLogic(AnnotationTypeOperations annotationTypeOperations, - AnnotationValidator annotationValidator){ + public AnnotationBusinessLogic(AnnotationTypeOperations annotationTypeOperations, AnnotationValidator annotationValidator) { this.annotationTypeOperations = annotationTypeOperations; this.annotationValidator = annotationValidator; } public void validateAndMergeAnnotationsAndAssignToInput(Map<String, InputDefinition> inputs) { - if (!inputs.isEmpty()){ + if (!inputs.isEmpty()) { for (InputDefinition input : inputs.values()) { List<Annotation> inputAnnotationList = input.getAnnotations(); if (isNotEmpty(inputAnnotationList)) { @@ -72,11 +68,13 @@ public class AnnotationBusinessLogic { private void validateMergeAndSetAnnoProps(Annotation annotation, AnnotationTypeDefinition dbAnnotationTypeDefinition) { annotationValidator.validateAnnotationsProperties(annotation, dbAnnotationTypeDefinition); - List<PropertyDataDefinition> mergedPropertiesList = mergePropsOfAnnoDataTypeWithParsedAnnoProps(annotation.getProperties(), dbAnnotationTypeDefinition.getProperties()); + List<PropertyDataDefinition> mergedPropertiesList = mergePropsOfAnnoDataTypeWithParsedAnnoProps(annotation.getProperties(), + dbAnnotationTypeDefinition.getProperties()); annotation.setProperties(mergedPropertiesList); } - private List<PropertyDataDefinition> mergePropsOfAnnoDataTypeWithParsedAnnoProps(List<PropertyDataDefinition> annoProperties, List<PropertyDefinition> typePropertiesList) { + private List<PropertyDataDefinition> mergePropsOfAnnoDataTypeWithParsedAnnoProps(List<PropertyDataDefinition> annoProperties, + List<PropertyDefinition> typePropertiesList) { Set<PropertyDataDefinition> mergedPropertiesSet = new HashSet<>(typePropertiesList); Map<String, PropertyDefinition> typePropsMap = MapUtil.toMap(typePropertiesList, PropertyDefinition::getName); for (PropertyDataDefinition propertyDataDefinitionObject : annoProperties) { @@ -88,5 +86,4 @@ public class AnnotationBusinessLogic { } return new ArrayList<>(mergedPropertiesSet); } - } |