Merge "Sonar Fix: MiscID.java"
diff --git a/INFO.yaml b/INFO.yaml
index e5e2276..a8a4c80 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -36,7 +36,7 @@
- name: 'Sai Gandham'
email: 'sai.gandham@att.com'
company: 'ATT'
- id: 'Sai Gandham'
+ id: 'sg481n'
timezone: 'America/Dallas'
- name: 'Girish Havaldar'
email: 'hg0071052@techmahindra.com'
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java
index 37abbaf..5d06075 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java
@@ -34,12 +34,12 @@
private int months;
protected static final Date now = new Date();
- public ActionPuntDAO(AuthzTrans trans, Cluster cluster, int months, int range, boolean dryRun) throws APIException, IOException {
+ public ActionPuntDAO(AuthzTrans trans, Cluster cluster, int months, boolean dryRun) throws APIException, IOException {
super(trans, cluster,dryRun);
this.months = months;
}
- public ActionPuntDAO(AuthzTrans trans, ActionDAO<?, ?,?> predecessor, int months, int range) {
+ public ActionPuntDAO(AuthzTrans trans, ActionDAO<?, ?, ?> predecessor, int months) {
super(trans, predecessor);
this.months = months;
}
@@ -49,18 +49,6 @@
GregorianCalendar temp = new GregorianCalendar();
temp.setTime(current);
temp.add(GregorianCalendar.MONTH, months);
-
- /*
- * This method Randomized date. This is no longer needed. Just add the Punt Months.
- temp.add(GregorianCalendar.MONTH, months);
- if (range>0) {
- int forward = Math.abs(random.nextInt()%range);
- if (forward>1) {
- temp.add(GregorianCalendar.MONTH, forward);
- temp.add(GregorianCalendar.DAY_OF_MONTH, (random.nextInt()%30)-15);
- }
- }
- */
return temp.getTime();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java
index ef6bb94..8c3188d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java
@@ -36,11 +36,11 @@
public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
public CredPunt(AuthzTrans trans, Cluster cluster, int months, int range, boolean dryRun) throws IOException, APIException {
- super(trans,cluster,months,range,dryRun);
+ super(trans,cluster,months, dryRun);
}
public CredPunt(AuthzTrans trans, ActionDAO<?,?,?> adao, int months, int range) throws IOException {
- super(trans, adao, months,range);
+ super(trans, adao, months);
}
public Result<Void> exec(AuthzTrans trans, CredDAO.Data cdd,String text) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java
index 631a811..6636f45 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java
@@ -66,15 +66,8 @@
}
}
Result<OP_STATUS> rv = f.performFutureOp(trans, FUTURE_OP.A, future.fdd,
- new Lookup<List<ApprovalDAO.Data>>() {
- @Override
- public List<Data> get(AuthzTrans trans, Object ... noop) {
- return apprs;
- }
- },
- new Lookup<UserRoleDAO.Data>() {
- @Override
- public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
+ (trans1, noop) -> apprs,
+ (trans12, keys) -> {
List<UserRole> lur = UserRole.getByUser().get(keys[0]);
if (lur!=null) {
for (UserRole ur : lur) {
@@ -84,8 +77,7 @@
}
}
return null;
- }
- });
+ });
if (rv.isOK()) {
switch(rv.value) {
case D:
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java
index 18705fb..28c7a64 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java
@@ -37,11 +37,11 @@
public class URPunt extends ActionPuntDAO<UserRole,Void,String> {
public URPunt(AuthzTrans trans, Cluster cluster, int months, int range, boolean dryRun) throws APIException, IOException {
- super(trans,cluster, months, range,dryRun);
+ super(trans,cluster, months, dryRun);
}
public URPunt(AuthzTrans trans, ActionDAO<?,?,?> adao, int months, int range) {
- super(trans, adao, months, range);
+ super(trans, adao, months);
}
public Result<Void> exec(AuthzTrans trans, UserRole ur, String text) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
index e171d17..11eacd4 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
@@ -193,18 +193,15 @@
}
trans.info().log("Checking for Expired X509s");
- X509.load(trans, session, new Visitor<X509>() {
- @Override
- public void visit(X509 x509) {
- try {
- for(Certificate cert : Factory.toX509Certificate(x509.x509)) {
- writeAnalysis(trans, x509, (X509Certificate)cert);
- }
- } catch (CertificateException | IOException e) {
- trans.error().log(e, "Error Decrypting X509");
+ X509.load(trans, session, x509 -> {
+ try {
+ for(Certificate cert : Factory.toX509Certificate(x509.x509)) {
+ writeAnalysis(trans, x509, (X509Certificate)cert);
}
-
+ } catch (CertificateException | IOException e) {
+ trans.error().log(e, "Error Decrypting X509");
}
+
});
} catch (FileNotFoundException e) {
trans.info().log(e);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
index fe754c1..ab8b6e8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
@@ -105,16 +105,13 @@
trans.info().log("User Roles");
final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
- UserRole.load(trans, session, UserRole.v2_0_11, new Visitor<UserRole>() {
- @Override
- public void visit(UserRole ur) {
- try {
- if(!check(transNoAvg, checked, ur.user())) {
- ur.row(whichWriter(transNoAvg,ur.user()));
- }
- } catch (OrganizationException e) {
- trans.error().log(e, "Error Decrypting X509");
+ UserRole.load(trans, session, UserRole.v2_0_11, ur -> {
+ try {
+ if(!check(transNoAvg, checked, ur.user())) {
+ ur.row(whichWriter(transNoAvg,ur.user()));
}
+ } catch (OrganizationException e) {
+ trans.error().log(e, "Error Decrypting X509");
}
});
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java
index 8281e74..1a7d774 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NsRoleUserReport.java
@@ -86,24 +86,21 @@
trans.info().log("Create Report on Roles by NS");
final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
- UserRole.load(transNoAvg, session, UserRole.v2_0_11, new Visitor<UserRole>() {
- @Override
- public void visit(UserRole ur) {
- if(ur.expires().after(now)) {
- Map<String, Integer> roleCount = theMap.get(ur.ns());
- Integer count;
- if(roleCount==null) {
- roleCount = new TreeMap<>();
- theMap.put(ur.ns(),roleCount);
+ UserRole.load(transNoAvg, session, UserRole.v2_0_11, ur -> {
+ if(ur.expires().after(now)) {
+ Map<String, Integer> roleCount = theMap.get(ur.ns());
+ Integer count;
+ if(roleCount==null) {
+ roleCount = new TreeMap<>();
+ theMap.put(ur.ns(),roleCount);
+ count = 0;
+ } else {
+ count = roleCount.get(ur.rname());
+ if(count == null) {
count = 0;
- } else {
- count = roleCount.get(ur.rname());
- if(count == null) {
- count = 0;
- }
}
- roleCount.put(ur.rname(), count+1);
}
+ roleCount.put(ur.rname(), count+1);
}
});
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
index 4caa339..b7dd069 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
@@ -225,14 +225,11 @@
protected Client _newClient(String urlinfo) throws LocatorException {
try {
String[] info = Split.split('/', urlinfo);
- Client c = new Client(new URL(JscepCA.CA_PREFIX + info[0] + JscepCA.CA_POSTFIX),
- new CertificateVerifier() {
- @Override
- public boolean verify(X509Certificate cert) {
+ Client c = new Client(new URL(JscepCA.CA_PREFIX + info[0] + JscepCA.CA_POSTFIX),
+ cert -> {
//TODO checkIssuer
return true;
}
- }
);
// Map URL to Client, because Client doesn't expose Connection
mxcwiC.put(c, mxcwiS.get(urlinfo));
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
index ad997d1..edbe206 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
@@ -3,6 +3,8 @@
* org.onap.aaf
* ===========================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
* ===========================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,17 +88,13 @@
private static boolean showDetails = false;
private static boolean ignoreDelay = false;
private static int globalDelay=0;
-
- public static int timeout() {
- return TIMEOUT;
- }
// Create when only have Access
public AAFcli(Access access, Writer wtr, HMangr hman, SecurityInfoC<HttpURLConnection> si, SecuritySetter<HttpURLConnection> ss) throws APIException, CadiException {
this(access,new AuthzEnv(access.getProperties()),wtr,hman, si,ss);
}
- public AAFcli(Access access, AuthzEnv env, Writer wtr, HMangr hman, SecurityInfoC<HttpURLConnection> si, SecuritySetter<HttpURLConnection> ss) throws APIException, CadiException {
+ public AAFcli(Access access, AuthzEnv env, Writer wtr, HMangr hman, SecurityInfoC<HttpURLConnection> si, SecuritySetter<HttpURLConnection> ss) throws APIException {
this.env = env;
this.access = access;
this.ss = ss;
@@ -125,6 +123,10 @@
cmds.add(new Mgmt(this));
}
+ public static int timeout() {
+ return TIMEOUT;
+ }
+
public void verbose(boolean v) {
verbose = v;
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
index 0597640..49fd486 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
@@ -358,12 +358,7 @@
// Save Server time by Sorting locally
List<Item> items = history.getItem();
- java.util.Collections.sort(items, new Comparator<Item>() {
- @Override
- public int compare(Item o1, Item o2) {
- return o2.getTimestamp().compare(o1.getTimestamp());
- }
- });
+ java.util.Collections.sort(items, (Comparator<Item>) (o1, o2) -> o2.getTimestamp().compare(o1.getTimestamp()));
for (History.Item item : items) {
GregorianCalendar gc = item.getTimestamp().toGregorianCalendar();