diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-07-03 07:51:17 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-07-03 12:06:59 -0500 |
commit | f85f0889b3b0e5e9694afab4dd01a4a97a155188 (patch) | |
tree | 4a7119cfa0a112e514f50bbc2961981c3670ea03 /auth/auth-batch | |
parent | 8efa968683ef2c4ab0ae7f4c0d2ccb0fcaa8af7b (diff) |
Collection syntax change because of Sonar
Issue-ID: AAF-386
Change-Id: I8ba8d8561d03e680ddc90a81b8db0339814c65fa
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-batch')
15 files changed, 37 insertions, 38 deletions
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<Approval>(); + 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<Approval>(); + 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<Approval>(); + 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<String, Integer>(); + 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<T extends CacheChange.Data> { private List<T> removed; public CacheChange() { - removed = new ArrayList<T>(); + 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<String,Cred> data = new TreeMap<String,Cred>(); - public static final TreeMap<String,List<Cred>> byNS = new TreeMap<String,List<Cred>>(); + public static final TreeMap<String,Cred> data = new TreeMap<>(); + public static final TreeMap<String,List<Cred>> byNS = new TreeMap<>(); public final String id; public final List<Instance> instances; @@ -52,7 +52,7 @@ public class Cred { public Cred(String id) { this.id = id; - instances = new ArrayList<Instance>(); + instances = new ArrayList<>(); ns=Question.domain2ns(id); } @@ -93,7 +93,7 @@ public class Cred { public Set<Integer> types() { - Set<Integer> types = new HashSet<Integer>(); + Set<Integer> types = new HashSet<>(); for(Instance i : instances) { types.add(i.type); } @@ -155,7 +155,7 @@ public class Cred { List<Cred> lscd = byNS.get(cred.ns); if(lscd==null) { - byNS.put(cred.ns, (lscd=new ArrayList<Cred>())); + 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<String,MiscID> data = new TreeMap<String,MiscID>(); + public static final TreeMap<String,MiscID> 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<Integer,Set<Row>> data = - new TreeMap<Integer,Set<Row>>(); + public final Map<Integer,Set<Row>> 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> row = data.get(yr_mon); if(row==null) { - data.put(yr_mon, (row=new HashSet<Row>())); + 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<NS> { - public final static Map<String,NS> data = new TreeMap<String,NS>(); + public final static Map<String,NS> 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<String,List<Notification>> data = new TreeMap<String,List<Notification>>(); + public static final TreeMap<String,List<Notification>> 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<Notification> ln = data.get(not.user); if(ln==null) { - ln = new ArrayList<Notification>(); + 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<Perm> { - public static final TreeMap<Perm,Set<String>> data = new TreeMap<Perm,Set<String>>(); - public static final TreeMap<String,Perm> keys = new TreeMap<String,Perm>(); - private static List<Perm> deletePerms = new ArrayList<Perm>(); + public static final TreeMap<Perm,Set<String>> data = new TreeMap<>(); + public static final TreeMap<String,Perm> keys = new TreeMap<>(); + private static List<Perm> 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<Role> { - public static final TreeMap<Role,Set<String>> data = new TreeMap<Role,Set<String>>(); - public static final TreeMap<String,Role> keys = new TreeMap<String,Role>(); - public static final TreeMap<String,Role> byName = new TreeMap<String,Role>(); - private static List<Role> deleteRoles = new ArrayList<Role>(); + public static final TreeMap<Role,Set<String>> data = new TreeMap<>(); + public static final TreeMap<String,Role> keys = new TreeMap<>(); + public static final TreeMap<String,Role> byName = new TreeMap<>(); + private static List<Role> deleteRoles = new ArrayList<>(); public final String ns, name, description; private String full, encode; @@ -51,7 +51,7 @@ public class Role implements Comparable<Role> { public Role(String full) { ns = name = description = ""; this.full = full; - perms = new HashSet<String>(); + perms = new HashSet<>(); } public Role(String ns, String name, String description,Set<String> 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<UserRole> data = new ArrayList<UserRole>(); - public static final TreeMap<String,List<UserRole>> byUser = new TreeMap<String,List<UserRole>>(); - public static final TreeMap<String,List<UserRole>> byRole = new TreeMap<String,List<UserRole>>(); - private final static CacheChange<UserRole> cache = new CacheChange<UserRole>(); + public static final List<UserRole> data = new ArrayList<>(); + public static final TreeMap<String,List<UserRole>> byUser = new TreeMap<>(); + public static final TreeMap<String,List<UserRole>> byRole = new TreeMap<>(); + private final static CacheChange<UserRole> 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<UserRole> lur = byUser.get(ur.urdd.user); if(lur==null) { - lur = new ArrayList<UserRole>(); + lur = new ArrayList<>(); byUser.put(ur.urdd.user, lur); } lur.add(ur); lur = byRole.get(ur.urdd.role); if(lur==null) { - lur = new ArrayList<UserRole>(); + 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<String> expiring = new ArrayList<String>(); + List<String> 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<String,Count> tally = new HashMap<String,Count>(); + Map<String,Count> 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<Approval> pending = new ArrayList<Approval>(); + List<Approval> pending = new ArrayList<>(); boolean isOwner,isSupervisor; for(Entry<String, List<Approval>> 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<String,Cred> lastCred = new HashMap<String,Cred>(); - Map<String,List<LastCred>> ownerCreds = new TreeMap<String,List<LastCred>>(); + Map<String,Cred> lastCred = new HashMap<>(); + Map<String,List<LastCred>> ownerCreds = new TreeMap<>(); Date last; - List<LastCred> noOwner = new ArrayList<LastCred>(); + List<LastCred> 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<LastCred> llc = ownerCreds.get(owner); if(llc==null) { - ownerCreds.put(owner, (llc=new ArrayList<LastCred>())); + ownerCreds.put(owner, (llc=new ArrayList<>())); } llc.add(new LastCred(c,last)); } |