From 2fac1e3e6b3dabb89e960b71e6a3f5bc1b8d9f00 Mon Sep 17 00:00:00 2001 From: Pawel Date: Tue, 22 May 2018 08:20:32 -0400 Subject: fixes in NsAttrib Change-Id: If01b8a890bd376a6dfef4da6bd5de23af3d083f0 Issue-ID: AAF-314 Signed-off-by: Pawel --- .../java/org/onap/aaf/auth/helpers/NsAttrib.java | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java index bb76c34c..eafbe909 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java @@ -23,6 +23,7 @@ package org.onap.aaf.auth.helpers; import java.util.ArrayList; import java.util.List; +import java.util.SortedMap; import java.util.TreeMap; import org.onap.aaf.misc.env.Env; @@ -36,11 +37,24 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class NsAttrib { - public static final List data = new ArrayList(); - public static final TreeMap> byKey = new TreeMap>(); - public static final TreeMap> byNS = new TreeMap>(); + public static final List data = new ArrayList<>(); + public static final SortedMap> byKey = new TreeMap<>(); + public static final SortedMap> byNS = new TreeMap<>(); - public final String ns,key,value; + public final String ns; + public final String key; + public final String value; + public static Creator v2_0_11 = new Creator() { + @Override + public NsAttrib create(Row row) { + return new NsAttrib(row.getString(0), row.getString(1), row.getString(2)); + } + + @Override + public String select() { + return "select ns,key,value from authz.ns_attrib"; + } + }; public NsAttrib(String ns, String key, String value) { this.ns = ns; @@ -69,14 +83,14 @@ public class NsAttrib { List lna = byKey.get(ur.key); if(lna==null) { - lna = new ArrayList(); + lna = new ArrayList<>(); byKey.put(ur.key, lna); } lna.add(ur); lna = byNS.get(ur.ns); if(lna==null) { - lna = new ArrayList(); + lna = new ArrayList<>(); byNS.put(ur.ns, lna); } lna.add(ur); @@ -87,19 +101,6 @@ public class NsAttrib { } } - public static Creator v2_0_11 = new Creator() { - @Override - public NsAttrib create(Row row) { - return new NsAttrib(row.getString(0), row.getString(1), row.getString(2)); - } - - @Override - public String select() { - return "select ns,key,value from authz.ns_attrib"; - } - }; - - public String toString() { return '"' + ns + "\",\"" + key + "\",\"" + value +'"'; } -- cgit 1.2.3-korg