aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt17
1 files changed, 15 insertions, 2 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt b/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt
index e26247281..b638a03e3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/dal/AsyncInstantiationRepository.kt
@@ -90,12 +90,16 @@ class AsyncInstantiationRepository @Autowired constructor(val dataAccessService:
" and created >= '" + filterDate + "' "
}
- private fun filterInstantiatedServiceByServiceModelId(serviceModelUuid: UUID): String {
+ private fun filterByInstantiateActionStatus(): String{
return filterServicesByNotHiddenAndNotDeleted() +
- " and SERVICE_MODEL_ID = '$serviceModelUuid'" +
" and ACTION = 'INSTANTIATE'"
}
+ private fun filterInstantiatedServiceByServiceModelId(serviceModelUuid: UUID): String {
+ return filterByInstantiateActionStatus() +
+ " and SERVICE_MODEL_ID = '$serviceModelUuid'"
+ }
+
private fun filterServicesByNotHiddenAndNotDeleted(): String {
return " WHERE" +
" hidden = false" +
@@ -157,4 +161,13 @@ class AsyncInstantiationRepository @Autowired constructor(val dataAccessService:
fun listInstantiatedServicesByServiceModelId(serviceModelId: UUID): List<ServiceInfo> =
dataAccessService.getList(ServiceInfo::class.java, filterInstantiatedServiceByServiceModelId(serviceModelId), orderByCreatedDateAndStatus(), null) as List<ServiceInfo>;
+
+ fun getAllTemplatesServiceModelIds(): Set<String> {
+ val allTemplatesInfo =
+ dataAccessService.getList(ServiceInfo::class.java, filterByInstantiateActionStatus(), null, null) as List<ServiceInfo>
+
+ return allTemplatesInfo
+ .map { it.serviceModelId }
+ .toHashSet()
+ }
}