summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch/src/main/java
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:23 -0500
committerInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:26 -0500
commit7e966914050e66219689001ff4ab601a49eef0ac (patch)
treeb1bf643f2d191207adc7d9f6b41ac20f56083e76 /auth/auth-batch/src/main/java
parentead32f193586e39b59bb366bddf70e665173a52d (diff)
Mass whitespace changes (Style Warnings)
Issue-ID: AAF-473 Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-batch/src/main/java')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java34
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java28
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java40
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java12
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java12
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java44
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java50
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java28
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java20
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/ExpiringNext.java32
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java124
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java44
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java64
46 files changed, 383 insertions, 383 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
index 559e3c51..5670ac95 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
@@ -98,11 +98,11 @@ public abstract class Batch {
// load extra properties, i.e.
// PERF.cassandra.clusters=....
batchEnv = env.getProperty(CASS_ENV);
- if(batchEnv != null) {
+ if (batchEnv != null) {
batchEnv = batchEnv.trim();
env.info().log("Redirecting to ",batchEnv,"environment");
String str;
- for(String key : new String[]{
+ for (String key : new String[]{
CassAccess.CASSANDRA_CLUSTERS,
CassAccess.CASSANDRA_CLUSTERS_PORT,
CassAccess.CASSANDRA_CLUSTERS_USER_NAME,
@@ -111,7 +111,7 @@ public abstract class Batch {
LOG_DIR,
"SPECIAL_NAMES"
}) {
- if((str = env.getProperty(batchEnv+'.'+key))!=null) {
+ if ((str = env.getProperty(batchEnv+'.'+key))!=null) {
env.setProperty(key, str);
}
}
@@ -319,8 +319,8 @@ public abstract class Batch {
private static void transferVMProps(AuthzEnv env, String ... props) {
String value;
- for(String key : props) {
- if((value = System.getProperty(key))!=null) {
+ for (String key : props) {
+ if ((value = System.getProperty(key))!=null) {
env.setProperty(key, value);
}
}
@@ -357,8 +357,8 @@ public abstract class Batch {
protected static String logDir() {
String ld = env.getProperty(LOG_DIR);
- if(ld==null) {
- if(batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
+ if (ld==null) {
+ if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir
ld = "logs/";
} else {
ld = "logs/"+batchEnv;
@@ -367,11 +367,11 @@ public abstract class Batch {
return ld;
}
protected int count(String str, char c) {
- if(str==null || str.isEmpty()) {
+ if (str==null || str.isEmpty()) {
return 0;
} else {
int count=1;
- for(int i=str.indexOf(c);i>=0;i=str.indexOf(c,i+1)) {
+ for (int i=str.indexOf(c);i>=0;i=str.indexOf(c,i+1)) {
++count;
}
return count;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
index cb2b158f..e80eada1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
@@ -59,14 +59,14 @@ public abstract class CassBatch extends Batch {
}
public ResultSet executeQuery(String cql, String extra) {
- if(isDryRun() && !cql.startsWith("SELECT")) {
- if(extra!=null)env.info().log("Would query" + extra + ": " + cql);
+ if (isDryRun() && !cql.startsWith("SELECT")) {
+ if (extra!=null)env.info().log("Would query" + extra + ": " + cql);
} else {
- if(extra!=null)env.info().log("query" + extra + ": " + cql);
+ if (extra!=null)env.info().log("query" + extra + ": " + cql);
try {
return session.execute(cql);
} catch (InvalidQueryException e) {
- if(extra==null) {
+ if (extra==null) {
env.info().log("query: " + cql);
}
throw e;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
index af636d65..5275cf93 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
@@ -65,7 +65,7 @@ public abstract class ActionDAO<D,RV,T> implements Action<D,RV,T> {
}
public void close(AuthzTrans trans) {
- if(clean) {
+ if (clean) {
q.close(trans);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
index 95b35fdb..707425ca 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
@@ -58,9 +58,9 @@ public abstract class ActionPuntDAO<D, RV, T> extends ActionDAO<D, RV, T> {
* This method Randomized date. This is no longer needed. Just add the Punt Months.
temp.setTime(now);
temp.add(GregorianCalendar.MONTH, months);
- if(range>0) {
+ if (range>0) {
int forward = Math.abs(random.nextInt()%range);
- if(forward>1) {
+ if (forward>1) {
temp.add(GregorianCalendar.MONTH, forward);
temp.add(GregorianCalendar.DAY_OF_MONTH, (random.nextInt()%30)-15);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
index e0fa4be5..269edc77 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
@@ -41,7 +41,7 @@ public class CacheTouch extends ActionDAO<String,Void, String> {
@Override
public Result<Void> exec(AuthzTrans trans, String table, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would mark %s cache in DB for clearing: %s",table, text);
return Result.ok();
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
index b4b7d0b3..ceb0453b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
@@ -43,7 +43,7 @@ public class CredDelete extends ActionDAO<CredDAO.Data,Void, String> {
@Override
public Result<Void> exec(AuthzTrans trans, CredDAO.Data cred, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete:",text,cred.id,CredPrint.type(cred.type),Chrono.dateOnlyStamp(cred.expires));
return Result.ok();
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
index a2c9ecf6..33151d9f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
@@ -46,14 +46,14 @@ public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
public Result<Void> exec(AuthzTrans trans, CredDAO.Data cdd,String text) {
Result<Void> rv = null;
Result<List<CredDAO.Data>> read = q.credDAO.read(trans, cdd);
- if(read.isOKhasData()) {
- for(CredDAO.Data data : read.value) {
+ if (read.isOKhasData()) {
+ for (CredDAO.Data data : read.value) {
Date from = data.expires;
data.expires = puntDate(from);
- if(data.expires.compareTo(from)<=0) {
+ if (data.expires.compareTo(from)<=0) {
trans.debug().printf("Error: %s is before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
} else {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Update Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
} else {
trans.info().log("Updated Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
@@ -62,7 +62,7 @@ public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
}
}
}
- if(rv==null) {
+ if (rv==null) {
rv=Result.err(read);
}
return rv;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
index 0ac8f61d..f40eeb58 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
@@ -55,7 +55,7 @@ public class Email implements Action<Organization,Void, String>{
public Email clear() {
toList.clear();
ccList.clear();
- for(String s: defaultCC) {
+ for (String s: defaultCC) {
ccList.add(s);
}
return this;
@@ -71,35 +71,35 @@ public class Email implements Action<Organization,Void, String>{
}
public Email addTo(Identity id) {
- if(id!=null && !toList.contains(id.email())) {
+ if (id!=null && !toList.contains(id.email())) {
toList.add(id.email());
}
return this;
}
public Email addTo(Collection<String> users) {
- for(String u : users) {
+ for (String u : users) {
addTo(u);
}
return this;
}
public Email addTo(String email) {
- if(!toList.contains(email)) {
+ if (!toList.contains(email)) {
toList.add(email);
}
return this;
}
public Email addCC(Identity id) {
- if(id!=null && !ccList.contains(id.email())) {
+ if (id!=null && !ccList.contains(id.email())) {
ccList.add(id.email());
}
return this;
}
public Email addCC(String email) {
- if(!ccList.contains(email)) {
+ if (!ccList.contains(email)) {
ccList.add(email);
}
return this;
@@ -108,7 +108,7 @@ public class Email implements Action<Organization,Void, String>{
public Email add(Identity id, boolean toSuper) throws OrganizationException {
Identity responsible = id.responsibleTo();
- if(toSuper) {
+ if (toSuper) {
addTo(responsible.email());
addCC(id.email());
} else {
@@ -119,7 +119,7 @@ public class Email implements Action<Organization,Void, String>{
}
public Email subject(String format, Object ... args) {
- if(format.contains("%s")) {
+ if (format.contains("%s")) {
subject = String.format(format, args);
} else {
subject = format;
@@ -140,18 +140,18 @@ public class Email implements Action<Organization,Void, String>{
@Override
public Result<Void> exec(AuthzTrans trans, Organization org, String text) {
StringBuilder sb = new StringBuilder();
- if(preamble!=null) {
+ if (preamble!=null) {
sb.append(lineIndent);
sb.append(preamble);
sb.append("\n\n");
}
- if(msg!=null) {
+ if (msg!=null) {
msg.msg(sb,lineIndent);
sb.append("\n");
}
- if(sig!=null) {
+ if (sig!=null) {
sb.append(sig);
sb.append("\n");
}
@@ -159,7 +159,7 @@ public class Email implements Action<Organization,Void, String>{
long ct = System.currentTimeMillis();
long wait = ct-lastSent;
lastSent = ct;
- if(wait < 100) { // 10 per second
+ if (wait < 100) { // 10 per second
try {
Thread.sleep(wait);
} catch (InterruptedException e) {
@@ -188,8 +188,8 @@ public class Email implements Action<Organization,Void, String>{
public void log(PrintStream ps, String text) {
ps.print(Chrono.dateTime());
boolean first = true;
- for(String s : toList) {
- if(first) {
+ for (String s : toList) {
+ if (first) {
first = false;
ps.print(": ");
} else {
@@ -197,10 +197,10 @@ public class Email implements Action<Organization,Void, String>{
}
ps.print(s);
}
- if(!ccList.isEmpty()) {
+ if (!ccList.isEmpty()) {
first=true;
- for(String s : ccList) {
- if(first) {
+ for (String s : ccList) {
+ if (first) {
first = false;
ps.print(" [");
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
index 5fdc15b1..141e382f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
@@ -43,8 +43,8 @@ public class EmailPrint extends Email {
PrintStream out = System.out;
boolean first = true;
out.print("To: ");
- for(String s: toList) {
- if(first) {first = false;}
+ for (String s: toList) {
+ if (first) {first = false;}
else {out.print(',');}
out.print(s);
}
@@ -52,8 +52,8 @@ public class EmailPrint extends Email {
first = true;
out.print("CC: ");
- for(String s: ccList) {
- if(first) {first = false;}
+ for (String s: ccList) {
+ if (first) {first = false;}
else {out.print(',');}
out.print(s);
}
@@ -64,7 +64,7 @@ public class EmailPrint extends Email {
out.println();
boolean go = true;
- for(int start=0, end=LINE_LENGTH;go;start=end,end=Math.min(msg.length(), start+LINE_LENGTH)) {
+ for (int start=0, end=LINE_LENGTH;go;start=end,end=Math.min(msg.length(), start+LINE_LENGTH)) {
int ret = msg.indexOf("\n",start+1);
switch(ret) {
case -1:
@@ -75,13 +75,13 @@ public class EmailPrint extends Email {
out.println();
break;
default:
- if(ret<end) {
+ if (ret<end) {
end = ret;
}
- if(end==start+LINE_LENGTH) {
+ if (end==start+LINE_LENGTH) {
// Word-wrapping
ret = msg.lastIndexOf(" ", end);
- if(ret>start && ret<end) {
+ if (ret>start && ret<end) {
end=ret+1;
}
out.println(msg.substring(start,end));
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
index ac594a47..f1eadb20 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
@@ -42,8 +42,8 @@ public class Message {
}
public void msg(StringBuilder sb, String lineIndent) {
- if(!lines.isEmpty()) {
- for(String line : lines) {
+ if (!lines.isEmpty()) {
+ for (String line : lines) {
sb.append(lineIndent);
sb.append(line);
sb.append('\n');
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
index 5e531269..58a8c4b8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
@@ -41,12 +41,12 @@ public class NSACreate extends ActionDAO<NsAttrib,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NsAttrib nsa, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Create %s Attrib '%s=%s' in %s",text,nsa.key,nsa.value,nsa.ns);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().attribAdd(trans, nsa.ns, nsa.key, nsa.value);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("%s - Created Attrib '%s=%s' in %s",text,nsa.key,nsa.value,nsa.ns);
} else {
trans.error().printf("Error Creating Attrib '%s=%s' in %s - %s",nsa.key,nsa.value,nsa.ns,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
index 4bed8687..c8a1c82c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
@@ -41,12 +41,12 @@ public class NSADelete extends ActionDAO<NsAttrib,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NsAttrib nsa, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Delete %s Attrib '%s' in %s",text,nsa.key,nsa.ns);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().attribRemove(trans, nsa.ns, nsa.key);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("%s - Deleted Attrib '%s' in %s",text,nsa.key,nsa.value,nsa.ns);
} else {
trans.error().printf("Error Deleting Attrib '%s' in %s - %s",nsa.key,nsa.value,nsa.ns,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
index 98fad0ab..d5d93b38 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
@@ -41,12 +41,12 @@ public class NSDescUpdate extends ActionDAO<NS,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, NS ns, String desc) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Update '%s' Description to '%s'",ns,desc);
return Result.ok();
} else {
Result<Void> rv = q.nsDAO.dao().addDescription(trans, ns.name, desc);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updated '%s' Description to '%s'",ns,desc);
} else {
trans.error().printf("Error Updating '%s' Description to '%s' - %s",ns,desc,rv.details);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
index c32234d7..a6c02f2c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
@@ -52,12 +52,12 @@ public class PermCreate extends ActionDAO<Perm,Data,String> {
pdd.description = p.description;
pdd.roles = p.roles;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Create Perm:",text,p.fullType());
return Result.ok(pdd);
} else {
Result<Data> rv = q.permDAO.create(trans, pdd); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Created Perm:",text,p.fullType());
} else {
trans.error().log("Error Creating Role -",rv.details,":",p.fullType());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
index c5b79185..db549948 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
@@ -47,12 +47,12 @@ public class PermDelete extends ActionDAO<Perm,Void,String> {
pdd.type = p.type;
pdd.instance = p.instance;
pdd.action = p.action;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete Perm:",text,p.fullType());
return Result.ok();
} else {
Result<Void> rv = q.permDAO.delete(trans, pdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted Perm:",text,p.fullType());
} else {
trans.error().log("Error Deleting Perm -",rv.details,":",p.fullType());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
index bc6f70ca..a3d4bb6d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
@@ -48,35 +48,35 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
@Override
public Result<PermDAO.Data> exec(AuthzTrans trans, final Perm p, final Modify modify) {
Result<List<PermDAO.Data>> rr = q.permDAO.read(trans, p.ns,p.type,p.instance,p.action);
- if(dryRun) {
- if(rr.isOKhasData()) {
+ if (dryRun) {
+ if (rr.isOKhasData()) {
return Result.ok(rr.value.get(0));
} else {
return Result.err(Result.ERR_NotFound, "Data not Found " + p.toString());
}
} else {
Result<PermDAO.Data> rv = null;
- if(rr.isOKhasData()) {
- for(final Data d : rr.value) {
+ if (rr.isOKhasData()) {
+ for (final Data d : rr.value) {
modify.change(d);
- if(d.ns.equals(p.ns) && d.type.equals(p.type) && d.instance.equals(p.instance) && d.action.equals(p.action)) {
+ if (d.ns.equals(p.ns) && d.type.equals(p.type) && d.instance.equals(p.instance) && d.action.equals(p.action)) {
// update for fields
// In either case, adjust Permissions
- for(String r : d.roles) {
- if(!p.roles.contains(r)) {
+ for (String r : d.roles) {
+ if (!p.roles.contains(r)) {
q.permDAO.dao().addRole(trans, d, r);
}
}
- for(String r : p.roles) {
- if(!d.roles.contains(r)) {
+ for (String r : p.roles) {
+ if (!d.roles.contains(r)) {
q.permDAO.dao().delRole(trans, d, r);
}
}
rv = Result.ok(d);
} else {
- for(String r : d.roles) {
+ for (String r : d.roles) {
Role role = Role.keys.get(r);
- if(role.perms.contains(p.encode())) {
+ if (role.perms.contains(p.encode())) {
modify.roleModify().exec(trans, role, new RoleModify.Modify() {
@Override
public PermModify permModify() {
@@ -93,7 +93,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
}
rv = q.permDAO.create(trans, d);
- if(rv.isOK()) {
+ if (rv.isOK()) {
PermDAO.Data pdd = new PermDAO.Data();
pdd.ns = p.ns;
pdd.type = p.type;
@@ -112,7 +112,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
} else {
rv = Result.err(rr);
}
- if(rv==null) {
+ if (rv==null) {
rv = Result.err(Status.ERR_General,"Never get to this code");
}
@@ -126,7 +126,7 @@ public class PermModify extends ActionDAO<Perm,PermDAO.Data,PermModify.Modify> {
}
public Result<Void> delete(AuthzTrans trans, Perm p) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok();
} else {
PermDAO.Data data = new PermDAO.Data();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
index 5353166c..cdbe92b4 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
@@ -49,12 +49,12 @@ public class RoleCreate extends ActionDAO<Role,Data,String> {
rdd.description = r.description;
rdd.perms = r.perms;
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Create Role:",text,r.fullName());
return Result.ok(rdd);
} else {
Result<Data> rv = q.roleDAO.create(trans, rdd); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Created Role:",text,r.fullName());
} else {
trans.error().log("Error Creating Role -",rv.details,":",r.fullName());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
index 1a663c99..67491b5b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
@@ -42,7 +42,7 @@ public class RoleDelete extends ActionDAO<Role,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, Role r,String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete Role:",text,r.fullName());
return Result.ok();
} else {
@@ -50,7 +50,7 @@ public class RoleDelete extends ActionDAO<Role,Void,String> {
rdd.ns = r.ns;
rdd.name = r.name;
Result<Void> rv = q.roleDAO.delete(trans, rdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted Role:",text,r.fullName());
} else {
trans.error().log("Error Deleting Role -",rv.details,":",r.fullName());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
index 87e2e027..75937ef7 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
@@ -48,42 +48,42 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
@Override
public Result<RoleDAO.Data> exec(final AuthzTrans trans, final Role r,final RoleModify.Modify modify) {
Result<List<Data>> rr = q.roleDAO.read(trans, r.ns,r.name);
- if(dryRun) {
- if(rr.isOKhasData()) {
+ if (dryRun) {
+ if (rr.isOKhasData()) {
return Result.ok(rr.value.get(0));
} else {
return Result.err(Result.ERR_NotFound, "Data not Found " + r.toString());
}
} else {
Result<Data> rv = null;
- if(rr.isOKhasData()) {
- for(final Data d : rr.value) {
+ if (rr.isOKhasData()) {
+ for (final Data d : rr.value) {
modify.change(d);
- if(d.ns.equals(r.ns) && d.name.equals(r.name)) {
+ if (d.ns.equals(r.ns) && d.name.equals(r.name)) {
// update for fields
// In either case, adjust Roles
- for(String p : d.perms) {
- if(!r.perms.contains(p)) {
+ for (String p : d.perms) {
+ if (!r.perms.contains(p)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans, q, p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
q.roleDAO.dao().addPerm(trans, d, rpdd.value);
}
}
}
- for(String p : r.perms) {
- if(!d.perms.contains(p)) {
+ for (String p : r.perms) {
+ if (!d.perms.contains(p)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans, q, p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
q.roleDAO.dao().delPerm(trans, d, rpdd.value);
}
}
}
rv = Result.ok(d);
} else {
- for(String p : d.perms) {
+ for (String p : d.perms) {
Perm perm = Perm.keys.get(p);
- if(perm!=null) {
- if(perm.roles.contains(r.encode())) {
+ if (perm!=null) {
+ if (perm.roles.contains(r.encode())) {
modify.permModify().exec(trans, perm, new PermModify.Modify() {
@Override
public RoleModify roleModify() {
@@ -100,11 +100,11 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
}
}
Result<List<Data>> preexist = q.roleDAO.read(trans, d);
- if(preexist.isOKhasData()) {
+ if (preexist.isOKhasData()) {
Data rdd = preexist.value.get(0);
- for(String p : d.perms) {
+ for (String p : d.perms) {
Result<PermDAO.Data> perm = PermDAO.Data.decode(trans, q, p);
- if(perm.isOKhasData()) {
+ if (perm.isOKhasData()) {
q.roleDAO.dao().addPerm(trans,rdd, perm.value);
}
}
@@ -112,7 +112,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
} else {
rv = q.roleDAO.create(trans, d);
}
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updating %s|%s to %s|%s", r.ns, r.name, d.ns, d.name);
RoleDAO.Data rmme = new RoleDAO.Data();
rmme.ns=r.ns;
@@ -127,7 +127,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
} else {
rv = Result.err(rr);
}
- if(rv==null) {
+ if (rv==null) {
rv = Result.err(Status.ERR_General,"Never get to this code");
}
return rv;
@@ -140,7 +140,7 @@ public class RoleModify extends ActionDAO<Role,RoleDAO.Data,RoleModify.Modify> {
}
public Result<Void> delete(AuthzTrans trans, Role r) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok();
} else {
RoleDAO.Data data = new RoleDAO.Data();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
index b6baea6c..4538c56b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
@@ -44,7 +44,7 @@ public class URAdd extends ActionDAO<UserRole,UserRoleDAO.Data,String> {
@Override
public Result<Data> exec(AuthzTrans trans, UserRole ur, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Add:",text,ur.role(),ur.user(),"on",Chrono.dateOnlyStamp(ur.expires()));
return Result.ok(ur.urdd());
} else {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
index d54b7805..cf519f6f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
@@ -42,12 +42,12 @@ public class URDelete extends ActionDAO<UserRole,Void,String> {
@Override
public Result<Void> exec(AuthzTrans trans, UserRole ur,String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Delete UserRole:",text,ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()));
return Result.ok();
} else {
Result<Void> rv = q.userRoleDAO.delete(trans,ur.urdd(), true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log("Deleted UserRole:",text,ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()));
} else {
trans.error().log("Error Deleting User Role -",rv.details,":",ur.user(),ur.role(),"on",Chrono.dateOnlyStamp(ur.expires()) );
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
index 8590714f..36b476e1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
@@ -59,11 +59,11 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
@Override
public Result<String> exec(AuthzTrans trans, UserRole ur,String text) {
- if(dryRun) {
+ if (dryRun) {
return Result.ok(text);
} else {
Result<NsDAO.Data> rns = q.deriveNs(trans, ur.ns());
- if(rns.isOK()) {
+ if (rns.isOK()) {
FutureDAO.Data data = new FutureDAO.Data();
data.id=null; // let Create function assign UUID
@@ -78,7 +78,7 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
return Result.err(e);
}
Result<String> rfuture = f.createFuture(trans, data, Function.FOP_USER_ROLE, ur.user(), rns.value, FUTURE_OP.A);
- if(rfuture.isOK()) {
+ if (rfuture.isOK()) {
trans.info().log(rfuture.value, text, ur.user(), data.memo);
} else {
trans.error().log(rfuture.details, text);
@@ -93,15 +93,15 @@ public class URFutureApprove extends ActionDAO<UserRole, String,String> implemen
@Override
public String key(UserRole ur) {
String expire;
- if(expires.before(start)) {
+ if (expires.before(start)) {
expire = "' - EXPIRED ";
} else {
expire = "' - expiring ";
}
- if(Question.OWNER.equals(ur.rname())) {
+ if (Question.OWNER.equals(ur.rname())) {
return Approval.RE_VALIDATE_OWNER + ur.ns() + expire + Chrono.dateOnlyStamp(ur.expires());
- } else if(Question.ADMIN.equals(ur.rname())) {
+ } else if (Question.ADMIN.equals(ur.rname())) {
return Approval.RE_VALIDATE_ADMIN + ur.ns() + expire + Chrono.dateOnlyStamp(ur.expires());
} else {
return Approval.RE_APPROVAL_IN_ROLE + ur.role() + expire + Chrono.dateOnlyStamp(ur.expires());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
index fcba2364..75bbd813 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
@@ -52,16 +52,16 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
@Override
public Result<OP_STATUS> exec(AuthzTrans trans, List<Approval> app, Future future) {
- if(dryRun) {
+ if (dryRun) {
return Result.err(Result.ERR_ActionNotCompleted,"Not Executed");
} else {
// Save on Lookups
final List<ApprovalDAO.Data> apprs = new ArrayList<>();
final List<UserRoleDAO.Data> urs = new ArrayList<>();
- for(Approval a : app) {
+ for (Approval a : app) {
apprs.add(a.add);
UserRole ur = UserRole.get(a.add.user, future.role);
- if(ur!=null) {
+ if (ur!=null) {
urs.add(ur.urdd());
}
}
@@ -76,9 +76,9 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
@Override
public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
List<UserRole> lur = UserRole.getByUser().get(keys[0]);
- if(lur!=null) {
- for(UserRole ur : lur) {
- if(ur.role().equals(keys[1])) {
+ if (lur!=null) {
+ for (UserRole ur : lur) {
+ if (ur.role().equals(keys[1])) {
return ur.urdd();
}
}
@@ -86,7 +86,7 @@ public class URFutureApproveExec extends ActionDAO<List<Approval>, OP_STATUS, Fu
return null;
}
});
- if(rv.isOK()) {
+ if (rv.isOK()) {
switch(rv.value) {
case D:
trans.info().printf("Denied %s on %s", future.memo(),future.fdd.target);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
index a7d420e3..12460c97 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
@@ -45,22 +45,22 @@ public class URModify extends ActionDAO<UserRole,Void,URModify.Modify> {
@Override
public Result<Void> exec(AuthzTrans trans, UserRole ur,Modify modify) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would Update %s %s", ur.user(), ur.role());
return Result.ok();
} else {
Result<List<Data>> rr = q.userRoleDAO.read(trans, ur.user(),ur.role());
- if(rr.notOKorIsEmpty()) {
+ if (rr.notOKorIsEmpty()) {
return Result.err(rr);
}
- for(Data d : rr.value) {
+ for (Data d : rr.value) {
modify.change(d);
- if(!(ur.expires().equals(d.expires))) {
+ if (!(ur.expires().equals(d.expires))) {
ur.expires(d.expires);
}
- if(ur.user().equals(d.user) && ur.role().equals(d.role)){
+ if (ur.user().equals(d.user) && ur.role().equals(d.role)){
Result<Void> rv = q.userRoleDAO.update(trans, d);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().printf("Updated %s %s to %s", ur.user(), ur.role(), d.toString());
} else {
trans.info().log(rv.errorString());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
index 856c89dc..6371ebb5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
@@ -45,16 +45,16 @@ public class URPunt extends ActionPuntDAO<UserRole,Void,String> {
}
public Result<Void> exec(AuthzTrans trans, UserRole ur, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would Update User",ur.user(),"and Role", ur.role(), text);
return Result.ok();
} else {
Result<List<Data>> read = q.userRoleDAO.read(trans, ur.user(), ur.role());
- if(read.isOK()) {
- for(UserRoleDAO.Data data : read.value) {
+ if (read.isOK()) {
+ for (UserRoleDAO.Data data : read.value) {
Date from = data.expires;
data.expires = puntDate(from);
- if(data.expires.compareTo(from)<=0) {
+ if (data.expires.compareTo(from)<=0) {
trans.debug().printf("Error: %s is same or before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
} else {
trans.info().log("Updating User",ur.user(),"and Role", ur.role(), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires), text);
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 94c709b3..a4c4efbc 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
@@ -70,19 +70,19 @@ public class Approval implements CacheChange.Data {
}
public static String roleFromMemo(String memo) {
- if(memo==null) {
+ if (memo==null) {
return null;
}
int first = memo.indexOf('\'');
- if(first>=0) {
+ if (first>=0) {
int second = memo.indexOf('\'', ++first);
- if(second>=0) {
+ if (second>=0) {
String role = memo.substring(first, second);
- if(memo.startsWith(RE_VALIDATE_ADMIN)) {
+ if (memo.startsWith(RE_VALIDATE_ADMIN)) {
return role + ".admin";
- } else if(memo.startsWith(RE_VALIDATE_OWNER)) {
+ } else if (memo.startsWith(RE_VALIDATE_OWNER)) {
return role + ".owner";
- } else if(memo.startsWith(RE_APPROVAL_IN_ROLE)) {
+ } else if (memo.startsWith(RE_APPROVAL_IN_ROLE)) {
return role;
}
}
@@ -106,14 +106,14 @@ public class Approval implements CacheChange.Data {
try {
List<Approval> ln;
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
try {
Approval app = creator.create(row);
String person = app.getApprover();
- if(person!=null) {
+ if (person!=null) {
ln = byApprover.get(person);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byApprover.put(app.getApprover(), ln);
}
@@ -122,18 +122,18 @@ public class Approval implements CacheChange.Data {
person = app.getUser();
- if(person!=null) {
+ if (person!=null) {
ln = byUser.get(person);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byUser.put(app.getUser(), ln);
}
ln.add(app);
}
UUID ticket = app.getTicket();
- if(ticket!=null) {
+ if (ticket!=null) {
ln = byTicket.get(ticket);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
byTicket.put(app.getTicket(), ln);
}
@@ -152,25 +152,25 @@ public class Approval implements CacheChange.Data {
@Override
public void expunge() {
List<Approval> la = byApprover.get(getApprover());
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
la = byUser.get(getUser());
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
UUID ticket = this.add==null?null:this.add.ticket;
- if(ticket!=null) {
+ if (ticket!=null) {
la = byTicket.get(this.add.ticket);
- if(la!=null) {
+ if (la!=null) {
la.remove(this);
}
}
}
public void update(AuthzTrans trans, ApprovalDAO apprDAO, boolean dryRun) {
- if(dryRun) {
+ if (dryRun) {
trans.info().printf("Would update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
} else {
trans.info().printf("Update Approval %s, %s, last_notified %s",add.id,add.status,add.last_notified);
@@ -272,11 +272,11 @@ public class Approval implements CacheChange.Data {
}
public void delayDelete(AuthzTrans trans, ApprovalDAO ad, boolean dryRun, String text) {
- if(dryRun) {
+ if (dryRun) {
trans.info().log(text,"- Would Delete: Approval",getId(),"on ticket",getTicket(),"for",getApprover());
} else {
Result<Void> rv = ad.delete(trans, add, false);
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log(text,"- Deleted: Approval",getId(),"on ticket",getTicket(),"for",getApprover());
cache.delayedDelete(this);
} else {
@@ -295,8 +295,8 @@ public class Approval implements CacheChange.Data {
}
public static void delayDelete(AuthzTrans noAvg, ApprovalDAO apprDAO, boolean dryRun, List<Approval> list, String text) {
- if(list!=null) {
- for(Approval a : list) {
+ if (list!=null) {
+ for (Approval a : list) {
a.delayDelete(noAvg, apprDAO, dryRun,text);
}
}
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 1adc3d08..1407bdd0 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
@@ -44,10 +44,10 @@ public class CacheChange<T extends CacheChange.Data> {
}
public final void resetLocalData() {
- if(removed==null || removed.isEmpty()) {
+ if (removed==null || removed.isEmpty()) {
return;
}
- for(T t : removed) {
+ for (T t : removed) {
t.expunge();
}
removed.clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
index 11580b80..a3eb8363 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
@@ -29,7 +29,7 @@ public abstract class Creator<T> {
public String query(String where) {
StringBuilder sb = new StringBuilder(select());
- if(where!=null) {
+ if (where!=null) {
sb.append(" WHERE ");
sb.append(where);
}
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 4013f193..2f6ed415 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
@@ -71,20 +71,20 @@ public class Cred {
public Date last(final int ... types) {
Date last = null;
- for(Instance i : instances) {
- if(types.length>0) { // filter by types, if requested
+ for (Instance i : instances) {
+ if (types.length>0) { // filter by types, if requested
boolean quit = true;
- for(int t : types) {
- if(t==i.type) {
+ for (int t : types) {
+ if (t==i.type) {
quit=false;
break;
}
}
- if(quit) {
+ if (quit) {
continue;
}
}
- if(last==null || i.expires.after(last)) {
+ if (last==null || i.expires.after(last)) {
last = i.expires;
}
}
@@ -94,7 +94,7 @@ public class Cred {
public Set<Integer> types() {
Set<Integer> types = new HashSet<>();
- for(Instance i : instances) {
+ for (Instance i : instances) {
types.add(i.type);
}
return types;
@@ -129,42 +129,42 @@ public class Cred {
String id;
tt = trans.start("Load Credentials", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++count;
row = iter.next();
id = row.getString(0);
type = row.getInt(1);
- if(types.length>0) { // filter by types, if requested
+ if (types.length>0) { // filter by types, if requested
boolean quit = true;
- for(int t : types) {
- if(t==type) {
+ for (int t : types) {
+ if (t==type) {
quit=false;
break;
}
}
- if(quit) {
+ if (quit) {
continue;
}
}
Cred cred = data.get(id);
- if(cred==null) {
+ if (cred==null) {
cred = new Cred(id);
data.put(id, cred);
}
cred.instances.add(new Instance(type, row.getTimestamp(2), row.getInt(3), row.getLong(4)/1000));
List<Cred> lscd = byNS.get(cred.ns);
- if(lscd==null) {
+ if (lscd==null) {
byNS.put(cred.ns, (lscd=new ArrayList<>()));
}
boolean found = false;
- for(Cred c : lscd) {
- if(c.id.equals(cred.id)) {
+ for (Cred c : lscd) {
+ if (c.id.equals(cred.id)) {
found=true;
break;
}
}
- if(!found) {
+ if (!found) {
lscd.add(cred);
}
}
@@ -184,7 +184,7 @@ public class Cred {
*/
public static CredCount count(int numbuckets) {
CredCount cc = new CredCount(numbuckets);
- for(Cred c : data.values()) {
+ for (Cred c : data.values()) {
for (Instance ci : c.instances) {
cc.inc(ci.type,ci.written, ci.expires);
}
@@ -228,7 +228,7 @@ public class Cred {
gc.set(GregorianCalendar.SECOND,0);
gc.set(GregorianCalendar.MILLISECOND,0);
gc.add(GregorianCalendar.MILLISECOND, -1); // last milli of month
- for(int i=1;i<numbuckets;++i) {
+ for (int i=1;i<numbuckets;++i) {
dates[i] = gc.getTime();
gc.add(GregorianCalendar.MONTH, -1);
}
@@ -236,14 +236,14 @@ public class Cred {
}
public void inc(int type, Date start, Date expires) {
- for(int i=0;i<dates.length-1;++i) {
- if(start.before(dates[i])) {
- if(type==CredDAO.CERT_SHA256_RSA) {
- if(start.after(dates[i+1])) {
+ for (int i=0;i<dates.length-1;++i) {
+ if (start.before(dates[i])) {
+ if (type==CredDAO.CERT_SHA256_RSA) {
+ if (start.after(dates[i+1])) {
++x509Added[i];
}
}
- if(expires.after(dates[i])) {
+ if (expires.after(dates[i])) {
switch(type) {
case CredDAO.RAW:
++raw[i];
@@ -276,7 +276,7 @@ public class Cred {
public String toString() {
StringBuilder sb = new StringBuilder(id);
sb.append('[');
- for(Instance i : instances) {
+ for (Instance i : instances) {
sb.append('{');
sb.append(i.type);
sb.append(",\"");
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
index 0c618eeb..8a11479e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
@@ -98,15 +98,15 @@ public class Future implements CacheChange.Data, Comparable<Future> {
int count = 0;
tt = trans.start("Process Futures", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
Future f = creator.create(row);
data.put(f.fdd.id,f);
- if(f.role==null) {
+ if (f.role==null) {
continue;
}
List<Future> lf = byRole.get(f.role);
- if(lf==null) {
+ if (lf==null) {
lf = new ArrayList<>();
byRole.put(f.role,lf);
}
@@ -148,16 +148,16 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public Result<Void> delayedDelete(AuthzTrans trans, FutureDAO fd, boolean dryRun, String text) {
Result<Void> rv;
- if(dryRun) {
+ if (dryRun) {
trans.info().log(text,"- Would Delete: ",fdd.id,fdd.memo,"expiring on",Chrono.dateOnlyStamp(fdd.expires));
rv = Result.ok();
} else {
rv = fd.delete(trans, fdd, true); // need to read for undelete
- if(rv.isOK()) {
+ if (rv.isOK()) {
trans.info().log(text, "- Deleted:",fdd.id,fdd.memo,"expiring on",Chrono.dateOnlyStamp(fdd.expires));
cache.delayedDelete(this);
} else {
- if(rv.status!=6) {
+ if (rv.status!=6) {
trans.info().log(text,"- Failed to Delete Future", fdd.id);
}
}
@@ -171,9 +171,9 @@ public class Future implements CacheChange.Data, Comparable<Future> {
@Override
public void expunge() {
data.remove(fdd.id);
- if(role!=null) {
+ if (role!=null) {
List<Future> lf = byRole.get(role);
- if(lf!=null) {
+ if (lf!=null) {
lf.remove(this);
}
}
@@ -181,7 +181,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
@Override
public int compareTo(Future o) {
- if(o==null) {
+ if (o==null) {
return -1;
}
return fdd.id.compareTo(o.fdd.id);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
index c0841590..cffb55a5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
@@ -84,7 +84,7 @@ public class History {
Row row;
tt = trans.start("Load History", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++count;
row = iter.next();
loader.exec(creator.create(row));
@@ -151,9 +151,9 @@ public class History {
ByteBuffer bb = row.getBytes(3);
sb.setLength(0);
- if(bb!=null && bb.hasRemaining()) {
+ if (bb!=null && bb.hasRemaining()) {
sb.append("0x");
- while(bb.hasRemaining()) {
+ while (bb.hasRemaining()) {
sb.append(String.format("%02x",bb.get()));
}
bb.flip();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
index 60b34af9..5fb3e5dc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
@@ -58,7 +58,7 @@ public class InputIterator implements Iterable<String> {
@Override
public String next() {
- if(!hasNext()) {
+ if (!hasNext()) {
throw new NoSuchElementException();
}
return input;
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 afa68c08..8eecb656 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
@@ -64,7 +64,7 @@ public class MiscID {
* @throws IllegalArgumentException
*/
public void set(String row []) throws BatchException {
- if(row.length<4) {throw new BatchException("Row of MiscID_XRef is too short");}
+ if (row.length<4) {throw new BatchException("Row of MiscID_XRef is too short");}
id = row[0];
sponsor = row[1];
created = row[2];
@@ -106,7 +106,7 @@ public class MiscID {
try {
tt = trans.start("Load Map", Env.SUB);
try {
- for( Row row : results.all()) {
+ for ( Row row : results.all()) {
MiscID miscID = new MiscID();
miscID.set(row);
data.put(miscID.id,miscID);
@@ -133,7 +133,7 @@ public class MiscID {
*/
@Override
public boolean equals(Object obj) {
- if(obj!=null && obj instanceof MiscID) {
+ if (obj!=null && obj instanceof MiscID) {
return id.equals(((MiscID)obj).id);
}
return false;
@@ -156,12 +156,12 @@ public class MiscID {
public StringBuilder updateStmt(MiscID source) {
StringBuilder sb = null;
- if(id.equals(source.id)) {
+ if (id.equals(source.id)) {
sb = addField(sb,"sponser",sponsor,source.sponsor);
sb = addField(sb,"created",created,source.created);
sb = addField(sb,"renewal",renewal,source.renewal);
}
- if(sb!=null) {
+ if (sb!=null) {
sb.append(" WHERE id='");
sb.append(id);
sb.append('\'');
@@ -170,8 +170,8 @@ public class MiscID {
}
private StringBuilder addField(StringBuilder sb, String name, String a, String b) {
- if(!a.equals(b)) {
- if(sb==null) {
+ if (!a.equals(b)) {
+ if (sb==null) {
sb = new StringBuilder("UPDATE authz.miscid SET ");
} else {
sb.append(',');
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 e9321f5f..e15a6bc2 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
@@ -42,15 +42,15 @@ public class MonthData {
public MonthData(String env) throws IOException {
f = new File("Monthly"+env+".dat");
- if(f.exists()) {
+ if (f.exists()) {
BufferedReader br = new BufferedReader(new FileReader(f));
try {
String line;
String[] split;
- while((line=br.readLine())!=null) {
- if(!line.startsWith("#")) {
+ while ((line=br.readLine())!=null) {
+ if (!line.startsWith("#")) {
split = Split.split(',', line);
- if(split.length==5) {
+ if (split.length==5) {
add(Integer.parseInt(split[0]),split[1],
Integer.parseInt(split[2]),
Integer.parseInt(split[3]),
@@ -67,7 +67,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) {
+ if (row==null) {
data.put(yr_mon, (row=new HashSet<>()));
}
row.add(new Row(target,total,adds,drops));
@@ -101,14 +101,14 @@ public class MonthData {
}
public void write() throws IOException {
- if(f.exists()) {
+ if (f.exists()) {
File bu = new File(f.getName()+".bak");
f.renameTo(bu);
}
PrintStream ps = new PrintStream(f);
try {
- for( Entry<Integer, Set<Row>> rows : data.entrySet()) {
- for(Row row : rows.getValue()) {
+ for ( Entry<Integer, Set<Row>> rows : data.entrySet()) {
+ for (Row row : rows.getValue()) {
ps.printf("%d,%s,%d,%d,%d\n",rows.getKey(),row.target,row.total,row.adds,row.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 a2833e55..5692d116 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
@@ -81,7 +81,7 @@ public class NS implements Comparable<NS> {
Row row;
tt = trans.start("Load Namespaces", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
NS ns = creator.create(row);
data.put(ns.name,ns);
@@ -143,9 +143,9 @@ public class NS implements Comparable<NS> {
}
}
public static NSSplit deriveParent(String dotted) {
- if(dotted==null)return null;
- for(int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
- if(data.get(dotted.substring(0, idx))!=null) {
+ if (dotted==null)return null;
+ for (int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
+ if (data.get(dotted.substring(0, idx))!=null) {
return new NSSplit(dotted,idx);
}
}
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 abfd1ca4..b178c377 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
@@ -61,8 +61,8 @@ public class Notification {
}
public static TYPE get(int idx) {
- for(TYPE nt : TYPE.values()) {
- if(idx==nt.type) {
+ for (TYPE nt : TYPE.values()) {
+ if (idx==nt.type) {
return nt;
}
}
@@ -107,12 +107,12 @@ public class Notification {
tt = trans.start("Process Notify", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
try {
Notification not = creator.create(row);
List<Notification> ln = data.get(not.user);
- if(ln==null) {
+ if (ln==null) {
ln = new ArrayList<>();
data.put(not.user, ln);
}
@@ -129,9 +129,9 @@ public class Notification {
public static Notification get(String user, TYPE type) {
List<Notification> ln = data.get(user);
- if(ln!=null) {
- for(Notification n : ln) {
- if(type.equals(n.type)) {
+ if (ln!=null) {
+ for (Notification n : ln) {
+ if (type.equals(n.type)) {
return n;
}
}
@@ -148,7 +148,7 @@ public class Notification {
public Notification create(Row row) {
int idx =row.getInt(1);
TYPE type = TYPE.get(idx);
- if(type==null) {
+ if (type==null) {
return null;
}
return new Notification(row.getString(0), type, row.getTimestamp(2), row.getInt(3));
@@ -166,11 +166,11 @@ public class Notification {
}
public int checksum() {
- if(msg==null) {
+ if (msg==null) {
current=0;
- } else if(current==0) {
- for(String l : msg.lines) {
- for(byte b : l.getBytes()) {
+ } else if (current==0) {
+ for (String l : msg.lines) {
+ for (byte b : l.getBytes()) {
current+=b;
}
}
@@ -180,7 +180,7 @@ public class Notification {
public boolean update(AuthzTrans trans, Session session, boolean dryRun) {
checksum();
- if(last==null || current==0 || current!=checksum) {
+ if (last==null || current==0 || current!=checksum) {
last = now;
current = checksum();
String update = "UPDATE authz.notify SET " +
@@ -192,7 +192,7 @@ public class Notification {
"' AND type=" +
type.idx() +
";";
- if(dryRun) {
+ if (dryRun) {
trans.info().log("Would",update);
} else {
session.execute(update);
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 d980bcc2..a3354f38 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
@@ -76,20 +76,20 @@ public class NsAttrib {
tt = trans.start("Process NsAttributes", Env.SUB);
try {
- for(Row row : results.all()) {
+ for (Row row : results.all()) {
++count;
NsAttrib ur = creator.create(row);
data.add(ur);
List<NsAttrib> lna = byKey.get(ur.key);
- if(lna==null) {
+ if (lna==null) {
lna = new ArrayList<>();
byKey.put(ur.key, lna);
}
lna.add(ur);
lna = byNS.get(ur.ns);
- if(lna==null) {
+ if (lna==null) {
lna = new ArrayList<>();
byNS.put(ur.ns, lna);
}
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 799ce4df..ce22724b 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
@@ -47,21 +47,21 @@ public class Perm implements Comparable<Perm> {
public final Set<String> roles;
public String encode() {
- if(encode == null) {
+ if (encode == null) {
encode = ns + '|' + type + '|' + instance + '|' + action;
}
return encode;
}
public String fullType() {
- if(fullType==null) {
+ if (fullType==null) {
fullType = ns + '.' + type;
}
return fullType;
}
public String fullPerm() {
- if(fullPerm==null) {
+ if (fullPerm==null) {
fullPerm = ns + '.' + type + '|' + instance + '|' + action;
}
return fullPerm;
@@ -104,7 +104,7 @@ public class Perm implements Comparable<Perm> {
Row row;
tt = trans.start("Load Perms", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
Perm pk = new Perm(
row.getString(0),row.getString(1),row.getString(2),
@@ -164,7 +164,7 @@ public class Perm implements Comparable<Perm> {
}
public static void executeRemove() {
- for(Perm p : deletePerms) {
+ for (Perm p : deletePerms) {
keys.remove(p.encode);
data.remove(p);
}
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 46d3cced..04a5dceb 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
@@ -64,14 +64,14 @@ public class Role implements Comparable<Role> {
}
public String encode() {
- if(encode==null) {
+ if (encode==null) {
encode = ns + '|' + name;
}
return encode;
}
public String fullName() {
- if(full==null) {
+ if (full==null) {
full = ns + '.' + name;
}
return full;
@@ -102,7 +102,7 @@ public class Role implements Comparable<Role> {
Row row;
tt = trans.start("Load Roles", Env.SUB);
try {
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
row = iter.next();
Role rk =new Role(row.getString(0),row.getString(1), row.getString(2),row.getSet(3,String.class));
keys.put(rk.encode(), rk);
@@ -165,7 +165,7 @@ public class Role implements Comparable<Role> {
}
public static void executeRemove() {
- for(Role p : deleteRoles) {
+ for (Role p : deleteRoles) {
keys.remove(p.encode);
data.remove(p);
}
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 fab9233d..762f6c66 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
@@ -143,21 +143,21 @@ public class UserRole implements Cloneable, CacheChange.Data {
private static void iterateResults(Creator<UserRole> creator, Iterator<Row> iter ) {
Row row;
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
++totalLoaded;
row = iter.next();
UserRole ur = creator.create(row);
data.add(ur);
List<UserRole> lur = byUser.get(ur.urdd.user);
- if(lur==null) {
+ if (lur==null) {
lur = new ArrayList<>();
byUser.put(ur.urdd.user, lur);
}
lur.add(ur);
lur = byRole.get(ur.urdd.role);
- if(lur==null) {
+ if (lur==null) {
lur = new ArrayList<>();
byRole.put(ur.urdd.role, lur);
}
@@ -178,12 +178,12 @@ public class UserRole implements Cloneable, CacheChange.Data {
data.remove(this);
List<UserRole> lur = byUser.get(urdd.user);
- if(lur!=null) {
+ if (lur!=null) {
lur.remove(this);
}
lur = byRole.get(urdd.role);
- if(lur!=null) {
+ if (lur!=null) {
lur.remove(this);
}
}
@@ -245,10 +245,10 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static UserRole get(String u, String r) {
List<UserRole> lur = byUser.get(u);
- if(lur!=null) {
- for(UserRole ur : lur) {
+ if (lur!=null) {
+ for (UserRole ur : lur) {
- if(ur.urdd.role.equals(r)) {
+ if (ur.urdd.role.equals(r)) {
return ur;
}
}
@@ -260,7 +260,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
// We write to a file, and validate. If the size is iffy, we email Support
public void delayDelete(AuthzTrans trans, String text, boolean dryRun) {
String dt = Chrono.dateTime(urdd.expires);
- if(dryRun) {
+ if (dryRun) {
trans.info().printf(LOG_FMT,text,"Would Delete",urdd.user,urdd.role,urdd.ns,urdd.rname,dt);
} else {
trans.info().printf(LOG_FMT,text,"Staged Deletion",urdd.user,urdd.role,urdd.ns,urdd.rname,dt);
@@ -289,7 +289,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
public static void actuateDeletionNow(AuthzTrans trans, URDelete directDel) {
- for(UserRole ur : cache.getRemoved()) {
+ for (UserRole ur : cache.getRemoved()) {
directDel.exec(trans, ur, "Actuating UserRole Deletion");
}
cache.getRemoved().clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
index 4555857a..f4a0f37c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/javax/JavaxMailer.java
@@ -150,7 +150,7 @@ public class JavaxMailer implements Mailer {
try{
addressArray[count] = new InternetAddress(addr);
count++;
- }catch(Exception e){
+ } catch (Exception e){
throw new OrganizationException("Failed to parse the email address "+ addr +": "+e.getMessage());
}
}
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 886bd56a..d34f9248 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
@@ -76,20 +76,20 @@ public class ExpiringNext extends Batch {
List<String> expiring = new ArrayList<>();
trans.info().log("Checking for Expired UserRoles");
- for(UserRole ur : UserRole.getData()) {
- if(ur.expires().after(now)) {
- if(ur.expires().before(twoWeeks)) {
+ for (UserRole ur : UserRole.getData()) {
+ if (ur.expires().after(now)) {
+ if (ur.expires().before(twoWeeks)) {
expiring.add(Chrono.dateOnlyStamp(ur.expires()) + ":\t" + ur.user() + '\t' + ur.role());
}
- if(ur.expires().before(earliestUR)) {
+ if (ur.expires().before(earliestUR)) {
earliestUR = ur.expires();
}
}
}
- if(expiring.size()>0) {
+ if (expiring.size()>0) {
Collections.sort(expiring,Collections.reverseOrder());
- for(String s : expiring) {
+ for (String s : expiring) {
System.err.print('\t');
System.err.println(s);
}
@@ -101,30 +101,30 @@ public class ExpiringNext extends Batch {
expiring.clear();
trans.info().log("Checking for Expired Credentials");
- for( Cred creds : Cred.data.values()) {
+ for ( Cred creds : Cred.data.values()) {
Instance lastInstance=null;
- for(Instance inst : creds.instances) {
- if(inst.type==CredDAO.BASIC_AUTH || inst.type==CredDAO.BASIC_AUTH_SHA256) {
- if(lastInstance == null || inst.expires.after(lastInstance.expires)) {
+ for (Instance inst : creds.instances) {
+ if (inst.type==CredDAO.BASIC_AUTH || inst.type==CredDAO.BASIC_AUTH_SHA256) {
+ if (lastInstance == null || inst.expires.after(lastInstance.expires)) {
lastInstance = inst;
}
}
}
- if(lastInstance!=null) {
- if(lastInstance.expires.after(now)) {
- if(lastInstance.expires.before(twoWeeks)) {
+ if (lastInstance!=null) {
+ if (lastInstance.expires.after(now)) {
+ if (lastInstance.expires.before(twoWeeks)) {
expiring.add(Chrono.dateOnlyStamp(lastInstance.expires) + ": \t" + creds.id);
}
}
- if(lastInstance.expires.before(earliestCred)) {
+ if (lastInstance.expires.before(earliestCred)) {
earliestCred = lastInstance.expires;
}
}
}
- if(expiring.size()>0) {
+ if (expiring.size()>0) {
Collections.sort(expiring,Collections.reverseOrder());
- for(String s : expiring) {
+ for (String s : expiring) {
System.err.print('\t');
System.err.println(s);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
index 868811a3..e9f0e726 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Expiring.java
@@ -117,7 +117,7 @@ public class Expiring extends Batch {
}
File data_dir = new File(env.getProperty("aaf_data_dir"));
- if(!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
+ if (!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
throw new IOException("Cannot read/write to Data Directory "+ data_dir.getCanonicalPath() + ": EXITING!!!");
}
UserRole.setDeleteStream(
@@ -137,7 +137,7 @@ public class Expiring extends Batch {
email.preamble("Expiring Process Alert for %s",batchEnv);
email.signature("Sincerely,\nAAF Expiring Batch Process\n");
String address = env.getProperty("ALERT_TO_ADDRESS");
- if(address==null) {
+ if (address==null) {
throw new APIException("ALERT_TO_ADDRESS property is required");
}
email.addTo(address);
@@ -169,30 +169,30 @@ public class Expiring extends Batch {
// Clean out Approvals UserRoles are fixed up.
String memo;
- for(List<Approval> la : Approval.byUser.values()) {
- for(Approval a : la ) {
+ for (List<Approval> la : Approval.byUser.values()) {
+ for (Approval a : la ) {
memo = a.getMemo();
- if(memo!=null && (memo.contains("Re-Approval") || memo.contains("Re-Validate"))) {
+ if (memo!=null && (memo.contains("Re-Approval") || memo.contains("Re-Validate"))) {
String role = a.getRole();
- if(role!=null) {
+ if (role!=null) {
UserRole ur = UserRole.get(a.getUser(), a.getRole());
Future f=null;
- if(ur!=null) {
- if(ur.expires().after(future)) { // no need for Approval anymore
+ if (ur!=null) {
+ if (ur.expires().after(future)) { // no need for Approval anymore
a.delayDelete(noAvg, apprDAO, dryRun, "User Role already Extended");
UUID tkt = a.getTicket();
- if(tkt!=null && Future.data.containsKey(tkt)) {
+ if (tkt!=null && Future.data.containsKey(tkt)) {
f = Future.data.get(a.getTicket());
}
}
} else {
a.delayDelete(noAvg, apprDAO, dryRun, "User Role does not exist");
UUID tkt = a.getTicket();
- if(tkt !=null && Future.data.containsKey(tkt)) {
+ if (tkt !=null && Future.data.containsKey(tkt)) {
f = Future.data.get(a.getTicket());
}
}
- if(f!=null) {
+ if (f!=null) {
f.delayedDelete(noAvg, futureDAO, dryRun, "Approvals removed");
}
}
@@ -212,12 +212,12 @@ public class Expiring extends Batch {
tt = trans.start("Delete old Futures", Env.REMOTE);
trans.info().log("### Running Future Execution on ",Future.data.size(), "Items");
// Execute any Futures waiting
- for(Future f : Future.data.values()) {
- if(f.memo().contains("Re-Approval") || f.memo().contains("Re-Validate")) {
+ for (Future f : Future.data.values()) {
+ if (f.memo().contains("Re-Approval") || f.memo().contains("Re-Validate")) {
List<Approval> la = Approval.byTicket.get(f.id());
- if(la!=null) {
+ if (la!=null) {
Result<OP_STATUS> ruf = urFutureApproveExec.exec(noAvg,la,f);
- if(ruf.isOK()) {
+ if (ruf.isOK()) {
switch(ruf.value) {
case P:
break;
@@ -246,11 +246,11 @@ public class Expiring extends Batch {
String expiredBeforeNow = "Expired before " + tooLate;
String expiredAfterFuture = "Expired after " + future;
try {
- for(Future f : Future.data.values()) {
- if(f.expires().before(tooLate)) {
+ for (Future f : Future.data.values()) {
+ if (f.expires().before(tooLate)) {
f.delayedDelete(noAvg,futureDAO,dryRun, expiredBeforeNow);
Approval.delayDelete(noAvg, apprDAO, dryRun, Approval.byTicket.get(f.id()), expiredBeforeNow);
- } else if(f.expires().after(future)) {
+ } else if (f.expires().after(future)) {
f.delayedDelete(noAvg,futureDAO,dryRun, expiredAfterFuture);
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), expiredAfterFuture);
}
@@ -268,19 +268,19 @@ public class Expiring extends Batch {
trans.info().log("### Checking Approvals valid (",Approval.byApprover.size(),"Items)");
// Make sure users of Approvals are still valid
- for(List<Approval> lapp : Approval.byTicket.values()) {
- for(Approval app : lapp) {
+ for (List<Approval> lapp : Approval.byTicket.values()) {
+ for (Approval app : lapp) {
Future f;
- if(app.getTicket()==null) {
+ if (app.getTicket()==null) {
f = null;
} else {
f = Future.data.get(app.getTicket());
- if(Future.pendingDelete(f)) {
+ if (Future.pendingDelete(f)) {
f=null;
}
}
String msg;
- if(f!=null && app.getRole()!=null && Role.byName.get(app.getRole())==null) {
+ if (f!=null && app.getRole()!=null && Role.byName.get(app.getRole())==null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg="Role '" + app.getRole() + "' no longer exists");
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
continue;
@@ -288,7 +288,7 @@ public class Expiring extends Batch {
switch(app.getStatus()) {
case "pending":
- if(f==null) {
+ if (f==null) {
app.delayDelete(noAvg,apprDAO, isDryRun(), "ticketDeleted");
continue;
}
@@ -296,19 +296,19 @@ public class Expiring extends Batch {
case "owner":
boolean anOwner=false;
String approle = app.getRole();
- if(approle!=null) {
+ if (approle!=null) {
Role role = Role.byName.get(approle);
- if(role==null) {
+ if (role==null) {
app.delayDelete(noAvg, apprDAO, dryRun, "Role No Longer Exists");
continue;
} else {
// Make sure Owner Role exists
String owner = role.ns + ".owner";
- if(Role.byName.containsKey(owner)) {
+ if (Role.byName.containsKey(owner)) {
List<UserRole> lur = UserRole.getByRole().get(owner);
- if(lur != null) {
- for(UserRole ur : lur) {
- if(ur.user().equals(app.getApprover())) {
+ if (lur != null) {
+ for (UserRole ur : lur) {
+ if (ur.user().equals(app.getApprover())) {
anOwner = true;
break;
}
@@ -316,7 +316,7 @@ public class Expiring extends Batch {
}
}
}
- if(!anOwner) {
+ if (!anOwner) {
app.delayDelete(noAvg, apprDAO, dryRun, "No longer Owner");
}
@@ -325,14 +325,14 @@ public class Expiring extends Batch {
case "supervisor":
try {
Identity identity = org.getIdentity(noAvg, app.getUser());
- if(identity==null) {
- if(f!=null) {
+ if (identity==null) {
+ if (f!=null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg = app.getUser() + " is no longer associated with " + org.getName());
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
}
} else {
- if(!app.getApprover().equals(identity.responsibleTo().fullID())) {
- if(f!=null) {
+ if (!app.getApprover().equals(identity.responsibleTo().fullID())) {
+ if (f!=null) {
f.delayedDelete(noAvg,futureDAO,dryRun,msg = app.getApprover() + " is no longer a Supervisor of " + app.getUser());
Approval.delayDelete(noAvg,apprDAO,dryRun, Approval.byTicket.get(f.id()), msg);
}
@@ -360,9 +360,9 @@ public class Expiring extends Batch {
// Run for User Roles
trans.info().log("Checking for Expired User Roles");
try {
- for(UserRole ur : UserRole.getData()) {
- if(org.getIdentity(noAvg, ur.user())==null) { // if not part of Organization;
- if(isSpecial(ur.user())) {
+ for (UserRole ur : UserRole.getData()) {
+ if (org.getIdentity(noAvg, ur.user())==null) { // if not part of Organization;
+ if (isSpecial(ur.user())) {
trans.info().log(ur.user(),"is not part of organization, but may not be deleted");
} else {
ur.delayDelete(noAvg, "Not Part of Organization", dryRun);
@@ -370,16 +370,16 @@ public class Expiring extends Batch {
++delayedURDeletes;
}
} else {
- if(NS.data.get(ur.ns())==null) {
+ if (NS.data.get(ur.ns())==null) {
ur.delayDelete(noAvg,"Namespace " + ur.ns() + " does not exist.",dryRun);
++delayedURDeletes;
++deleted;
- } else if(!Role.byName.containsKey(ur.role())) {
+ } else if (!Role.byName.containsKey(ur.role())) {
ur.delayDelete(noAvg,"Role " + ur.role() + " does not exist.",dryRun);
++deleted;
++delayedURDeletes;
- } else if(ur.expires().before(tooLate)) {
- if("owner".equals(ur.rname())) { // don't delete Owners, even if Expired
+ } else if (ur.expires().before(tooLate)) {
+ if ("owner".equals(ur.rname())) { // don't delete Owners, even if Expired
urPrint.exec(noAvg,ur,"Owner Expired (but not deleted)");
} else {
// In this case, when UR is expired, not dependent on other lookups, we delete straight out.
@@ -387,16 +387,16 @@ public class Expiring extends Batch {
++deleted;
}
//trans.logAuditTrail(trans.info());
- } else if(ur.expires().before(future) && ur.expires().after(now)) {
+ } else if (ur.expires().before(future) && ur.expires().after(now)) {
++count;
// Is there an Approval set already
boolean needNew = true;
- if(ur.role()!=null && ur.user()!=null) {
+ if (ur.role()!=null && ur.user()!=null) {
List<Approval> abm = Approval.byUser.get(ur.user());
- if(abm!=null) {
- for(Approval a : abm) {
- if(a.getOperation().equals(FUTURE_OP.A.name()) && ur.role().equals(a.getRole())) {
- if(Future.data.get(a.getTicket())!=null) {
+ if (abm!=null) {
+ for (Approval a : abm) {
+ if (a.getOperation().equals(FUTURE_OP.A.name()) && ur.role().equals(a.getRole())) {
+ if (Future.data.get(a.getTicket())!=null) {
needNew = false;
break;
}
@@ -404,7 +404,7 @@ public class Expiring extends Batch {
}
}
}
- if(needNew) {
+ if (needNew) {
urFutureApprove.exec(noAvg, ur,"");
}
}
@@ -418,10 +418,10 @@ public class Expiring extends Batch {
}
// Actualize UR Deletes, or send Email
- if(UserRole.sizeForDeletion()>0) {
+ if (UserRole.sizeForDeletion()>0) {
count+=UserRole.sizeForDeletion();
double onePercent = 0.01;
- if(((double)UserRole.sizeForDeletion())/UserRole.getData().size() > onePercent) {
+ if (((double)UserRole.sizeForDeletion())/UserRole.getData().size() > onePercent) {
Message msg = new Message();
try {
msg.line("Found %d of %d UserRoles marked for Deletion in file %s",
@@ -448,7 +448,7 @@ public class Expiring extends Batch {
}
}
}
- if(count>0) {
+ if (count>0) {
String str = String.format("%d UserRoles modified or deleted", count);
cacheTouch.exec(trans, "user_role", str);
}
@@ -460,20 +460,20 @@ public class Expiring extends Batch {
try {
CredDAO.Data crd = new CredDAO.Data();
Date last = null;
- for( Cred creds : Cred.data.values()) {
+ for ( Cred creds : Cred.data.values()) {
crd.id = creds.id;
- for(int type : creds.types()) {
+ for (int type : creds.types()) {
crd.type = type;
- for( Instance inst : creds.instances) {
- if(inst.expires.before(tooLate)) {
+ for ( Instance inst : creds.instances) {
+ if (inst.expires.before(tooLate)) {
crd.expires = inst.expires;
crDelete.exec(noAvg, crd,"Expired before " + tooLate);
- } else if(last==null || inst.expires.after(last)) {
+ } else if (last==null || inst.expires.after(last)) {
last = inst.expires;
}
}
- if(last!=null) {
- if(last.before(future)) {
+ if (last!=null) {
+ if (last.before(future)) {
crd.expires = last;
crPrint.exec(noAvg, crd,"");
++count;
@@ -483,7 +483,7 @@ public class Expiring extends Batch {
}
} finally {
String str = String.format("Found %d current creds expiring before %s", count, Chrono.dateOnlyStamp(future));
- if(count>0) {
+ if (count>0) {
cacheTouch.exec(trans, "cred", str);
}
}
@@ -493,8 +493,8 @@ public class Expiring extends Batch {
@Override
protected void _close(AuthzTrans trans) {
aspr.info("End " + this.getClass().getSimpleName() + " processing" );
- for(Action<?,?,?> action : new Action<?,?,?>[] {crDelete}) {
- if(action instanceof ActionDAO) {
+ for (Action<?,?,?> action : new Action<?,?,?>[] {crDelete}) {
+ if (action instanceof ActionDAO) {
((ActionDAO<?,?,?>)action).close(trans);
}
}
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 f9797c86..cab612eb 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
@@ -70,7 +70,7 @@ public class ExpiringP2 extends Batch {
cacheTouch = new CacheTouch(trans,urDelete);
File data_dir = new File(env.getProperty("aaf_data_dir"));
- if(!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
+ if (!data_dir.exists() || !data_dir.canWrite() || !data_dir.canRead()) {
throw new IOException("Cannot read/write to Data Directory "+ data_dir.getCanonicalPath() + ": EXITING!!!");
}
urDeleteF = new BufferedReader(new FileReader(new File(data_dir,"UserRoleDeletes.dat")));
@@ -92,10 +92,10 @@ public class ExpiringP2 extends Batch {
Map<String,Count> tally = new HashMap<>();
int count=0;
try {
- while((line=urDeleteF.readLine())!=null) {
- if(line.startsWith("#")) {
+ while ((line=urDeleteF.readLine())!=null) {
+ if (line.startsWith("#")) {
Count cnt = tally.get(line);
- if(cnt==null) {
+ if (cnt==null) {
tally.put(line, cnt=new Count());
}
cnt.inc();
@@ -114,11 +114,11 @@ public class ExpiringP2 extends Batch {
}
System.out.println("Tallies of UserRole Deletions");
- for(Entry<String, Count> es : tally.entrySet()) {
+ for (Entry<String, Count> es : tally.entrySet()) {
System.out.printf(" %6d\t%20s\n", es.getValue().cnt,es.getKey());
}
} finally {
- if(cacheTouch!=null && count>0) {
+ if (cacheTouch!=null && count>0) {
cacheTouch.exec(trans, "user_roles", "Removing UserRoles");
}
}
@@ -142,8 +142,8 @@ public class ExpiringP2 extends Batch {
@Override
protected void _close(AuthzTrans trans) {
aspr.info("End " + this.getClass().getSimpleName() + " processing" );
- for(Action<?,?,?> action : new Action<?,?,?>[] {urDelete,cacheTouch}) {
- if(action instanceof ActionDAO) {
+ for (Action<?,?,?> action : new Action<?,?,?>[] {urDelete,cacheTouch}) {
+ if (action instanceof ActionDAO) {
((ActionDAO<?,?,?>)action).close(trans);
}
}
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 8b12399d..50c6dc21 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
@@ -69,7 +69,7 @@ public class NotifyApprovals extends Batch {
session = historyDAO.getSession(trans);
apprDAO = new ApprovalDAO(trans, historyDAO);
futureDAO = new FutureDAO(trans, historyDAO);
- if(isDryRun()) {
+ if (isDryRun()) {
email = new EmailPrint();
maxEmails=3;
} else {
@@ -105,10 +105,10 @@ public class NotifyApprovals extends Batch {
int emailCount = 0;
List<Approval> pending = new ArrayList<>();
boolean isOwner,isSupervisor;
- for(Entry<String, List<Approval>> es : Approval.byApprover.entrySet()) {
+ for (Entry<String, List<Approval>> es : Approval.byApprover.entrySet()) {
isOwner = isSupervisor = false;
String approver = es.getKey();
- if(approver.indexOf('@')<0) {
+ if (approver.indexOf('@')<0) {
approver += org.getRealm();
}
Date latestNotify=null, soonestExpire=null;
@@ -116,28 +116,28 @@ public class NotifyApprovals extends Batch {
GregorianCalendar soonest=new GregorianCalendar();
pending.clear();
- for(Approval app : es.getValue()) {
+ for (Approval app : es.getValue()) {
Future f = app.getTicket()==null?null:Future.data.get(app.getTicket());
- if(f==null) { // only Ticketed Approvals are valid.. the others are records.
+ if (f==null) { // only Ticketed Approvals are valid.. the others are records.
// Approvals without Tickets are no longer valid.
- if("pending".equals(app.getStatus())) {
+ if ("pending".equals(app.getStatus())) {
app.setStatus("lapsed");
app.update(noAvg,apprDAO,dryRun); // obeys dryRun
}
} else {
- if((soonestExpire==null && f.expires()!=null) || (soonestExpire!=null && f.expires()!=null && soonestExpire.before(f.expires()))) {
+ if ((soonestExpire==null && f.expires()!=null) || (soonestExpire!=null && f.expires()!=null && soonestExpire.before(f.expires()))) {
soonestExpire=f.expires();
}
- if("pending".equals(app.getStatus())) {
- if(!isOwner) {
+ if ("pending".equals(app.getStatus())) {
+ if (!isOwner) {
isOwner = "owner".equals(app.getType());
}
- if(!isSupervisor) {
+ if (!isSupervisor) {
isSupervisor = "supervisor".equals(app.getType());
}
- if((latestNotify==null && app.getLast_notified()!=null) ||(latestNotify!=null && app.getLast_notified()!=null && latestNotify.before(app.getLast_notified()))) {
+ if ((latestNotify==null && app.getLast_notified()!=null) ||(latestNotify!=null && app.getLast_notified()!=null && latestNotify.before(app.getLast_notified()))) {
latestNotify=app.getLast_notified();
}
pending.add(app);
@@ -145,29 +145,29 @@ public class NotifyApprovals extends Batch {
}
}
- if(!pending.isEmpty()) {
+ if (!pending.isEmpty()) {
boolean go = false;
- if(latestNotify==null) { // never notified... make it so
+ if (latestNotify==null) { // never notified... make it so
go=true;
} else {
- if(!today.equals(Chrono.dateOnlyStamp(latest))) { // already notified today
+ if (!today.equals(Chrono.dateOnlyStamp(latest))) { // already notified today
latest.setTime(latestNotify);
soonest.setTime(soonestExpire);
int year;
int days = soonest.get(GregorianCalendar.DAY_OF_YEAR)-latest.get(GregorianCalendar.DAY_OF_YEAR);
days+=((year=soonest.get(GregorianCalendar.YEAR))-latest.get(GregorianCalendar.YEAR))*365 +
(soonest.isLeapYear(year)?1:0);
- if(days<7) { // If Expirations get within a Week (or expired), notify everytime.
+ if (days<7) { // If Expirations get within a Week (or expired), notify everytime.
go = true;
}
}
}
- if(go) {
- if(maxEmails>emailCount++) {
+ if (go) {
+ if (maxEmails>emailCount++) {
try {
Organization org = OrganizationFactory.obtain(env, approver);
Identity user = org.getIdentity(noAvg, approver);
- if(user==null) {
+ if (user==null) {
ps.printf("Invalid Identity: %s\n", approver);
} else {
email.clear();
@@ -175,7 +175,7 @@ public class NotifyApprovals extends Batch {
email.addTo(user.email());
msg.line(LINE);
msg.line("Why are you receiving this Notification?\n");
- if(isSupervisor) {
+ if (isSupervisor) {
msg.line("%sYou are the supervisor of one or more employees who need access to tools which are protected by AAF. " +
"Your employees may ask for access to various tools and applications to do their jobs. ASPR requires "
+ "that you are notified and approve their requests. The details of each need is provided when you click "
@@ -183,7 +183,7 @@ public class NotifyApprovals extends Batch {
msg.line("Your participation in this process fulfills the ASPR requirement to re-authorize users in roles on a regular basis.\n\n");
}
- if(isOwner) {
+ if (isOwner) {
msg.line("%sYou are the listed owner of one or more AAF Namespaces. ASPR requires that those responsible for "
+ "applications and their access review them regularly for accuracy. The AAF WIKI page for AT&T is https://wiki.web.att.com/display/aaf. "
+ "More info regarding questions of being a Namespace Owner is available at https://wiki.web.att.com/pages/viewpage.action?pageId=594741363\n",isSupervisor?"2) ":"");
@@ -208,9 +208,9 @@ public class NotifyApprovals extends Batch {
email.msg(msg);
email.exec(noAvg, org,"");
- if(!isDryRun()) {
+ if (!isDryRun()) {
email.log(ps,"NotifyApprovals");
- for(Approval app : pending) {
+ for (Approval app : pending) {
app.setLastNotified(now);
app.update(noAvg, apprDAO, dryRun);
}
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 ab386c56..b4631f66 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
@@ -87,10 +87,10 @@ public class NotifyCredExpiring extends Batch {
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("batch:NotifyCredExpiring"));
- if((supportEmailAddr = env.getProperty("mailFromUserId"))==null) {
+ if ((supportEmailAddr = env.getProperty("mailFromUserId"))==null) {
throw new APIException("mailFromUserId property must be set");
}
- if(isDryRun()) {
+ if (isDryRun()) {
email = new EmailPrint();
maxEmails=3;
maxEmails = Integer.parseInt(trans.getProperty("MAX_EMAILS","3"));
@@ -137,17 +137,17 @@ public class NotifyCredExpiring extends Batch {
ownerCreds.put(UNKNOWN_ID,noOwner);
// Get a list of ONLY the ones needing email by Owner
- for(Entry<String, List<Cred>> es : Cred.byNS.entrySet()) {
+ for (Entry<String, List<Cred>> es : Cred.byNS.entrySet()) {
lastCred.clear();
- for(Cred c : es.getValue()) {
+ for (Cred c : es.getValue()) {
last = c.last(CredDAO.BASIC_AUTH,CredDAO.BASIC_AUTH_SHA256);
- if(last!=null && last.after(tooLate) && last.before(early)) {
+ if (last!=null && last.after(tooLate) && last.before(early)) {
List<UserRole> ownerURList = UserRole.getByRole().get(es.getKey()+".owner");
- if(ownerURList!=null) {
- for(UserRole ur:ownerURList) {
+ if (ownerURList!=null) {
+ for (UserRole ur:ownerURList) {
String owner = ur.user();
List<LastCred> llc = ownerCreds.get(owner);
- if(llc==null) {
+ if (llc==null) {
ownerCreds.put(owner, (llc=new ArrayList<>()));
}
llc.add(new LastCred(c,last));
@@ -164,39 +164,39 @@ public class NotifyCredExpiring extends Batch {
Message msg = new Message();
Notification ownNotf;
StringBuilder logMessage = new StringBuilder();
- for(Entry<String,List<LastCred>> es : ownerCreds.entrySet()) {
+ for (Entry<String,List<LastCred>> es : ownerCreds.entrySet()) {
String owner = es.getKey();
boolean header = true;
try {
Organization org = OrganizationFactory.obtain(env, owner);
Identity user = org.getIdentity(noAvg, owner);
- if(!UNKNOWN_ID.equals(owner) && user==null) {
+ if (!UNKNOWN_ID.equals(owner) && user==null) {
ps.printf("Invalid Identity: %s\n", owner);
} else {
logMessage.setLength(0);
- if(maxEmails>emailCount) {
+ if (maxEmails>emailCount) {
bCritical=bNormal=bEarly = false;
email.clear();
msg.clear();
email.addTo(user==null?supportEmailAddr:user.email());
ownNotf = Notification.get(es.getKey(),TYPE.CN);
- if(ownNotf==null) {
+ if (ownNotf==null) {
ownNotf = Notification.create(user==null?UNKNOWN_ID:user.fullID(), TYPE.CN);
}
last = ownNotf.last;
// Get Max ID size for formatting purposes
int length = AAF_INSTANTIATED_MECHID.length();
- for(LastCred lc : es.getValue()) {
+ for (LastCred lc : es.getValue()) {
length = Math.max(length, lc.cred.id.length());
}
String id_exp_fmt = "\t%-"+length+"s %15s %s";
Collections.sort(es.getValue(),LastCred.COMPARE);
- for(LastCred lc : es.getValue()) {
- if(lc.last.after(must) && lc.last.before(early) &&
+ for (LastCred lc : es.getValue()) {
+ if (lc.last.after(must) && lc.last.before(early) &&
(ownNotf.last==null || ownNotf.last.before(withinLastWeek))) {
- if(!bEarly && header) {
+ if (!bEarly && header) {
msg.line("\tThe following are friendly 2 month reminders, just in case you need to schedule your updates early. "
+ "You will be reminded next month\n");
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -204,19 +204,19 @@ public class NotifyCredExpiring extends Batch {
header = false;
}
bEarly = true;
- } else if(lc.last.after(critical) && lc.last.before(must) &&
+ } else if (lc.last.after(critical) && lc.last.before(must) &&
(ownNotf.last==null || ownNotf.last.before(withinLastWeek))) {
- if(!bNormal) {
+ if (!bNormal) {
boolean last2wks = lc.last.before(within2Weeks);
- if(last2wks) {
+ if (last2wks) {
try {
Identity supvsr = user.responsibleTo();
email.addCC(supvsr.email());
- } catch(OrganizationException e) {
+ } catch (OrganizationException e) {
trans.error().log(e, "Supervisor cannot be looked up");
}
}
- if(header) {
+ if (header) {
msg.line("\tIt is now important for you to update Passwords all all configurations using them for the following.\n" +
(last2wks?"\tNote: Your Supervisor is CCd\n":"\tNote: Your Supervisor will be notified if this is not being done before the last 2 weeks\n"));
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -225,8 +225,8 @@ public class NotifyCredExpiring extends Batch {
header = false;
}
bNormal=true;
- } else if(lc.last.after(tooLate) && lc.last.before(critical)) { // Email Every Day, with Supervisor
- if(!bCritical && header) {
+ } else if (lc.last.after(tooLate) && lc.last.before(critical)) { // Email Every Day, with Supervisor
+ if (!bCritical && header) {
msg.line("\t!!! WARNING: These Credentials will expire in LESS THAN ONE WEEK !!!!\n" +
"\tYour supervisor is added to this Email\n");
msg.line(id_exp_fmt, AAF_INSTANTIATED_MECHID,EXPIRATION_DATE, QUICK_LINK);
@@ -235,22 +235,22 @@ public class NotifyCredExpiring extends Batch {
}
bCritical = true;
try {
- if(user!=null) {
+ if (user!=null) {
Identity supvsr = user.responsibleTo();
- if(supvsr!=null) {
+ if (supvsr!=null) {
email.addCC(supvsr.email());
supvsr = supvsr.responsibleTo();
- if(supvsr!=null) {
+ if (supvsr!=null) {
email.addCC(supvsr.email());
}
}
}
- } catch(OrganizationException e) {
+ } catch (OrganizationException e) {
trans.error().log(e, "Supervisor cannot be looked up");
}
}
- if(bEarly || bNormal || bCritical) {
- if(logMessage.length()==0) {
+ if (bEarly || bNormal || bCritical) {
+ if (logMessage.length()==0) {
logMessage.append("NotifyCredExpiring");
}
logMessage.append("\n\t");
@@ -261,7 +261,7 @@ public class NotifyCredExpiring extends Batch {
}
}
- if(bEarly || bNormal || bCritical) {
+ if (bEarly || bNormal || bCritical) {
msg.line(LINE);
msg.line("Why are you receiving this Notification?\n");
msg.line("You are the listed owner of one or more AAF Namespaces. ASPR requires that those responsible for "
@@ -271,9 +271,9 @@ public class NotifyCredExpiring extends Batch {
msg.line(" %s/ns\n\n",env.getProperty(GUI_URL));
email.msg(msg);
Result<Void> rv = email.exec(trans, org,"");
- if(rv.isOK()) {
+ if (rv.isOK()) {
++emailCount;
- if(!isDryRun()) {
+ if (!isDryRun()) {
ownNotf.update(noAvg, session, false);
// SET LastNotification
}