aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-01-01 14:23:00 +0200
committerIttay Stern <ittay.stern@att.com>2020-01-01 15:30:33 +0000
commit0dbffafcc772e363fa6318c982a4b298ddab88cb (patch)
tree55f089ebebc0fe4bd5c6f5caee0da3a65248904d /vid-app-common/src/main/java
parentd0bbdebeede7de26bccbb9f79809a460da89e46d (diff)
Add DB query for all model-service-ids which have a template
Issue-ID: VID-739 Change-Id: Ib401f1fd312afb9652793854d49c8c7e5e115149 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/java')
-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()
+ }
}