diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2020-01-08 09:12:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-01-08 09:12:29 +0000 |
commit | f00a29514c439df423501efc5eff8610c09d8601 (patch) | |
tree | 37c718972904d4507881e803d69f70103d284221 /vid-app-common/src/main/java/org | |
parent | 16ef9772c84d9110b451a1a28f0fe76e40f8bd53 (diff) | |
parent | 8e2ec29dece28c4b17b20f04b3c8377242996572 (diff) |
Merge "templates button - rename from hasTemplates to isInstantiationTemplateExists on the FE side"
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java b/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java index c033fbd59..17520eef4 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import javax.inject.Inject; +import org.jetbrains.annotations.NotNull; import org.onap.vid.asdc.beans.Service; import org.onap.vid.dal.AsyncInstantiationRepository; import org.onap.vid.model.ModelUtil; @@ -76,7 +77,8 @@ public class InstantiationTemplatesService { public Collection<Service> setOnEachServiceIsTemplateExists(Collection<Service> services){ if (!featureManager.isActive(Features.FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE)){ - return services; + return unsetTemplateExistsToAllServices(services); + } Set<String> serviceModelIdsFromDB = asyncInstantiationRepository.getAllTemplatesServiceModelIds(); @@ -84,8 +86,13 @@ public class InstantiationTemplatesService { return services.stream().map(it -> setTemplateExistForService(it, serviceModelIdsFromDB)).collect(toList()); } - protected Service setTemplateExistForService(Service service, Set<String> serviceModelIdsFromDb) { + @NotNull + protected Collection<Service> unsetTemplateExistsToAllServices(Collection<Service> services) { + services.forEach(it -> it.setIsInstantiationTemplateExists(false)); + return services; + } + protected Service setTemplateExistForService(Service service, Set<String> serviceModelIdsFromDb) { service.setIsInstantiationTemplateExists(serviceModelIdsFromDb.contains(service.getUuid())); return service; } |