diff options
Diffstat (limited to 'auth/auth-cass/src')
20 files changed, 62 insertions, 70 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java index 89fb12fe..b5a950d4 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java @@ -71,8 +71,8 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> { protected Class<DATA> dataClass; private final String name; // private static Slot sessionSlot; // not used since 2015 - private static final ArrayList<AbsCassDAO<? extends TransStore,?>.PSInfo> psinfos = new ArrayList<AbsCassDAO<? extends TransStore,?>.PSInfo>(); - private static final List<Object> EMPTY = new ArrayList<Object>(0); + private static final ArrayList<AbsCassDAO<? extends TransStore,?>.PSInfo> psinfos = new ArrayList<>(); + private static final List<Object> EMPTY = new ArrayList<>(0); private static final Deque<ResetRequest> resetDeque = new ConcurrentLinkedDeque<ResetRequest>(); private static boolean resetTrigger = false; private static long nextAvailableReset = 0; @@ -288,7 +288,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> { /// TEST CODE for Exception // boolean force = true; // if(force) { -// Map<InetSocketAddress, Throwable> misa = new HashMap<InetSocketAddress,Throwable>(); +// Map<InetSocketAddress, Throwable> misa = new HashMap<>(); // //misa.put(new InetSocketAddress(444),new Exception("no host was tried")); // misa.put(new InetSocketAddress(444),new Exception("Connection has been closed")); // throw new com.datastax.driver.core.exceptions.NoHostAvailableException(misa); @@ -338,7 +338,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> { return Result.ok((List<DATA>)EMPTY); // Result sets now .emptyList(true); } else { DATA d; - List<DATA> data = indata==null?new ArrayList<DATA>(rows.size()):indata; + List<DATA> data = indata==null?new ArrayList<>(rows.size()):indata; for(Row row : rows) { try { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java index 017f8780..f468dba4 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java @@ -64,7 +64,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend public void add(DATA data) { String key = keyFromObjs(dao.keyFrom(data)); - List<DATA> list = new ArrayList<DATA>(); + List<DATA> list = new ArrayList<>(); list.add(data); super.add(key,list); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java index e70bffb7..c213a04b 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java @@ -44,7 +44,7 @@ public class CassAccess { public static final String CASSANDRA_CLUSTERS_USER_NAME = "cassandra.clusters.user"; public static final String CASSANDRA_CLUSTERS_PASSWORD = "cassandra.clusters.password"; public static final String CASSANDRA_RESET_EXCEPTIONS = "cassandra.reset.exceptions"; - private static final List<Resettable> resetExceptions = new ArrayList<Resettable>(); + private static final List<Resettable> resetExceptions = new ArrayList<>(); public static final String ERR_ACCESS_MSG = "Accessing Backend"; private static Builder cb = null; @@ -181,7 +181,7 @@ public class CassAccess { } } if(split.length>1) { - messages=new ArrayList<String>(); + messages=new ArrayList<>(); for(int i=1;i<split.length;++i) { String str = split[i]; int start = str.startsWith("\"")?1:0; diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java index 485eabc6..00423161 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java @@ -143,7 +143,7 @@ public abstract class Loader<DATA> { if(l<0) { return null; } - Set<String> set = new HashSet<String>(l); + Set<String> set = new HashSet<>(l); for(int i=0;i<l;++i) { set.add(readString(is,buff)); } @@ -155,7 +155,7 @@ public abstract class Loader<DATA> { if(l<0) { return null; } - List<String> list = new ArrayList<String>(l); + List<String> list = new ArrayList<>(l); for(int i=0;i<l;++i) { list.add(Loader.readString(is,buff)); } @@ -187,7 +187,7 @@ public abstract class Loader<DATA> { if(l<0) { return null; } - Map<String,String> map = new HashMap<String,String>(l); + Map<String,String> map = new HashMap<>(l); for(int i=0;i<l;++i) { String key = readString(is,buff); map.put(key,readString(is,buff)); diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java index dce2beaa..100c81d5 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java @@ -91,7 +91,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol if(user.equals(trans.user())) { Result<List<Data>> rrbu = readByUser(trans, user); if(rrbu.isOK()) { - List<Data> ld = new ArrayList<Data>(1); + List<Data> ld = new ArrayList<>(1); for(Data d : rrbu.value) { if(d.role.equals(role)) { ld.add(d); diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java index 391b55b4..a6fbecaf 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java @@ -82,18 +82,18 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> { // // Getters public Set<String> type(boolean mutable) { if (type == null) { - type = new HashSet<String>(); + type = new HashSet<>(); } else if (mutable && !(type instanceof HashSet)) { - type = new HashSet<String>(type); + type = new HashSet<>(type); } return type; } public Set<String> sans(boolean mutable) { if (sans == null) { - sans = new HashSet<String>(); + sans = new HashSet<>(); } else if (mutable && !(sans instanceof HashSet)) { - sans = new HashSet<String>(sans); + sans = new HashSet<>(sans); } return sans; } @@ -199,7 +199,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> { data.mechid = readString(is,buff); data.machine = readString(is,buff); int size = is.readInt(); - data.type = new HashSet<String>(size); + data.type = new HashSet<>(size); for(int i=0;i<size;++i) { data.type.add(readString(is,buff)); } @@ -213,7 +213,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> { data.expires = l<0?null:new Date(l); data.renewDays = is.readInt(); size = is.readInt(); - data.sans = new HashSet<String>(size); + data.sans = new HashSet<>(size); for(int i=0;i<size;++i) { data.sans.add(readString(is,buff)); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java index 66ab7344..6d9900b9 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java @@ -63,7 +63,7 @@ import com.datastax.driver.core.exceptions.DriverException; public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> implements CIDAO<AuthzTrans> { private static final String TABLE = "cache"; - public static final Map<String,Date[]> info = new ConcurrentHashMap<String,Date[]>(); + public static final Map<String,Date[]> info = new ConcurrentHashMap<>(); private static CacheUpdate cacheUpdate; @@ -217,7 +217,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl } public void add(int[] ints) { if(set==null) { - set = new HashSet<Integer>(); + set = new HashSet<>(); for(int i=0;i<raw.length;++i) { set.add(raw[i]); @@ -275,7 +275,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl start = System.nanoTime(); trans = env.newTransNoAvg(); cc = new CacheClear(trans); - gather = new HashMap<String,IntHolder>(); + gather = new HashMap<>(); } IntHolder prev = gather.get(data.table); if(prev==null) { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java index 0cfc1dc5..13af8795 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java @@ -82,13 +82,6 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { public String target; public String subject; public String memo; -// Map<String, String> detail = null; -// public Map<String, String> detail() { -// if(detail == null) { -// detail = new HashMap<String, String>(); -// } -// return detail; -// } public ByteBuffer reconstruct; } @@ -106,7 +99,6 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { data.target = row.getString(4); data.subject = row.getString(5); data.memo = row.getString(6); -// data.detail = row.getMap(6, String.class, String.class); data.reconstruct = row.getBytes(7); return data; } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java index bdf2748c..4778331b 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java @@ -81,9 +81,9 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> { // Getters public Set<String> subprotocol(boolean mutable) { if (subprotocol == null) { - subprotocol = new HashSet<String>(); + subprotocol = new HashSet<>(); } else if (mutable && !(subprotocol instanceof HashSet)) { - subprotocol = new HashSet<String>(subprotocol); + subprotocol = new HashSet<>(subprotocol); } return subprotocol; } @@ -191,7 +191,7 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> { data.protocol = readString(is,buff); int size = is.readInt(); - data.subprotocol = new HashSet<String>(size); + data.subprotocol = new HashSet<>(size); for(int i=0;i<size;++i) { data.subprotocol.add(readString(is,buff)); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java index 4b1ff149..11ee4bcb 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java @@ -56,7 +56,7 @@ public class Namespace implements Bytification { type = ndd.type; parent = ndd.parent; if(ndd.attrib!=null && !ndd.attrib.isEmpty()) { - attrib = new ArrayList<Pair<String,String>>(); + attrib = new ArrayList<>(); for( Entry<String, String> entry : ndd.attrib.entrySet()) { attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue())); } @@ -71,7 +71,7 @@ public class Namespace implements Bytification { type = ndd.type; parent = ndd.parent; if(ndd.attrib!=null && !ndd.attrib.isEmpty()) { - attrib = new ArrayList<Pair<String,String>>(); + attrib = new ArrayList<>(); for( Entry<String, String> entry : ndd.attrib.entrySet()) { attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue())); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java index 567246d8..07890544 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java @@ -110,9 +110,9 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> { // // Getters public Map<String,String> attrib(boolean mutable) { if (attrib == null) { - attrib = new HashMap<String,String>(); + attrib = new HashMap<>(); } else if (mutable && !(attrib instanceof HashMap)) { - attrib = new HashMap<String,String>(attrib); + attrib = new HashMap<>(attrib); } return attrib; } @@ -255,7 +255,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> { //// TEST CODE for Exception // boolean force = true; // if(force) { -// throw new com.datastax.driver.core.exceptions.NoHostAvailableException(new HashMap<InetSocketAddress,Throwable>()); +// throw new com.datastax.driver.core.exceptions.NoHostAvailableException(new HashMap<>()); //// throw new com.datastax.driver.core.exceptions.AuthenticationException(new InetSocketAddress(9999),"Sample Message"); // } ////END TEST CODE @@ -376,7 +376,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> { } public Result<Map<String,String>> readAttribByNS(AuthzTrans trans, String ns) { - Map<String,String> map = new HashMap<String,String>(); + Map<String,String> map = new HashMap<>(); TimeTaken tt = trans.start("readAttribByNS " + ns, Env.REMOTE); try { ResultSet rs = getSession(trans).execute("SELECT key,value FROM " @@ -399,7 +399,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> { } public Result<Set<String>> readNsByAttrib(AuthzTrans trans, String key) { - Set<String> set = new HashSet<String>(); + Set<String> set = new HashSet<>(); TimeTaken tt = trans.start("readNsBykey " + key, Env.REMOTE); try { ResultSet rs = getSession(trans).execute("SELECT ns FROM " diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java index e1375b8a..4fe3aaab 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java @@ -80,9 +80,9 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> { public Set<String> scopes(boolean mutable) { if (scopes == null) { - scopes = new HashSet<String>(); + scopes = new HashSet<>(); } else if (mutable && !(scopes instanceof HashSet)) { - scopes = new HashSet<String>(scopes); + scopes = new HashSet<>(scopes); } return scopes; } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java index 860b7ea5..0ecdd98d 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java @@ -216,9 +216,9 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> { // Getters public Set<String> roles(boolean mutable) { if (roles == null) { - roles = new HashSet<String>(); + roles = new HashSet<>(); } else if (mutable && !(roles instanceof HashSet)) { - roles = new HashSet<String>(roles); + roles = new HashSet<>(roles); } return roles; } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java index da7d7a2d..974f73fe 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java @@ -90,9 +90,9 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> { // Getters public Set<String> perms(boolean mutable) { if (perms == null) { - perms = new HashSet<String>(); + perms = new HashSet<>(); } else if (mutable && !(perms instanceof HashSet)) { - perms = new HashSet<String>(perms); + perms = new HashSet<>(perms); } return perms; } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java index b7b17c90..24f9f887 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java @@ -117,7 +117,7 @@ public class Function { public static final String FOP_PERM = "perm"; public static final String FOP_ROLE = "role"; public static final String FOP_USER_ROLE = "user_role"; - private static final List<Identity> NO_ADDL_APPROVE = new ArrayList<Identity>(); + private static final List<Identity> NO_ADDL_APPROVE = new ArrayList<>(); private static final String ROOT_NS = Define.ROOT_NS(); // First Action should ALWAYS be "write", see "CreateRole" public final Question q; @@ -134,7 +134,7 @@ public class Function { if (result.notOK()) { if (sb == null) { sb = new StringBuilder(); - ao = new ArrayList<String>(); + ao = new ArrayList<>(); } sb.append(result.details); sb.append('\n'); @@ -333,7 +333,7 @@ public class Function { if (rrdc.isOKhasData()) { for (RoleDAO.Data rdd : rrdc.value) { // Remove old Role from Perms, save them off - List<PermDAO.Data> lpdd = new ArrayList<PermDAO.Data>(); + List<PermDAO.Data> lpdd = new ArrayList<>(); for(String p : rdd.perms(false)) { Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p); if(rpdd.isOKhasData()) { @@ -387,7 +387,7 @@ public class Function { if (rpdc.isOKhasData()) { for (PermDAO.Data pdd : rpdc.value) { // Remove old Perm from Roles, save them off - List<RoleDAO.Data> lrdd = new ArrayList<RoleDAO.Data>(); + List<RoleDAO.Data> lrdd = new ArrayList<>(); for(String rl : pdd.roles(false)) { Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl); @@ -447,11 +447,11 @@ public class Function { pd.action = Question.ASTERIX; pd.description = "AAF Namespace Write Access"; - rd.perms = new HashSet<String>(); + rd.perms = new HashSet<>(); rd.perms.add(pd.encode()); eb.log(q.roleDAO.create(trans, rd)); - pd.roles = new HashSet<String>(); + pd.roles = new HashSet<>(); pd.roles.add(rd.encode()); eb.log(q.permDAO.create(trans, pd)); } @@ -469,11 +469,11 @@ public class Function { pd.action = Question.READ; pd.description = "AAF Namespace Read Access"; - rd.perms = new HashSet<String>(); + rd.perms = new HashSet<>(); rd.perms.add(pd.encode()); eb.log(q.roleDAO.create(trans, rd)); - pd.roles = new HashSet<String>(); + pd.roles = new HashSet<>(); pd.roles.add(rd.encode()); eb.log(q.permDAO.create(trans, pd)); } @@ -825,7 +825,7 @@ public class Function { continue; } // Remove old Perm from Roles, save them off - List<RoleDAO.Data> lrdd = new ArrayList<RoleDAO.Data>(); + List<RoleDAO.Data> lrdd = new ArrayList<>(); for(String rl : pdd.roles(false)) { Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl); @@ -891,7 +891,7 @@ public class Function { continue; } // Remove old Role from Perms, save them off - List<PermDAO.Data> lpdd = new ArrayList<PermDAO.Data>(); + List<PermDAO.Data> lpdd = new ArrayList<>(); for(String p : rdd.perms(false)) { Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p); if(rpdd.isOKhasData()) { @@ -1439,7 +1439,7 @@ public class Function { } Date now = new Date(); List<UserRoleDAO.Data> list = rurdd.value; - List<String> rv = new ArrayList<String>(list.size()); // presize + List<String> rv = new ArrayList<>(list.size()); // presize for (UserRoleDAO.Data urdd : rurdd.value) { if (includeExpired || urdd.expires.after(now)) { rv.add(urdd.user); @@ -1471,7 +1471,7 @@ public class Function { Organization org = trans.org(); // For Reapproval, only check Owners.. Do Supervisors, etc, separately List<Identity> approvers = op.equals(FUTURE_OP.A)?NO_ADDL_APPROVE:org.getApprovers(trans, user); - List<Identity> owners = new ArrayList<Identity>(); + List<Identity> owners = new ArrayList<>(); if (nsd != null) { Result<List<UserRoleDAO.Data>> rrbr = q.userRoleDAO .readByRole(trans, nsd.name + Question.DOT_OWNER); diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java index 615d6b36..1544aab8 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java @@ -59,7 +59,7 @@ class PermLookup { PermLookup lp=null; Map<String, PermLookup> permMap = trans.get(Question.PERMS, null); if (permMap == null) { - trans.put(Question.PERMS, permMap = new HashMap<String, PermLookup>()); + trans.put(Question.PERMS, permMap = new HashMap<>()); } else { lp = permMap.get(user); } @@ -78,7 +78,7 @@ class PermLookup { if(userRoles==null) { userRoles = q.userRoleDAO.readByUser(trans,user); if(userRoles.isOKhasData()) { - List<UserRoleDAO.Data> lurdd = new ArrayList<UserRoleDAO.Data>(); + List<UserRoleDAO.Data> lurdd = new ArrayList<>(); Date now = new Date(); for(UserRoleDAO.Data urdd : userRoles.value) { if(urdd.expires.after(now)) { // Remove Expired @@ -104,7 +104,7 @@ class PermLookup { if(roles==null) { Result<List<UserRoleDAO.Data>> rur = getUserRoles(); if(rur.isOK()) { - List<RoleDAO.Data> lrdd = new ArrayList<RoleDAO.Data>(); + List<RoleDAO.Data> lrdd = new ArrayList<>(); for (UserRoleDAO.Data urdata : rur.value) { // Gather all permissions from all Roles if(urdata.ns==null || urdata.rname==null) { @@ -130,7 +130,7 @@ class PermLookup { if(permNames==null) { Result<List<RoleDAO.Data>> rlrd = getRoles(); if (rlrd.isOK()) { - Set<String> pns = new TreeSet<String>(); + Set<String> pns = new TreeSet<>(); for (RoleDAO.Data rdata : rlrd.value) { pns.addAll(rdata.perms(false)); } @@ -149,7 +149,7 @@ class PermLookup { // Jonathan 8/12/2013 Result<Set<String>> rss = getPermNames(); if(rss.isOK()) { - List<PermDAO.Data> lpdd = new ArrayList<PermDAO.Data>(); + List<PermDAO.Data> lpdd = new ArrayList<>(); for (String perm : rss.value) { if(lookup) { Result<String[]> ap = PermDAO.Data.decodeToArray(trans, q, perm); diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java index 95041ea3..53548423 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java @@ -235,7 +235,7 @@ public class Question { nss = null; } else { // Setup a TreeSet to check on Namespaces to - nss = new TreeSet<String>(); + nss = new TreeSet<>(); PermLookup fUser = PermLookup.get(trans, this, forUser); Result<Set<String>> forUpn = fUser.getPermNames(); if(forUpn.notOK()) { @@ -252,7 +252,7 @@ public class Question { } } - List<PermDAO.Data> rlpUser = new ArrayList<PermDAO.Data>(); + List<PermDAO.Data> rlpUser = new ArrayList<>(); Result<PermDAO.Data> rpdd; PermDAO.Data pdd; for(String pn : plPermNames.value) { @@ -298,7 +298,7 @@ public class Question { return Result.err(rlrd); } // Using Set to avoid duplicates - Set<String> permNames = new HashSet<String>(); + Set<String> permNames = new HashSet<>(); if (rlrd.isOKhasData()) { for (RoleDAO.Data drr : rlrd.value) { permNames.addAll(drr.perms(false)); @@ -307,7 +307,7 @@ public class Question { // Note: It should be ok for a Valid user to have no permissions - // Jonathan 8/12/2013 - List<PermDAO.Data> perms = new ArrayList<PermDAO.Data>(); + List<PermDAO.Data> perms = new ArrayList<>(); for (String perm : permNames) { Result<PermDAO.Data> pr = PermDAO.Data.decode(trans, this, perm); if (pr.notOK()) { @@ -744,7 +744,7 @@ public class Question { // Bug noticed 6/22. Sorting on the result can cause Concurrency Issues. List<CredDAO.Data> cddl; if(result.value.size() > 1) { - cddl = new ArrayList<CredDAO.Data>(result.value.size()); + cddl = new ArrayList<>(result.value.size()); for(CredDAO.Data old : result.value) { if(old.type==CredDAO.BASIC_AUTH || old.type==CredDAO.BASIC_AUTH_SHA256) { cddl.add(old); @@ -1039,7 +1039,7 @@ public class Question { public static synchronized boolean specialLogOn(AuthzTrans trans, String id) { if (specialLog == null) { - specialLog = new HashSet<String>(); + specialLog = new HashSet<>(); } boolean rc = specialLog.add(id); if(rc) { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java index b854deff..586ae4df 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java @@ -84,7 +84,7 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> { AuthzTrans trans = env.newTransNoAvg(); Result<List<Data>> rl = ldao.readByName(trans, name); if(rl.isOK()) { - LinkedList<EP> epl = new LinkedList<EP>(); + LinkedList<EP> epl = new LinkedList<>(); for(Data d : rl.value) { // if(myhostname!=null && d.port==myport && d.hostname.equals(myhostname)) { // continue; diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java index e942f3f1..31a93723 100644 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java +++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java @@ -75,7 +75,7 @@ public class JU_Cached { @Test public void testInvalidate(){ Cached<Trans, DataStub> cached = new Cached<Trans, DataStub>(ciDaoMock, name, 5, 30000L); - cached.add("test", new ArrayList<DataStub>()); + cached.add("test", new ArrayList<>()); cached.invalidate("test"); cached.invalidate("test1"); } diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java index c73371e9..525450a6 100644 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java +++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java @@ -51,7 +51,7 @@ public class JU_CassAccess { public static final String CASSANDRA_RESET_EXCEPTIONS = "cassandra.reset.exceptions"; public static final String LATITUDE = "LATITUDE"; public static final String LONGITUDE = "LONGITUDE"; - //private static final List<Resettable> resetExceptions = new ArrayList<Resettable>(); + //private static final List<Resettable> resetExceptions = new ArrayList<>(); public static final String ERR_ACCESS_MSG = "Accessing Backend"; private static Builder cb = null; @Mock |