From f85f0889b3b0e5e9694afab4dd01a4a97a155188 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 3 Jul 2018 07:51:17 -0500 Subject: Collection syntax change because of Sonar Issue-ID: AAF-386 Change-Id: I8ba8d8561d03e680ddc90a81b8db0339814c65fa Signed-off-by: Instrumental --- .../src/main/java/org/onap/aaf/auth/helpers/Approval.java | 6 +++--- .../src/main/java/org/onap/aaf/auth/helpers/Approver.java | 2 +- .../src/main/java/org/onap/aaf/auth/helpers/CacheChange.java | 2 +- .../src/main/java/org/onap/aaf/auth/helpers/Cred.java | 10 +++++----- .../src/main/java/org/onap/aaf/auth/helpers/MiscID.java | 2 +- .../src/main/java/org/onap/aaf/auth/helpers/MonthData.java | 5 ++--- .../src/main/java/org/onap/aaf/auth/helpers/NS.java | 2 +- .../main/java/org/onap/aaf/auth/helpers/Notification.java | 4 ++-- .../src/main/java/org/onap/aaf/auth/helpers/Perm.java | 6 +++--- .../src/main/java/org/onap/aaf/auth/helpers/Role.java | 10 +++++----- .../src/main/java/org/onap/aaf/auth/helpers/UserRole.java | 12 ++++++------ .../main/java/org/onap/aaf/auth/reports/ExpiringNext.java | 2 +- .../src/main/java/org/onap/aaf/auth/update/ExpiringP2.java | 2 +- .../main/java/org/onap/aaf/auth/update/NotifyApprovals.java | 2 +- .../java/org/onap/aaf/auth/update/NotifyCredExpiring.java | 8 ++++---- 15 files changed, 37 insertions(+), 38 deletions(-) (limited to 'auth/auth-batch/src') diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java index 7963b022..58aa206e 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java @@ -114,7 +114,7 @@ public class Approval implements CacheChange.Data { if(person!=null) { ln = byApprover.get(person); if(ln==null) { - ln = new ArrayList(); + ln = new ArrayList<>(); byApprover.put(app.getApprover(), ln); } ln.add(app); @@ -125,7 +125,7 @@ public class Approval implements CacheChange.Data { if(person!=null) { ln = byUser.get(person); if(ln==null) { - ln = new ArrayList(); + ln = new ArrayList<>(); byUser.put(app.getUser(), ln); } ln.add(app); @@ -134,7 +134,7 @@ public class Approval implements CacheChange.Data { if(ticket!=null) { ln = byTicket.get(ticket); if(ln==null) { - ln = new ArrayList(); + ln = new ArrayList<>(); byTicket.put(app.getTicket(), ln); } ln.add(app); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java index 6043e436..127daac5 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java @@ -35,7 +35,7 @@ public class Approver { public Approver(String approver, Organization org) { this.name = approver; this.org = org; - userRequests = new HashMap(); + userRequests = new HashMap<>(); } public void addRequest(String user) { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java index 02f34d28..0c82184b 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java @@ -28,7 +28,7 @@ public class CacheChange { private List removed; public CacheChange() { - removed = new ArrayList(); + removed = new ArrayList<>(); } interface Data { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java index 1131aca7..56fbbbae 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java @@ -43,8 +43,8 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class Cred { - public static final TreeMap data = new TreeMap(); - public static final TreeMap> byNS = new TreeMap>(); + public static final TreeMap data = new TreeMap<>(); + public static final TreeMap> byNS = new TreeMap<>(); public final String id; public final List instances; @@ -52,7 +52,7 @@ public class Cred { public Cred(String id) { this.id = id; - instances = new ArrayList(); + instances = new ArrayList<>(); ns=Question.domain2ns(id); } @@ -93,7 +93,7 @@ public class Cred { public Set types() { - Set types = new HashSet(); + Set types = new HashSet<>(); for(Instance i : instances) { types.add(i.type); } @@ -155,7 +155,7 @@ public class Cred { List lscd = byNS.get(cred.ns); if(lscd==null) { - byNS.put(cred.ns, (lscd=new ArrayList())); + byNS.put(cred.ns, (lscd=new ArrayList<>())); } boolean found = false; for(Cred c : lscd) { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java index 1438ffdb..d92a448a 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java @@ -36,7 +36,7 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class MiscID { - public static final TreeMap data = new TreeMap(); + public static final TreeMap data = new TreeMap<>(); /* Sample Record aad890|mj9030|20040902|20120207 diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java index 13a4c923..d633770e 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java @@ -36,8 +36,7 @@ import java.util.Set; import java.util.TreeMap; public class MonthData { - public final Map> data = - new TreeMap>(); + public final Map> data = new TreeMap<>(); private File f; public MonthData(String env) throws IOException { @@ -69,7 +68,7 @@ public class MonthData { public void add(int yr_mon, String target, long total, long adds, long drops) { Set row = data.get(yr_mon); if(row==null) { - data.put(yr_mon, (row=new HashSet())); + data.put(yr_mon, (row=new HashSet<>())); } row.add(new Row(target,total,adds,drops)); } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java index 5dde8895..172768cb 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java @@ -36,7 +36,7 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class NS implements Comparable { - public final static Map data = new TreeMap(); + public final static Map data = new TreeMap<>(); public final String name, description, parent; public final int scope,type; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java index 9614bb19..57ff5c61 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java @@ -71,7 +71,7 @@ public class Notification { } - public static final TreeMap> data = new TreeMap>(); + public static final TreeMap> data = new TreeMap<>(); public static final Date now = new Date(); public final String user; @@ -113,7 +113,7 @@ public class Notification { Notification not = creator.create(row); List ln = data.get(not.user); if(ln==null) { - ln = new ArrayList(); + ln = new ArrayList<>(); data.put(not.user, ln); } ln.add(not); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java index 51a7098e..469284a2 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java @@ -38,9 +38,9 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class Perm implements Comparable { - public static final TreeMap> data = new TreeMap>(); - public static final TreeMap keys = new TreeMap(); - private static List deletePerms = new ArrayList(); + public static final TreeMap> data = new TreeMap<>(); + public static final TreeMap keys = new TreeMap<>(); + private static List deletePerms = new ArrayList<>(); public final String ns, type, instance, action,description; private String fullType = null, fullPerm = null, encode = null; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java index f48544b1..a173c4fa 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java @@ -39,10 +39,10 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class Role implements Comparable { - public static final TreeMap> data = new TreeMap>(); - public static final TreeMap keys = new TreeMap(); - public static final TreeMap byName = new TreeMap(); - private static List deleteRoles = new ArrayList(); + public static final TreeMap> data = new TreeMap<>(); + public static final TreeMap keys = new TreeMap<>(); + public static final TreeMap byName = new TreeMap<>(); + private static List deleteRoles = new ArrayList<>(); public final String ns, name, description; private String full, encode; @@ -51,7 +51,7 @@ public class Role implements Comparable { public Role(String full) { ns = name = description = ""; this.full = full; - perms = new HashSet(); + perms = new HashSet<>(); } public Role(String ns, String name, String description,Set perms) { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java index 9f366c81..a289fe00 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java @@ -44,10 +44,10 @@ import com.datastax.driver.core.SimpleStatement; import com.datastax.driver.core.Statement; public class UserRole implements Cloneable, CacheChange.Data { - public static final List data = new ArrayList(); - public static final TreeMap> byUser = new TreeMap>(); - public static final TreeMap> byRole = new TreeMap>(); - private final static CacheChange cache = new CacheChange(); + public static final List data = new ArrayList<>(); + public static final TreeMap> byUser = new TreeMap<>(); + public static final TreeMap> byRole = new TreeMap<>(); + private final static CacheChange cache = new CacheChange<>(); private static PrintStream urDelete=System.out,urRecover=System.err; private static int totalLoaded; private static int deleted; @@ -109,14 +109,14 @@ public class UserRole implements Cloneable, CacheChange.Data { List lur = byUser.get(ur.urdd.user); if(lur==null) { - lur = new ArrayList(); + lur = new ArrayList<>(); byUser.put(ur.urdd.user, lur); } lur.add(ur); lur = byRole.get(ur.urdd.role); if(lur==null) { - lur = new ArrayList(); + lur = new ArrayList<>(); byRole.put(ur.urdd.role, lur); } lur.add(ur); diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java index 2412f496..8e0257fd 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java @@ -73,7 +73,7 @@ public class ExpiringNext extends Batch { Date earliestUR = gc.getTime(); Date earliestCred = gc.getTime(); // Run for Roles - List expiring = new ArrayList(); + List expiring = new ArrayList<>(); trans.info().log("Checking for Expired UserRoles"); for(UserRole ur : UserRole.data) { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java index f568b330..79e127da 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java @@ -89,7 +89,7 @@ public class ExpiringP2 extends Batch { String line,prev=""; try { UserRole ur; - Map tally = new HashMap(); + Map tally = new HashMap<>(); int count=0; try { while((line=urDeleteF.readLine())!=null) { diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java index 3314694e..9653662c 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java @@ -103,7 +103,7 @@ public class NotifyApprovals extends Batch { Message msg = new Message(); int emailCount = 0; - List pending = new ArrayList(); + List pending = new ArrayList<>(); boolean isOwner,isSupervisor; for(Entry> es : Approval.byApprover.entrySet()) { isOwner = isSupervisor = false; diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java index bdf8347c..c9f04f73 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java @@ -128,12 +128,12 @@ public class NotifyCredExpiring extends Batch { Date tooLate = new Date(now); // Temp structures - Map lastCred = new HashMap(); - Map> ownerCreds = new TreeMap>(); + Map lastCred = new HashMap<>(); + Map> ownerCreds = new TreeMap<>(); Date last; - List noOwner = new ArrayList(); + List noOwner = new ArrayList<>(); ownerCreds.put(UNKNOWN_ID,noOwner); // Get a list of ONLY the ones needing email by Owner @@ -148,7 +148,7 @@ public class NotifyCredExpiring extends Batch { String owner = ur.user(); List llc = ownerCreds.get(owner); if(llc==null) { - ownerCreds.put(owner, (llc=new ArrayList())); + ownerCreds.put(owner, (llc=new ArrayList<>())); } llc.add(new LastCred(c,last)); } -- cgit 1.2.3-korg