summaryrefslogtreecommitdiffstats
path: root/models-base/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-06-14 07:38:26 +0000
committerliamfallon <liam.fallon@est.tech>2019-06-14 07:38:26 +0000
commit10c11e142feb1d040612fed695aaf76d007294da (patch)
tree58d4b61c8ceed0ee660b65b9331bbb3c4b67cbc2 /models-base/src/main
parent2d69f0ed6b0a59bacd4e7986c23281e4a9006c93 (diff)
Allow multiple versions of entities to be returned
Fix .gitreviw file to point at "master" rather than "dublin" Allow return of multiple versions of policy types and data types in TOSCA service templates and multiple policies in TOSCA topology templates. Because the return type is a list of singleton maps, utility methods were added to return flat maps of poliicy types, data types, and policies keyed by a compound ToscaEntityKey name/version key. Issue-ID: POLICY-1807 Change-Id: I355038aaca26f41064d0e3cb3b45b1de2294cf5f Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-base/src/main')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 2576aab0a..99b5f9710 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -126,16 +126,22 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
@Override
public List<Map<String, A>> toAuthorative() {
- Map<String, A> toscaPolicyMap = new LinkedHashMap<>();
+ // The returned list is a list of map singletons with one map for each map
+ // entry in the concept container
+ List<Map<String, A>> toscaPolicyMapList = new ArrayList<>();
for (Entry<PfConceptKey, C> conceptEntry : getConceptMap().entrySet()) {
+ // Create a map to hold this entry
+ Map<String, A> toscaPolicyMap = new LinkedHashMap<>(1);
+
+ // Add the concept container entry to the singleton map
@SuppressWarnings("unchecked")
PfAuthorative<A> authoritiveImpl = (PfAuthorative<A>) conceptEntry.getValue();
toscaPolicyMap.put(conceptEntry.getKey().getName(), authoritiveImpl.toAuthorative());
- }
- List<Map<String, A>> toscaPolicyMapList = new ArrayList<>();
- toscaPolicyMapList.add(toscaPolicyMap);
+ // Add the map to the returned list
+ toscaPolicyMapList.add(toscaPolicyMap);
+ }
return toscaPolicyMapList;
}