diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java index 9c140b36c7..00e49dcbc0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java @@ -1,32 +1,39 @@ package org.openecomp.sdc.be.components.merge; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; +import fj.data.Either; import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.springframework.stereotype.Component; -import fj.data.Either; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; -@Component -public class GlobalInputsFilteringBusinessLogic extends BaseBusinessLogic { +@org.springframework.stereotype.Component +public class GlobalInputsFilteringBusinessLogic { - @javax.annotation.Resource private GenericTypeBusinessLogic genericTypeBusinessLogic; + private ToscaOperationFacade toscaOperationFacade; + private ComponentsUtils componentsUtils; + + public GlobalInputsFilteringBusinessLogic(GenericTypeBusinessLogic genericTypeBusinessLogic, ToscaOperationFacade toscaOperationFacade, ComponentsUtils componentsUtils) { + this.genericTypeBusinessLogic = genericTypeBusinessLogic; + this.toscaOperationFacade = toscaOperationFacade; + this.componentsUtils = componentsUtils; + } - Either<List<InputDefinition>, ActionStatus> filterGlobalInputs(Resource newResource) { + public Either<List<InputDefinition>, ActionStatus> filterGlobalInputs(Component newResource) { Either<Resource, StorageOperationStatus> genericComp = toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(newResource.fetchGenericTypeToscaNameFromConfig()); return genericComp.bimap(genericResource -> findCommonInputs(genericResource, newResource), storageOperationStatus -> componentsUtils.convertFromStorageResponse(storageOperationStatus)); } - private List<InputDefinition> findCommonInputs(Resource genericResource, Resource resource) { + private List<InputDefinition> findCommonInputs(Resource genericResource, Component resource) { List<InputDefinition> resourceInputs = resource.getInputs(); List<InputDefinition> genericInputs = genericTypeBusinessLogic.generateInputsFromGenericTypeProperties(genericResource); Set<String> genericInputsNames = genericInputs.stream().map(InputDefinition::getName).collect(Collectors.toSet()); |