X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Fbase%2FPfConceptContainer.java;fp=models-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Fbase%2FPfConceptContainer.java;h=5f38a395af2cd9e3e0717dbf6521451b460b37b4;hb=f0ae42bb24bd4ee98f6b7b3acf2e47d96946de1b;hp=a98a7ac54a248878849fbbcd538629cd5ce7c230;hpb=c89f17af3cccff82d3f251e7fe73910ea8e26dbf;p=policy%2Fmodels.git 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 a98a7ac54..5f38a395a 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 @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2022 Bell Canada. 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. @@ -331,30 +332,37 @@ public class PfConceptContainer ex if (conceptKey.isNullVersion()) { return get(conceptKey.getName()); } else { - return new PfConceptGetterImpl<>((NavigableMap) conceptMap).get(conceptKey); + return new PfConceptGetterImpl<>(getNavigableConceptMap()).get(conceptKey); } } @Override public C get(final String conceptKeyName) { - return new PfConceptGetterImpl<>((NavigableMap) conceptMap).get(conceptKeyName); + return new PfConceptGetterImpl<>(getNavigableConceptMap()).get(conceptKeyName); } @Override public C get(final String conceptKeyName, final String conceptKeyVersion) { - return new PfConceptGetterImpl<>((NavigableMap) conceptMap).get(conceptKeyName, - conceptKeyVersion); + return new PfConceptGetterImpl<>(getNavigableConceptMap()).get(conceptKeyName, conceptKeyVersion); } @Override public Set getAll(final String conceptKeyName) { - return new PfConceptGetterImpl<>((NavigableMap) conceptMap).getAll(conceptKeyName); + return new PfConceptGetterImpl<>(getNavigableConceptMap()).getAll(conceptKeyName); } @Override public Set getAll(final String conceptKeyName, final String conceptKeyVersion) { - return new PfConceptGetterImpl<>((NavigableMap) conceptMap).getAll(conceptKeyName, - conceptKeyVersion); + return new PfConceptGetterImpl<>(getNavigableConceptMap()).getAll(conceptKeyName, conceptKeyVersion); + } + + /** + * Get the concept map as a NavigableMap object. + * + * @return NavigableMap conceptMap instance. + */ + private NavigableMap getNavigableConceptMap() { + return new TreeMap<>(conceptMap); } /** @@ -386,4 +394,4 @@ public class PfConceptContainer ex + keyFieldValue + " does not match the value " + conceptField + " in the concept field"); } } -} +} \ No newline at end of file