aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-15 16:50:51 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-15 16:50:51 +0000
commit510092ecd2b01d94066040e69e5b1ad52dc31c92 (patch)
tree75be8887dae33af696e190d20311c2c56a147eab /models-tosca
parent98508d7f797c8a94b5b4f03941f39be96db03166 (diff)
parentfd3c23fd777f49603d370b88d0fb55405d92ce0a (diff)
Merge "Use keys to speed DB queries"
Diffstat (limited to 'models-tosca')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
index 46f920cf4..5f8729e08 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -200,7 +201,10 @@ public class AuthorativeToscaProvider {
public ToscaServiceTemplate getFilteredPolicies(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter)
throws PfModelException {
- ToscaServiceTemplate serviceTemplate = new SimpleToscaProvider().getPolicies(dao, null, null).toAuthorative();
+ String version = ToscaPolicyFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion();
+
+ ToscaServiceTemplate serviceTemplate =
+ new SimpleToscaProvider().getPolicies(dao, filter.getName(), version).toAuthorative();
List<ToscaPolicy> filteredPolicies = asConceptList(serviceTemplate.getToscaTopologyTemplate().getPolicies());
filteredPolicies = filter.filter(filteredPolicies);
@@ -221,7 +225,8 @@ public class AuthorativeToscaProvider {
public List<ToscaPolicy> getFilteredPolicyList(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter)
throws PfModelException {
- return filter.filter(getPolicyList(dao, null, null));
+ String version = ToscaPolicyFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion();
+ return filter.filter(getPolicyList(dao, filter.getName(), version));
}
/**