summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-batch/src/main')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java58
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java36
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java34
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java38
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java62
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java46
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java52
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java104
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java36
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java32
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java30
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java60
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java30
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java24
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java20
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java20
43 files changed, 531 insertions, 531 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
index f361e750..b5ff59b1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -73,12 +73,12 @@ public abstract class Batch {
protected static final String STARS = "*****";
- protected static Cluster cluster;
+ protected static Cluster cluster;
protected static AuthzEnv env;
protected static Session session;
protected static Set<String> specialNames;
protected static List<String> specialDomains;
- protected static boolean dryRun;
+ protected static boolean dryRun;
protected static String batchEnv;
private static File logdir;
@@ -88,12 +88,12 @@ public abstract class Batch {
protected static final String MAX_EMAILS="MAX_EMAILS";
protected static final String VERSION="VERSION";
public static final String GUI_URL="GUI_URL";
-
+
protected final Organization org;
protected String version;
protected static final Date now = new Date();
protected static final Date never = new Date(0);
-
+
protected Batch(AuthzEnv env) throws APIException, IOException, OrganizationException {
if (batchEnv != null) {
env.info().log("Redirecting to ",batchEnv,"environment");
@@ -149,22 +149,22 @@ public abstract class Batch {
}
}
}
-
+
version = env.getProperty(VERSION,Config.AAF_DEFAULT_API_VERSION);
}
protected abstract void run(AuthzTrans trans);
protected void _close(AuthzTrans trans) {}
-
+
public String[] args() {
return env.get(ssargs);
}
-
+
public boolean isDryRun()
{
return dryRun;
}
-
+
public boolean isSpecial(String user) {
if(user==null) {
return false;
@@ -230,7 +230,7 @@ public abstract class Batch {
return (organization);
}
-
+
public static Row executeDeleteQuery(Statement stmt) {
Row row = null;
if (!dryRun) {
@@ -240,7 +240,7 @@ public abstract class Batch {
return (row);
}
-
+
public static int acquireRunLock(String className) {
Boolean testEnv = true;
String envStr = env.getProperty("AFT_ENVIRONMENT");
@@ -320,7 +320,7 @@ public abstract class Batch {
}
return (1);
}
-
+
private static void deleteLock( String className) {
Row row = session.execute( String.format( "DELETE FROM authz.run_lock WHERE class = '%s' IF EXISTS", className ) ).one();
if (! row.getBool("[applied]")) {
@@ -336,7 +336,7 @@ public abstract class Batch {
}
}
}
-
+
protected static File logDir() {
if(logdir == null) {
String ld = env.getProperty(LOG_DIR);
@@ -351,7 +351,7 @@ public abstract class Batch {
if(!logdir.exists()) {
logdir.mkdirs();
}
- }
+ }
return logdir;
}
protected int count(String str, char c) {
@@ -386,13 +386,13 @@ public abstract class Batch {
sbos.getBuffer().append(s);
sbos.getBuffer().append(' ');
}
-
+
InputStream is = null;
String filename;
String propLoc;
try {
Define.set(access);
-
+
if(access.getProperty(Config.CADI_PROP_FILES)==null) {
File f = new File("authBatch.props");
try {
@@ -424,7 +424,7 @@ public abstract class Batch {
}
env = new AuthzEnv(access);
-
+
transferVMProps(env, CASS_ENV, "DRY_RUN", "NS", "Organization");
// Be able to change Environments
@@ -446,7 +446,7 @@ public abstract class Batch {
Batch batch = null;
AuthzTrans trans = env.newTrans();
-
+
TimeTaken tt = trans.start("Total Run", Env.SUB);
try {
int len = args.length;
@@ -459,23 +459,23 @@ public abstract class Batch {
if (len > 0) {
System.arraycopy(args, 1, nargs, 0, len);
}
-
+
env.put(ssargs = env.staticSlot("ARGS"), nargs);
-
+
/*
* Add New Batch Programs (inherit from Batch) here
*/
-
+
// Might be a Report, Update or Temp Batch
Class<?> cls = null;
String classifier = "";
-
+
String[] pkgs = new String[] {
"org.onap.aaf.auth.batch.update",
"org.onap.aaf.auth.batch.reports",
"org.onap.aaf.auth.batch.temp"
};
-
+
String ebp = env.getProperty("EXTRA_BATCH_PKGS");
if(ebp!=null) {
String[] ebps = Split.splitTrim(':', ebp);
@@ -484,12 +484,12 @@ public abstract class Batch {
System.arraycopy(ebps,0,temp,pkgs.length,ebps.length);
pkgs = temp;
}
-
+
for(String p : pkgs) {
try {
cls = ClassLoader.getSystemClassLoader().loadClass(p + '.' + toolName);
int lastDot = p.lastIndexOf('.');
- if(p.length()>0 || p.length()!=lastDot) {
+ if(p.length()>0 || p.length()!=lastDot) {
StringBuilder sb = new StringBuilder();
sb.append(Character.toUpperCase(p.charAt(++lastDot)));
while(++lastDot<p.length()) {
@@ -508,15 +508,15 @@ public abstract class Batch {
batch = (Batch) cnst.newInstance(trans);
env.info().log("Begin", classifier, toolName);
}
-
-
+
+
if (batch == null) {
trans.error().log("No Batch named", toolName, "found");
}
/*
* End New Batch Programs (inherit from Batch) here
*/
-
+
}
if (batch != null) {
try {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
index dbb2dc31..38e3c2fe 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.batch;
public class BatchException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -3877245367723491192L;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
index 0bc58add..510fc2b8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class BatchPrincipal extends TaggedPrincipal {
private final String name;
-
+
public BatchPrincipal(final String name) {
this.name = "batch:"+name;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
index 1fc16e4e..9606242e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@ public abstract class CassBatch extends Batch {
super(trans.env());
// Flow all Env Logs to Log4j
Log4JLogTarget.setLog4JEnv(log4JName, env);
-
+
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
try {
session = cluster.connect();
@@ -75,7 +75,7 @@ public abstract class CassBatch extends Batch {
}
throw e;
}
- }
+ }
return null;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
index e8961f14..f7bf3248 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,7 +37,7 @@ public class ApprovalSet {
private DataView dataview;
protected FutureDAO.Data fdd;
protected List<ApprovalDAO.Data> ladd;
-
+
public ApprovalSet(final GregorianCalendar start, final String target, final DataView dv) {
dataview = dv;
fdd = new FutureDAO.Data();
@@ -46,7 +46,7 @@ public class ApprovalSet {
fdd.start = start.getTime();
ladd = new ArrayList<>();
}
-
+
protected void setConstruct(final ByteBuffer bytes) {
fdd.construct = bytes;
}
@@ -54,11 +54,11 @@ public class ApprovalSet {
protected void setMemo(final String memo) {
fdd.memo = memo;
}
-
+
protected void setExpires(final GregorianCalendar expires) {
fdd.expires = expires.getTime();
}
-
+
public Result<Void> write(AuthzTrans trans) {
StringBuilder errs = null;
if(ladd == null || ladd.isEmpty()) {
@@ -89,7 +89,7 @@ public class ApprovalSet {
public boolean hasApprovals() {
return !ladd.isEmpty();
}
-
+
public Set<String> approvers() {
Set<String> rv = new HashSet<>();
for(ApprovalDAO.Data app : ladd) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
index c197f7f2..018f9493 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@ import org.onap.aaf.auth.layer.Result;
/**
* I have become convinced that Data for Apps is modeled by abstract access methods against multiple data
- * sources. With the insistence of JUnits, it becomes much more paramount to create a model which can
+ * sources. With the insistence of JUnits, it becomes much more paramount to create a model which can
* 1) be easily loaded from Disk "Test Data" without resorting to complex "mokito" schemes
* 2) tested in Memory
* 3) combined for REAL time by running Cached Memory
@@ -42,14 +42,14 @@ import org.onap.aaf.auth.layer.Result;
* c) JSON
* d) XML
* 5) persisted Globally through a store like Cassandra
- *
+ *
* But in the end, it looks like:
* 1) Data Structures
- * 2) Find the Data Structures by various means, accounting for
+ * 2) Find the Data Structures by various means, accounting for
* a) Multiple Responses
* b) Errors from the deepest level, made available through the call stack
- * 3)
- *
+ * 3)
+ *
* @author jonathan.gathman
*
*/
@@ -63,11 +63,11 @@ public interface DataView {
// Inserts
public Result<ApprovalDAO.Data> insert(final AuthzTrans trans, final ApprovalDAO.Data add);
public Result<FutureDAO.Data> insert(final AuthzTrans trans, final FutureDAO.Data add);
-
+
// Deletes
public Result<ApprovalDAO.Data> delete(final AuthzTrans trans, final ApprovalDAO.Data add);
public Result<FutureDAO.Data> delete(final AuthzTrans trans, final FutureDAO.Data add);
-
+
// Clear any buffers
public void flush();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
index d91c42c0..654c2bbc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
index 9a666981..04083d9e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,11 +31,11 @@ import org.onap.aaf.misc.env.util.Chrono;
public class Pending {
public static final String REMIND = "remind";
-
+
int qty;
boolean hasNew;
Date earliest;
-
+
/**
* Use this constructor to indicate when last Notified
* @param lastNotified
@@ -74,32 +74,32 @@ public class Pending {
public void inc() {
++qty;
}
-
+
public void inc(Pending value) {
- qty+=value.qty;
- if(earliest==null) {
+ qty += value.qty;
+ if(earliest == null) {
earliest = value.earliest;
- } else if(value.earliest!=null && value.earliest.before(earliest)) {
+ } else if(value.earliest != null && value.earliest.before(earliest)) {
earliest = value.earliest;
}
}
public void earliest(Date lastnotified) {
- if(lastnotified==null) {
+ if(lastnotified == null) {
hasNew=true;
- } else if (earliest==null || lastnotified.before(earliest)) {
+ } else if (earliest == null || lastnotified.before(earliest)) {
earliest = lastnotified;
}
}
-
+
public int qty() {
return qty;
}
-
+
public Date earliest() {
return earliest;
}
-
+
public boolean newApprovals() {
return hasNew;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
index 1884262f..0b8006cb 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ import org.onap.aaf.auth.batch.helpers.Future;
public class Ticket {
public final Future f;
public final Set<Approval> approvals;
-
+
public Ticket(Future future) {
this.f = future;
approvals = new HashSet<>();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
index da13e84c..6b9e5e0b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,9 +57,9 @@ public class URApprovalSet extends ApprovalSet {
expires.setTime(urdd.expires);
}
setExpires(expires);
- setTargetKey(urdd.user+'|'+urdd.role);
+ setTargetKey(urdd.user + '|' + urdd.role);
setTargetDate(urdd.expires);
-
+
Result<RoleDAO.Data> r = dv.roleByName(trans, urdd.role);
if(r.notOKorIsEmpty()) {
throw new CadiException(r.errorString());
@@ -81,10 +81,10 @@ public class URApprovalSet extends ApprovalSet {
if(found==null) {
throw new CadiException(String.format("User '%s' in Role '%s' does not exist", urdd.user,urdd.role));
}
-
+
// Primarily, Owners are responsible, unless it's owned by self
boolean isOwner = false;
- Result<List<UserRoleDAO.Data>> owners = dv.ursByRole(trans, urdd.ns+".owner");
+ Result<List<UserRoleDAO.Data>> owners = dv.ursByRole(trans, urdd.ns + ".owner");
if(owners.isOK()) {
for(UserRoleDAO.Data owner : owners.value) {
if(urdd.user.equals(owner.user)) {
@@ -114,7 +114,7 @@ public class URApprovalSet extends ApprovalSet {
}
}
}
-
+
private void setTargetDate(Date expires) {
fdd.target_date = expires;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
index a9029626..470cfb1e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,7 +55,7 @@ public class Approval implements CacheChange.Data {
public static TreeMap<UUID,List<Approval>> byTicket = new TreeMap<>();
public static List<Approval> list = new LinkedList<>();
private static final CacheChange<Approval> cache = new CacheChange<>();
-
+
public final ApprovalDAO.Data add;
private String role;
@@ -109,8 +109,8 @@ public class Approval implements CacheChange.Data {
}
}
};
-
- public Approval(UUID id, UUID ticket, String approver,// Date last_notified,
+
+ public Approval(UUID id, UUID ticket, String approver,// Date last_notified,
String user, String memo, String operation, String status, String type, long updated) {
add = new ApprovalDAO.Data();
add.id = id;
@@ -124,7 +124,7 @@ public class Approval implements CacheChange.Data {
add.updated = new Date(updated);
role = roleFromMemo(memo);
}
-
+
public static String roleFromMemo(String memo) {
if (memo==null) {
return null;
@@ -156,31 +156,31 @@ public class Approval implements CacheChange.Data {
public static int load(Trans trans, Session session, Creator<Approval> creator, Visitor<Approval> visitor) {
int count = 0;
try {
- count+=call(trans,session,creator.query(null), creator, visitor);
+ count += call(trans,session,creator.query(null), creator, visitor);
} finally {
trans.info().log("Found",count,"Approval Records");
}
return count;
}
-
+
public static int load(Trans trans, Session session, Creator<Approval> creator ) {
int count = 0;
try {
- count+=call(trans,session,creator.query(null), creator, FullLoad);
+ count += call(trans,session,creator.query(null), creator, FullLoad);
} finally {
trans.info().log("Found",count,"Approval Records");
}
return count;
}
-
+
public static int loadUsers(Trans trans, Session session, Set<String> users, Visitor<Approval> visitor) {
int total = 0;
for(String user : users) {
- total+=call(trans,session,String.format("%s WHERE user='%s';",v2_0_17.select(), user),v2_0_17,visitor);
+ total += call(trans,session,String.format("%s WHERE user='%s';",v2_0_17.select(), user),v2_0_17,visitor);
}
return total;
}
-
+
public static void row(CSV.RowSetter crs, Approval app) {
crs.row("approval",app.add.id,app.add.ticket,app.add.user,app.role,app.add.memo);
}
@@ -201,14 +201,14 @@ public class Approval implements CacheChange.Data {
tt.done();
}
}
-
+
@Override
public void expunge() {
List<Approval> la = byApprover.get(getApprover());
if (la!=null) {
la.remove(this);
}
-
+
la = byUser.get(getUser());
if (la!=null) {
la.remove(this);
@@ -288,11 +288,11 @@ public class Approval implements CacheChange.Data {
add.ticket=null;
add.status="lapsed";
}
-
+
public String getRole() {
return role;
}
-
+
public String toString() {
return getUser() + ' ' + getMemo();
}
@@ -310,12 +310,12 @@ public class Approval implements CacheChange.Data {
}
}
}
-
+
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public static int sizeForDeletion() {
return cache.cacheSize();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
index 9906f499..156cb097 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,7 +57,7 @@ public class BatchDataView implements DataView {
public Session getSession(AuthzTrans trans){
return session;
}
-
+
public Result<NsDAO.Data> ns(AuthzTrans trans, String id) {
NS n;
TimeTaken tt = trans.start("Get NS by ID %s", Trans.SUB, id);
@@ -66,14 +66,14 @@ public class BatchDataView implements DataView {
} finally {
tt.done();
}
-
+
if(n==null || n.ndd==null) {
return Result.err(Result.ERR_Backend,"Namespace '%s' does not exist", id);
}
return Result.ok(n.ndd);
}
-
+
@Override
public Result<RoleDAO.Data> roleByName(AuthzTrans trans, String name) {
Role r = Role.byName.get(name);
@@ -116,22 +116,22 @@ public class BatchDataView implements DataView {
StringBuilder sb = cqlBatch.inc();
sb.append("DELETE from authz.future WHERE id = ");
sb.append(fdd.id.toString());
- return Result.ok(fdd);
+ return Result.ok(fdd);
}
-
+
@Override
public Result<ApprovalDAO.Data> delete(AuthzTrans trans, ApprovalDAO.Data add) {
StringBuilder sb = cqlBatch.inc();
sb.append("DELETE from authz.approval WHERE id = ");
sb.append(add.id.toString());
- return Result.ok(add);
+ return Result.ok(add);
}
@Override
public Result<ApprovalDAO.Data> insert(AuthzTrans trans, ApprovalDAO.Data add) {
StringBuilder sb = cqlBatch.inc();
- sb.append("INSERT INTO authz.approval (id,approver,memo,operation,status,ticket,type,user) VALUES (");
+ sb.append("INSERT INTO authz.approval (id,approver,memo,operation,status,ticket,type,user) VALUES (");
sb.append(add.id.toString());
sb.append(COMMA_QUOTE);
sb.append(add.approver);
@@ -154,7 +154,7 @@ public class BatchDataView implements DataView {
@Override
public Result<FutureDAO.Data> insert(AuthzTrans trans, FutureDAO.Data fdd) {
StringBuilder sb = cqlBatch.inc();
- sb.append("INSERT INTO authz.future (id,construct,expires,memo,start,target,target_key,target_date) VALUES (");
+ sb.append("INSERT INTO authz.future (id,construct,expires,memo,start,target,target_key,target_date) VALUES (");
sb.append(fdd.id.toString());
sb.append(',');
fdd.construct.hasArray();
@@ -178,7 +178,7 @@ public class BatchDataView implements DataView {
sb.append(QUOTE_PAREN_SEMI);
return Result.ok(fdd);
}
-
+
@Override
public void flush() {
cqlBatch.flush();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
index d62c7781..ccfb1c5f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class CQLBatch {
hasAdded = sb.length();
return sb;
}
-
+
private boolean end() {
if(sb.length()==hasAdded) {
return false;
@@ -57,7 +57,7 @@ public class CQLBatch {
return true;
}
}
-
+
public ResultSet execute() {
if(end()) {
if(sleep>0) {
@@ -66,17 +66,19 @@ public class CQLBatch {
try {
Thread.sleep(left);
} catch (InterruptedException e) {
- Access.NULL.log(e); // Keep code check idiocy at bay
+ // PER ORACLE, this isn't actually needed, but Sonar idiocy
+ // requires something or flags as error.
+ return null;
}
}
- last = System.currentTimeMillis()+sleep;
+ last = System.currentTimeMillis() + sleep;
}
return session.execute(sb.toString());
} else {
return null;
}
}
-
+
public ResultSet execute(boolean dryRun) {
ResultSet rv = null;
if(dryRun) {
@@ -86,10 +88,12 @@ public class CQLBatch {
try {
Thread.sleep(left);
} catch (InterruptedException e) {
- Access.NULL.log(e); // Keep code check idiocy at bay
+ // PER ORACLE, this isn't actually needed, but Sonar idiocy
+ // requires something or flags as error.
+ return null;
}
}
- last = System.currentTimeMillis()+sleep;
+ last = System.currentTimeMillis() + sleep;
}
end();
} else {
@@ -98,7 +102,7 @@ public class CQLBatch {
sb.setLength(0);
return rv;
}
-
+
public ResultSet singleExec(StringBuilder query, boolean dryRun) {
if(dryRun) {
return null;
@@ -106,10 +110,10 @@ public class CQLBatch {
return session.execute(query.toString());
}
}
-
+
public void touch(String table, int begin, int end, boolean dryRun) {
StringBuilder sb = begin();
- for(int i=begin;i<end;++i) {
+ for(int i=begin; i<end; ++i) {
sb.append("UPDATE cache SET touched=dateof(now()) WHERE name='");
sb.append(table);
sb.append("' AND seg=");
@@ -118,11 +122,11 @@ public class CQLBatch {
}
execute(dryRun);
}
-
- public void sleep(int j) {
+
+ public void sleep(long j) {
sleep = j*1000;
}
-
+
public String toString() {
return sb.toString();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
index 9cd7341c..9bb2fa32 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@ package org.onap.aaf.auth.batch.helpers;
public class CQLBatchLoop {
private static final int MAX_CHARS = (50 * 1024)/2;
-
+
private final CQLBatch cqlBatch;
private final int maxBatch;
private final StringBuilder sb;
@@ -52,17 +52,17 @@ public class CQLBatchLoop {
/**
* Assume this is another line in the Batch
* @return
- */
+ */
public StringBuilder inc() {
- if((i>=maxBatch || current.length()+sb.length()>MAX_CHARS)&&(i>0)) {
-
- cqlBatch.execute(dryRun);
+ if((i>=maxBatch || current.length() + sb.length() > MAX_CHARS) && (i > 0)) {
+
+ cqlBatch.execute(dryRun);
i = -1;
incBatch();
}
- if(i<0) {
+ if(i < 0) {
cqlBatch.begin();
- i=0;
+ i = 0;
}
if(current.length() > MAX_CHARS) {
cqlBatch.singleExec(current, dryRun);
@@ -74,23 +74,23 @@ public class CQLBatchLoop {
++total;
return current;
}
-
+
/**
* Close up when finished.
*/
public void flush() {
- if(current.length()+sb.length()>MAX_CHARS) {
- if(i>0) {
+ if(current.length() + sb.length() > MAX_CHARS) {
+ if(i > 0) {
cqlBatch.execute(dryRun);
incBatch();
}
- if(current.length()>0) {
+ if(current.length() > 0) {
cqlBatch.singleExec(current, dryRun);
current.setLength(0);
incBatch();
}
} else {
- if(i<0) {
+ if(i < 0) {
cqlBatch.begin();
}
sb.append(current);
@@ -98,23 +98,23 @@ public class CQLBatchLoop {
cqlBatch.execute(dryRun);
incBatch();
}
- i=-1;
+ i = -1;
}
private void incBatch() {
++batches;
if(showProgress) {
System.out.print('.');
- if(batches%70==0) {
+ if(batches%70 == 0) {
System.out.println();
- }
+ }
}
}
public int total() {
return total;
}
-
+
public int batches() {
return batches;
}
@@ -124,7 +124,7 @@ public class CQLBatchLoop {
batches = 0;
i = -1;
}
-
+
public String toString() {
return cqlBatch.toString();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
index 84d7b5a2..a623945c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,24 +27,24 @@ import java.util.List;
public class CacheChange<T extends CacheChange.Data> {
private List<T> removed;
-
+
public CacheChange() {
removed = new ArrayList<>();
}
-
- @FunctionalInterface
+
+ @FunctionalInterface
interface Data {
public abstract void expunge();
}
-
+
public final void delayedDelete(T t) {
removed.add(t);
}
-
+
public final List<T> getRemoved() {
return removed;
}
-
+
public final void resetLocalData() {
if (removed==null || removed.isEmpty()) {
return;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
index a4e4112f..d1389432 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,11 +26,11 @@ import com.datastax.driver.core.Row;
public abstract class Creator<T> {
public abstract T create(Row row);
public abstract String select();
-
+
public String suffix() {
return "";
}
-
+
public String query(String where) {
StringBuilder sb = new StringBuilder(select());
if (where!=null) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
index 6f23c515..49309004 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@
package org.onap.aaf.auth.batch.helpers;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -53,13 +52,13 @@ public class Cred {
public final String id;
public final List<Instance> instances;
public final String ns;
-
+
public Cred(String id) {
this.id = id;
instances = new ArrayList<>();
ns=Question.domain2ns(id);
}
-
+
public static class Instance {
public final int type;
public final Date expires,written;
@@ -67,7 +66,7 @@ public class Cred {
public final String tag;
public List<Note> notes;
-
+
public Instance(int type, Date expires, Integer other, long written, String tag) {
this.type = type;
this.expires = expires;
@@ -75,7 +74,7 @@ public class Cred {
this.written = new Date(written);
this.tag = tag;
}
-
+
/**
* Usually returns Null...
* @return
@@ -83,23 +82,23 @@ public class Cred {
public List<Note> notes() {
return notes;
}
-
+
public void addNote(int level, String note) {
if(notes==null) {
notes=new ArrayList<>();
- }
+ }
notes.add(new Note(level,note));
}
-
+
public String toString() {
return expires.toString() + ": " + type + ' ' + tag;
}
}
-
+
public static class Note {
public final int level;
public final String note;
-
+
public Note(int level, String note) {
this.level = level;
this.note = note;
@@ -127,7 +126,7 @@ public class Cred {
return last;
}
-
+
public Set<Integer> types() {
Set<Integer> types = new HashSet<>();
for (Instance i : instances) {
@@ -148,7 +147,7 @@ public class Cred {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read Creds", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -190,7 +189,7 @@ public class Cred {
}
public static void add(
- final String id,
+ final String id,
final int type,
final Date timestamp,
final int other,
@@ -203,10 +202,10 @@ public class Cred {
data.put(id, cred);
}
cred.instances.add(new Instance(type, timestamp, other, written/1000,tag));
-
- List<Cred> lscd = byNS.get(cred.ns);
+
+ List<Cred> lscd = byNS.get(cred.ns);
if (lscd==null) {
- lscd=new ArrayList<>();
+ lscd=new ArrayList<>();
byNS.put(cred.ns,lscd);
}
boolean found = false;
@@ -222,10 +221,10 @@ public class Cred {
}
- /**
+ /**
* Count entries in Cred data.
* Note, as opposed to other methods, need to load the whole cred table for the Types.
- * @param numbuckets
+ * @param numbuckets
* @return
*/
public static CredCount count(int numbuckets) {
@@ -246,7 +245,7 @@ public class Cred {
public int x509Added[];
public int x509Expired[];
public Date dates[];
-
+
public CredCount(int numbuckets) {
raw = new int[numbuckets];
basic_auth = new int[numbuckets];
@@ -263,17 +262,17 @@ 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);
}
-
+
}
-
+
public void inc(int type, Date start, Date expires) {
- for (int i=0;i<dates.length-1;++i) {
+ for (int i = 0; i < dates.length - 1; ++i) {
if (start.before(dates[i])) {
- if ((type==CredDAO.CERT_SHA256_RSA)&&(start.after(dates[i+1]))) {
+ if ((type == CredDAO.CERT_SHA256_RSA)&&(start.after(dates[i + 1]))) {
++x509Added[i];
}
if (expires.after(dates[i])) {
@@ -297,15 +296,15 @@ public class Cred {
}
public long authCount(int idx) {
- return (long)basic_auth[idx]+basic_auth_256[idx];
+ return (long)basic_auth[idx] + basic_auth_256[idx];
}
-
+
public long x509Count(int idx) {
return cert[idx];
}
}
-
+
public void row(final CSV.Writer csvw, final Instance inst) {
csvw.row("cred",id,ns,Integer.toString(inst.type),Chrono.dateOnlyStamp(inst.expires),
inst.expires.getTime(),inst.tag);
@@ -316,10 +315,9 @@ public class Cred {
inst.expires.getTime(),inst.tag,reason);
}
- static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
public static void batchDelete(StringBuilder sb, List<String> row) {
Long l = Long.parseLong(row.get(5));
- String date = sdf.format(new Date(l));
+ String date = Chrono.batchFmt.format(new Date(l));
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
sb.append("' AND type=");
@@ -331,7 +329,7 @@ public class Cred {
// sb.append(" AND expires=dateof(maxtimeuuid(");
// sb.append(row.get(5));
// sb.append("));\n");
-
+
}
public String toString() {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
index c7d4e7d4..bb3a3e94 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class ExpireRange {
public final Range approveDelete ;
private Range delRange;
-
+
public ExpireRange(final Access access) {
ranges = new HashMap<>();
intervalDates = new HashMap<>();
@@ -58,8 +58,8 @@ public class ExpireRange {
List<Range> lcred = getRangeList("cred");
List<Range> lur = getRangeList("ur");
List<Range> lx509 = getRangeList("x509");
-
-
+
+
/*
Range(Name, ReportingLevel, PeopleInterval, AppInterval, Start(Type,Qty) End(Type,Qty) )
Interval of -1 Means "only once"
@@ -70,25 +70,25 @@ public class ExpireRange {
lur.add(delRange);
lcred.add(delRange);
lx509.add(delRange);
-
+
lcred.add(new Range(ONE_WEEK ,3,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1));
lcred.add(new Range(TWO_WEEK ,2,-1,-1,GregorianCalendar.WEEK_OF_MONTH,1,GregorianCalendar.WEEK_OF_MONTH,2));
lcred.add(new Range(ONE_MONTH,1,7,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
lcred.add(new Range(TWO_MONTH,1,-1,-1,GregorianCalendar.MONTH,1,GregorianCalendar.MONTH,2));
-
+
lur.add( new Range(ONE_MONTH,1,-1,-1,0,0,GregorianCalendar.MONTH,1));
// Comment out until we can get some more clear actions in place for GUI
// lur.add( new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
// lur.add( new Range(ONE_WEEK,2,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1));
-
+
lx509.add(new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
}
}
-
+
public Range newFutureRange() {
return new Range("Approval",7,7,1,0,0,GregorianCalendar.MONTH,1);
}
-
+
public Set<String> names() {
Set<String> names = new HashSet<>();
for(List<Range> lr : ranges.values()) {
@@ -99,7 +99,7 @@ public class ExpireRange {
return names;
}
-
+
private synchronized List<Range> getRangeList(final String key) {
List<Range> rv = ranges.get(key);
if(rv==null) {
@@ -108,7 +108,7 @@ public class ExpireRange {
}
return rv;
}
-
+
public class Range {
private final String name;
private final int reportingLevel;
@@ -117,11 +117,11 @@ public class ExpireRange {
private final Date start;
private final Date end;
private final Date lowerValid;
-
+
public Range(
- final String name, final int reportingLevel,
- final int peopleInterval, final int appInterval,
- final int startGCType, final int startQty,
+ final String name, final int reportingLevel,
+ final int peopleInterval, final int appInterval,
+ final int startGCType, final int startQty,
final int endGCType,final int endQty) {
this.name = name;
this.reportingLevel = reportingLevel;
@@ -135,7 +135,7 @@ public class ExpireRange {
gc.add(startGCType, startQty);
}
start = gc.getTime();
-
+
if(endGCType<0) {
gc.set(GregorianCalendar.YEAR, 1);
} else {
@@ -143,7 +143,7 @@ public class ExpireRange {
gc.add(endGCType, endQty);
}
end = gc.getTime();
-
+
if(endGCType<0) {
gc.set(GregorianCalendar.YEAR, -1);
@@ -154,11 +154,11 @@ public class ExpireRange {
lowerValid = gc.getTime();
}
-
+
public String name() {
return name;
}
-
+
public int reportingLevel() {
return reportingLevel;
}
@@ -190,11 +190,11 @@ public class ExpireRange {
public Date getStart() {
return start;
}
-
+
public Date getEnd() {
return end;
}
-
+
public boolean inRange(final Date date) {
if(date==null) {
return false;
@@ -226,6 +226,6 @@ public class ExpireRange {
public Date now() {
return now;
}
-
+
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
index fd0de1fc..4bbab9d3 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,7 +51,7 @@ import com.datastax.driver.core.Statement;
public class Future implements CacheChange.Data, Comparable<Future> {
public static final Map<UUID,Future> data = new TreeMap<>();
public static final Map<String,List<Future>> byRole = new TreeMap<>();
-
+
public final FutureDAO.Data fdd;
public final String role; // derived
private static final CacheChange<Future> cache = new CacheChange<>();
@@ -106,27 +106,27 @@ public class Future implements CacheChange.Data, Comparable<Future> {
}
this.role = role;
}
-
+
public final UUID id() {
return fdd.id;
}
-
+
public final String memo() {
return fdd.memo;
}
-
+
public final String target() {
return fdd.target;
}
-
+
public final Date start() {
return fdd.start;
}
-
+
public final Date expires() {
return fdd.expires;
}
-
+
public static void load(Trans trans, Session session, Creator<Future> creator) {
load(trans,session,creator, f -> {
data.put(f.fdd.id,f);
@@ -149,7 +149,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
} finally {
tt.done();
}
-
+
int count = 0;
tt = trans.start("Process Futures", Env.SUB);
try {
@@ -181,7 +181,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
}
return rv;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.helpers.CacheChange.Data#resetLocalData()
*/
@@ -207,7 +207,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public static int sizeForDeletion() {
return cache.cacheSize();
}
@@ -215,7 +215,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public static boolean pendingDelete(Future f) {
return cache.contains(f);
}
-
+
public static void row(CSV.Writer cw, Future f) {
cw.row("future",f.fdd.id,f.fdd.target,f.fdd.expires,f.role,f.fdd.memo);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
index dfacd81b..67203af2 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,28 +49,28 @@ public class LastNotified {
private Session session;
public static final Date NEVER = new Date(0);
private static final String SELECT = "SELECT user,target,key,last FROM authz.notified";
-
+
public LastNotified(Session session) {
this.session = session;
}
-
+
public void add(Set<String> users) {
StringBuilder query = new StringBuilder();
startQuery(query);
int cnt = 0;
for(String user : users) {
- if(++cnt>1) {
+ if(++cnt > 1) {
query.append(',');
}
query.append('\'');
query.append(user);
query.append('\'');
- if(cnt>=30) {
+ if(cnt >= 30) {
endQuery(query);
add(session.execute(query.toString()),lastNotifiedVar, (x,y) -> false);
query.setLength(0);
startQuery(query);
- cnt=0;
+ cnt = 0;
}
}
if(cnt>0) {
@@ -81,7 +81,7 @@ public class LastNotified {
/**
* Note: target_key CAN also contain a Pipe.
- *
+ *
* @param user
* @param target
* @param targetkey
@@ -91,12 +91,12 @@ public class LastNotified {
String key = user + '|' + target + '|' + (targetkey==null?"":targetkey);
return lastNotified(key);
}
-
+
public Date lastNotified(String key) {
Date d = lastNotifiedVar.get(key);
return d==null?NEVER:d;
}
-
+
private Date add(ResultSet result, Map<String, Date> lastNotified, MarkDelete md) {
Date last = null;
Row r;
@@ -104,7 +104,7 @@ public class LastNotified {
r = iter.next();
String ttKey = r.getString(1) + '|' +
r.getString(2);
-
+
String fullKey = r.getString(0) + '|' +
ttKey;
last=r.getTimestamp(3);
@@ -118,7 +118,7 @@ public class LastNotified {
}
return last;
}
-
+
@FunctionalInterface
private interface MarkDelete {
boolean process(String fullKey, Date last);
@@ -167,7 +167,7 @@ public class LastNotified {
}
public static String newKey(UserRole ur) {
- return "ur|" + ur.user() + '|'+ur.role();
+ return "ur|" + ur.user() + '|' + ur.role();
}
public static String newKey(Cred cred, Instance inst) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
index e76f5235..bf1338f5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -62,9 +62,9 @@ public class NS implements Comparable<NS> {
ndd.description = description;
ndd.parent = parent;
ndd.type = type;
- // ndd.attrib =
+ // ndd.attrib =
}
-
+
public static void load(Trans trans, Session session, Creator<NS> creator) {
load(trans,session,
"select name, description, parent, type, scope from authz.ns;"
@@ -72,10 +72,10 @@ public class NS implements Comparable<NS> {
, v -> data.put(v.ndd.name,v)
);
}
-
+
public static void loadOne(Trans trans, Session session, Creator<NS> creator, String ns) {
load(trans,session,
- ("select name, description, parent, type, scope from authz.ns WHERE name='"+ns+"';")
+ ("select name, description, parent, type, scope from authz.ns WHERE name='" + ns + "';")
,creator
, v -> data.put(v.ndd.name,v)
);
@@ -84,7 +84,7 @@ public class NS implements Comparable<NS> {
public static void load(Trans trans, Session session, Creator<NS> creator, Visitor<NS> visitor) {
load(trans,session,creator.query(null),creator, visitor);
}
-
+
public void row(final CSV.Writer csvw, String tag) {
csvw.row(tag,ndd.name,ndd.type,ndd.parent);
}
@@ -102,7 +102,7 @@ public class NS implements Comparable<NS> {
} finally {
tt.done();
}
-
+
try {
Iterator<Row> iter = results.iterator();
@@ -136,7 +136,7 @@ public class NS implements Comparable<NS> {
tt.done();
}
}
-
+
public String toString() {
return ndd.name;
}
@@ -161,21 +161,21 @@ public class NS implements Comparable<NS> {
public int compareTo(NS o) {
return ndd.name.compareTo(o.ndd.name);
}
-
+
public static class NSSplit {
public String ns;
public String other;
public NSSplit(String s, int dot) {
ns = s.substring(0,dot);
- other = s.substring(dot+1);
+ other = s.substring(dot + 1);
}
}
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) {
+ 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/batch/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
index a2cba259..16c40952 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,14 +50,14 @@ public class NsAttrib {
return "select ns,key,value from authz.ns_attrib";
}
};
-
-
+
+
public NsAttrib(String ns, String key, String value) {
this.ns = ns;
this.key = key;
this.value = value;
}
-
+
public static void load(Trans trans, Session session, Creator<NsAttrib> creator, Visitor<NsAttrib> visitor) {
trans.info().log( "query: " + creator.select() );
ResultSet results;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
index e69ef51d..3f750fb8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ public class Role implements Comparable<Role> {
public RoleDAO.Data rdd;
private String full;
private String encode;
-
+
public Role(String full) {
rdd = new RoleDAO.Data();
rdd.ns = "";
@@ -59,7 +59,7 @@ public class Role implements Comparable<Role> {
rdd.perms = new HashSet<>();
this.full = full;
}
-
+
public Role(String ns, String name, String description,Set<String> perms) {
rdd = new RoleDAO.Data();
rdd.ns = ns;
@@ -69,18 +69,18 @@ public class Role implements Comparable<Role> {
this.full = null;
this.encode = null;
}
-
+
public String encode() {
if (encode==null) {
encode = rdd.ns + '|' + rdd.name;
- }
+ }
return encode;
}
public String fullName() {
if (full==null) {
full = rdd.ns + '.' + rdd.name;
- }
+ }
return full;
}
@@ -95,7 +95,7 @@ public class Role implements Comparable<Role> {
private static void load(Trans trans, Session session, String query) {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read Roles", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -123,7 +123,7 @@ public class Role implements Comparable<Role> {
trans.info().log("Found",data.size(),"roles");
}
}
-
+
public static long count(Trans trans, Session session) {
String query = "select count(*) from authz.role LIMIT 1000000;";
trans.info().log( "query: " + query );
@@ -166,11 +166,11 @@ public class Role implements Comparable<Role> {
public static String fullName(String role) {
return role.replace('|', '.');
}
-
+
public static void stageRemove(Role r) {
deleteRoles.add(r);
}
-
+
public static void executeRemove() {
for (Role p : deleteRoles) {
keys.remove(p.encode);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
index dd24d7d9..ae46253c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
@@ -57,7 +57,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
// CACHE Calling
private static final String LOG_FMT = "%s UserRole - %s: %s-%s (%s, %s) expiring %s";
private static final String REPLAY_FMT = "%s|%s|%s|%s|%s\n";
- private static final String DELETE_FMT = "# %s\n"+ REPLAY_FMT;
+ private static final String DELETE_FMT = "# %s\n" + REPLAY_FMT;
private static final List<UserRole> data = new ArrayList<>();
private static final SortedMap<String,List<UserRole>> byUser = new TreeMap<>();
@@ -81,7 +81,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
};
- public UserRole(String user, String ns, String rname, Date expires) {
+ public UserRole(String user, String ns, String rname, Date expires) {
urdd = new UserRoleDAO.Data();
urdd.user = user;
urdd.role = ns + '.' + rname;
@@ -114,7 +114,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void load(Trans trans, Session session, Creator<UserRole> creator) {
load(trans,session,creator,null,new DataLoadVisitor());
}
-
+
public static void load(Trans trans, Session session, Creator<UserRole> creator, Visitor<UserRole> visitor ) {
load(trans,session,creator,null,visitor);
}
@@ -122,19 +122,19 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void loadOneRole(Trans trans, Session session, Creator<UserRole> creator, String role, Visitor<UserRole> visitor) {
load(trans,session,creator,"role='" + role +"' ALLOW FILTERING;",visitor);
}
-
+
public static void loadOneUser(Trans trans, Session session, Creator<UserRole> creator, String user, Visitor<UserRole> visitor ) {
- load(trans,session,creator,"user='"+ user +'\'',visitor);
+ load(trans,session,creator,"user='" + user + '\'',visitor);
}
public static void load(Trans trans, CSV csv, Creator<UserRole> creator, Visitor<UserRole> visitor) throws IOException, CadiException {
// public UserRole(String user, String role, String ns, String rname, Date expires) {
- csv.visit( row ->
+ csv.visit( row ->
visitor.visit(new UserRole(row.get(1),row.get(2),row.get(3),row.get(4),
new Date(Long.parseLong(row.get(6)))))
);
}
-
+
private static void load(Trans trans, Session session, Creator<UserRole> creator, String where, Visitor<UserRole> visitor) {
String query = creator.query(where);
trans.debug().log( "query: " + query );
@@ -189,30 +189,30 @@ public class UserRole implements Cloneable, CacheChange.Data {
lur.add(ur);
}
}
-
+
public int totalLoaded() {
return totalLoaded;
}
-
+
public int deleted() {
return deleted;
}
-
+
@Override
public void expunge() {
data.remove(this);
-
+
List<UserRole> lur = byUser.get(urdd.user);
if (lur!=null) {
lur.remove(this);
}
-
+
lur = byRole.get(urdd.role);
if (lur!=null) {
lur.remove(this);
}
}
-
+
public static void setDeleteStream(PrintStream ds) {
urDelete = ds;
}
@@ -238,27 +238,27 @@ public class UserRole implements Cloneable, CacheChange.Data {
public UserRoleDAO.Data urdd() {
return urdd;
}
-
+
public String user() {
return urdd.user;
}
-
+
public String role() {
return urdd.role;
}
-
+
public String ns() {
return urdd.ns;
}
-
+
public String rname() {
return urdd.rname;
}
-
+
public Date expires() {
return urdd.expires;
}
-
+
public void expires(Date time) {
urdd.expires = time;
}
@@ -296,7 +296,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
cache.delayedDelete(this);
++deleted;
}
-
+
/**
* Calls expunge() for all deleteCached entries
@@ -304,7 +304,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public void row(final CSV.Writer csvw, String tag) {
csvw.row(tag,user(),role(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime());
}
@@ -312,7 +312,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public void row(final CSV.Writer csvw, String tag, String reason) {
csvw.row(tag,user(),role(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime(),reason);
}
-
+
public static Data row(List<String> row) {
Data data = new Data();
data.user = row.get(1);
@@ -350,7 +350,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
sb.append(role());
sb.append("';\n");
}
-
+
public void batchUpdateExpires(StringBuilder sb) {
sb.append("UPDATE authz.user_role SET expires='");
sb.append(Chrono.dateTime(expires()));
@@ -364,7 +364,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static String histMemo(String fmt, List<String> row) {
String reason;
if(row.size()>7) { // Reason included
- reason = String.format("%s removed from %s because %s",
+ reason = String.format("%s removed from %s because %s",
row.get(1),row.get(2),row.get(7));
} else {
reason = String.format(fmt, row.get(1),row.get(2), row.get(5));
@@ -373,7 +373,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
public static String histSubject(List<String> row) {
- return row.get(1) + '|' + row.get(2);
+ return row.get(1) + '|' + row.get(2);
}
public static void clear() {
@@ -381,6 +381,6 @@ public class UserRole implements Cloneable, CacheChange.Data {
byUser.clear();
byRole.clear();
cache.resetLocalData();
-
+
}
} \ No newline at end of file
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
index 38a76477..e1b2e01b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,14 +22,14 @@ package org.onap.aaf.auth.batch.helpers;
public interface Visitor<T> {
void visit(T t);
-
+
public static class Multi<T> implements Visitor<T> {
private final Visitor<T>[] visitors;
@SafeVarargs
public Multi(Visitor<T> ... vs) {
visitors = vs;
}
-
+
@Override
public void visit(T t) {
for(Visitor<T> v : visitors) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
index e2d86947..59b03f6a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,7 +48,7 @@ public class X509 {
public final String x500;
public final String x509;
public ByteBuffer serial;
-
+
public X509(String ca, String id, String x500, String x509, ByteBuffer serial) {
this.ca = ca;
this.id = id;
@@ -56,12 +56,12 @@ public class X509 {
this.x509 = x509;
this.serial = serial;
}
-
+
public static void load(Trans trans, Session session, Visitor<X509> visitor) {
load(trans,session, "" , visitor);
}
-
+
public static void load(Trans trans, Session session, String where, Visitor<X509> visitor) {
load(trans,session, visitor,"select ca, id, x500, x509, serial from authz.x509 " + where +';');
}
@@ -70,7 +70,7 @@ public class X509 {
private static void load(Trans trans, Session session, Visitor<X509> visitor, String query) {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read X509", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -97,7 +97,7 @@ public class X509 {
trans.info().log("Found",count,"X509 Certificates");
}
}
-
+
public static long count(Trans trans, Session session) {
String query = "select count(*) from authz.x509 LIMIT 1000000;";
trans.info().log( "query: " + query );
@@ -111,7 +111,7 @@ public class X509 {
tt.done();
}
}
-
+
public void row(CSV.Writer cw, X509Certificate x509Cert) {
cw.row("x509",ca,Hash.toHex(serial.array()),Chrono.dateOnlyStamp(x509Cert.getNotAfter()),x500);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
index d7d97ad8..78c6ae3a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -75,8 +75,8 @@ public class Analyze extends Batch {
private static final int total=0;
private static final int pending=1;
private static final int approved=2;
-
-
+
+
public static final String NEED_APPROVALS = "NeedApprovals";
private static final String EXTEND = "Extend";
private static final String EXPIRED_OWNERS = "ExpiredOwners";
@@ -92,11 +92,11 @@ public class Analyze extends Batch {
private Range futureRange;
private final String sdate;
private LastNotified ln;
-
+
public Analyze(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -105,13 +105,13 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
minOwners=1;
- // Create Intermediate Output
+ // Create Intermediate Output
writerList = new HashMap<>();
-
+
expireRange = new ExpireRange(trans.env().access());
sdate = Chrono.dateOnlyStamp(now);
for( List<Range> lr : expireRange.ranges.values()) {
@@ -130,7 +130,7 @@ public class Analyze extends Batch {
}
}
}
-
+
// Setup New Approvals file
futureRange = expireRange.newFutureRange();
File file = new File(logDir(),NEED_APPROVALS + sdate +CSV);
@@ -138,14 +138,14 @@ public class Analyze extends Batch {
needApproveCW = approveCSV.writer();
needApproveCW.row(INFO,NEED_APPROVALS,sdate,1);
writerList.put(NEED_APPROVALS,needApproveCW);
-
+
// Setup Extend Approvals file
file = new File(logDir(),EXTEND + sdate +CSV);
CSV extendCSV = new CSV(env.access(),file);
extendCW = extendCSV.writer();
extendCW.row(INFO,EXTEND,sdate,1);
writerList.put(EXTEND,extendCW);
-
+
// Load full data of the following
ln = new LastNotified(session);
@@ -158,17 +158,17 @@ public class Analyze extends Batch {
protected void run(AuthzTrans trans) {
TimeTaken tt;
AuthzTrans noAvg = trans.env().newTransNoAvg();
-
+
////////////////////
// Load all Notifieds, and either add to local Data, or mark for Deletion.
ln.loadAll(noAvg,expireRange.approveDelete,deleteCW);
-
+
// Hold Good Tickets to keyed User/Role for UserRole Step
Map<String,Ticket> mur = new TreeMap<>();
try {
Approval.load(trans, session, Approval.v2_0_17);
-
+
////////////////////
final Map<UUID,Ticket> goodTickets = new TreeMap<>();
tt = trans.start("Analyze Expired Futures",Trans.SUB);
@@ -193,7 +193,7 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
Set<String> approvers = new TreeSet<>();
tt = trans.start("Connect Approvals with Futures",Trans.SUB);
try {
@@ -209,7 +209,7 @@ public class Analyze extends Batch {
} else {
// for users and approvers still valid
String user = appr.getUser();
-
+
if(org.isRevoked(noAvg, appr.getApprover())) {
deleteCW.comment("Approver ID is revoked");
Approval.row(deleteCW, appr);
@@ -225,16 +225,16 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
- /* Run through all Futures, and see if
+
+ /* Run through all Futures, and see if
* 1) they have been executed (no longer valid)
- * 2) The current Approvals indicate they can proceed
+ * 2) The current Approvals indicate they can proceed
*/
Map<String,Pending> pendingApprs = new HashMap<>();
Map<String,Pending> pendingTemp = new HashMap<>();
-
+
String approver;
-
+
tt = trans.start("Analyze Good Tickets",Trans.SUB);
try {
for(Ticket ticket : goodTickets.values()) {
@@ -244,7 +244,7 @@ public class Analyze extends Batch {
case "user_role":
int state[][] = new int[3][3];
int type;
-
+
for(Approval appr : ticket.approvals) {
switch(appr.getType()) {
case "owner":
@@ -276,13 +276,13 @@ public class Analyze extends Batch {
++state[type][unknown];
}
}
-
+
// To Approve:
// Always must have at least 1 owner
if((state[owner][total]>0 && state[owner][approved]>0) &&
// If there are no Supervisors, that's ok
- (state[supervisor][total]==0 ||
- // But if there is a Supervisor, they must have approved
+ (state[supervisor][total]==0 ||
+ // But if there is a Supervisor, they must have approved
(state[supervisor][approved]>0))) {
UserRoleDAO.Data urdd = new UserRoleDAO.Data();
try {
@@ -307,7 +307,7 @@ public class Analyze extends Batch {
}
} finally {
if("user_role".equals(ticket.f.fdd.target)) {
- String key = ticket.f.fdd.target_key;
+ String key = ticket.f.fdd.target_key;
if(key!=null) {
mur.put(key, ticket);
}
@@ -319,7 +319,7 @@ public class Analyze extends Batch {
}
// Good Tickets no longer needed
goodTickets.clear();
-
+
/**
* Decide to Notify about Approvals, based on activity/last Notified
*/
@@ -328,11 +328,11 @@ public class Analyze extends Batch {
GregorianCalendar gc = new GregorianCalendar();
gc.add(GregorianCalendar.DAY_OF_WEEK, 5);
Date remind = gc.getTime();
-
+
for(Entry<String, Pending> es : pendingApprs.entrySet()) {
Pending p = es.getValue();
- if(p.newApprovals()
- || p.earliest() == LastNotified.NEVER // yes, equals.
+ if(p.newApprovals()
+ || p.earliest() == LastNotified.NEVER // yes, equals.
|| p.earliest().after(remind)) {
p.row(needApproveCW,es.getKey());
}
@@ -340,22 +340,22 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
// clear out Approval Intermediates
pendingTemp = null;
pendingApprs = null;
} finally {
}
-
+
/**
- Run through User Roles.
+ Run through User Roles.
Owners are treated specially in next section.
Regular roles are checked against Date Ranges. If match Date Range, write out to appropriate file.
- */
-
+ */
+
try {
Role.load(trans, session);
-
+
try {
tt = trans.start("Analyze UserRoles, storing Owners",Trans.SUB);
Set<String> specialCommented = new HashSet<>();
@@ -391,7 +391,7 @@ public class Analyze extends Batch {
return;
}
// Just let expired UserRoles sit until deleted
- if(futureRange.inRange(ur.expires())&&(!mur.containsKey(ur.user() + '|' + ur.role()))) {
+ if(futureRange.inRange(ur.expires())&&(!mur.containsKey(ur.user() + '|' + ur.role()))) {
// Cannot just delete owners, unless there is at least one left. Process later
if ("owner".equals(ur.rname())) {
Set<UserRole> urs = owners.get(ur.role());
@@ -418,11 +418,11 @@ public class Analyze extends Batch {
tt.done();
}
mur.clear();
-
+
/**
Now Process Owners, one owner Role at a time, ensuring one is left,
- preferably a good one. If so, process the others as normal.
-
+ preferably a good one. If so, process the others as normal.
+
Otherwise, write to ExpiredOwners Report
*/
tt = trans.start("Analyze Owners Separately",Trans.SUB);
@@ -432,7 +432,7 @@ public class Analyze extends Batch {
final CSV ownerCSV = new CSV(env.access(),file);
CSV.Writer expOwner = ownerCSV.writer();
expOwner.row(INFO,EXPIRED_OWNERS,sdate,2);
-
+
try {
for (Set<UserRole> sur : owners.values()) {
int goodOwners = 0;
@@ -441,7 +441,7 @@ public class Analyze extends Batch {
++goodOwners;
}
}
-
+
for (UserRole ur : sur) {
if (goodOwners >= minOwners) {
Range r = writeAnalysis(noAvg, ur);
@@ -473,14 +473,14 @@ public class Analyze extends Batch {
Role.clear();
UserRole.clear();
}
-
+
/**
* Check for Expired Credentials
*/
try {
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
Cred.load(trans, session);
-
+
tt = trans.start("Analyze Expired Credentials",Trans.SUB);
try {
for (Cred cred : Cred.data.values()) {
@@ -509,7 +509,7 @@ public class Analyze extends Batch {
} finally {
Cred.clear();
}
-
+
////////////////////
tt = trans.start("Analyze Expired X509s",Trans.SUB);
try {
@@ -529,7 +529,7 @@ public class Analyze extends Batch {
noAvg.info().log(e);
}
}
-
+
private Approval findApproval(UserRole ur) {
Approval existing = null;
List<Approval> apprs = Approval.byUser.get(ur.user());
@@ -537,7 +537,7 @@ public class Analyze extends Batch {
for(Approval appr : apprs) {
if(ur.role().equals(appr.getRole()) &&
appr.getMemo().contains(Chrono.dateOnlyStamp(ur.expires()))) {
- existing = appr;
+ existing = appr;
}
}
}
@@ -555,7 +555,7 @@ public class Analyze extends Batch {
} catch (OrganizationException e) {
i=null;
}
- if(r.needsContact(lnd,i)) {
+ if(r.needsContact(lnd,i)) {
CSV.Writer cw = writerList.get(r.name());
if(cw!=null) {
ur.row(cw,UserRole.UR);
@@ -564,7 +564,7 @@ public class Analyze extends Batch {
}
return r;
}
-
+
private void writeAnalysis(AuthzTrans noAvg, Cred cred, Instance inst) {
if(cred!=null && inst!=null) {
Range r = expireRange.getRange("cred", inst.expires);
@@ -577,7 +577,7 @@ public class Analyze extends Batch {
} catch (OrganizationException e) {
i=null;
}
- if(r.needsContact(lnd,i)) {
+ if(r.needsContact(lnd,i)) {
CSV.Writer cw = writerList.get(r.name());
if(cw!=null) {
cred.row(cw,inst);
@@ -606,7 +606,7 @@ public class Analyze extends Batch {
}
}
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
index 880173b9..a6c49f08 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,18 +49,18 @@ import com.datastax.driver.core.Statement;
public class ApprovedRpt extends Batch {
-
+
private static final String APPR_RPT = "ApprovedRpt";
private static final String CSV = ".csv";
private Date now;
private Writer approvedW;
private CSV historyR;
private static String yr_mon;
-
+
public ApprovedRpt(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
// TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -69,15 +69,15 @@ public class ApprovedRpt extends Batch {
// } finally {
// tt.done();
// }
-
+
now = new Date();
String sdate = Chrono.dateOnlyStamp(now);
File file = new File(logDir(),APPR_RPT + sdate +CSV);
CSV csv = new CSV(env.access(),file);
approvedW = csv.writer(false);
-
+
historyR = new CSV(env.access(),args()[1]).setDelimiter('|');
-
+
yr_mon = args()[0];
} finally {
tt0.done();
@@ -86,7 +86,7 @@ public class ApprovedRpt extends Batch {
@Override
protected void run(AuthzTrans trans) {
- try {
+ try {
// ResultSet results;
// Statement stmt = new SimpleStatement( "select dateof(id), approver, status, user, type, memo from authz.approved;" );
// results = session.execute(stmt);
@@ -132,15 +132,15 @@ public class ApprovedRpt extends Batch {
}
}
});
-
+
} catch (Exception e) {
trans.info().log(e);
}
}
-
+
private void write(String a_or_d, List<String> row) {
String[] target = Split.splitTrim('|', row.get(4));
-
+
if(target.length>1) {
UUID id = UUID.fromString(row.get(0));
Date date = Chrono.uuidToDate(id);
@@ -166,7 +166,7 @@ public class ApprovedRpt extends Batch {
}
}
-
+
}
}
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 bd56fc2e..82542e15 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,20 +45,20 @@ import org.onap.aaf.misc.env.util.Chrono;
public class NotInOrg extends Batch {
-
+
private static final String NOT_IN_ORG = "NotInOrg";
private static final String CSV = ".csv";
private static final String INFO = "info";
private Map<String, CSV.Writer> writerList;
- private Map<String, CSV.Writer> whichWriter;
+ private Map<String, CSV.Writer> whichWriter;
private Date now;
private Writer notInOrgW;
private Writer notInOrgDeleteW;
-
+
public NotInOrg(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -67,11 +67,11 @@ public class NotInOrg extends Batch {
} finally {
tt.done();
}
-
+
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
Cred.load(trans, session);
- // Create Intermediate Output
+ // Create Intermediate Output
writerList = new HashMap<>();
whichWriter = new TreeMap<>();
@@ -82,7 +82,7 @@ public class NotInOrg extends Batch {
notInOrgW = csv.writer(false);
notInOrgW.row(INFO,NOT_IN_ORG,Chrono.dateOnlyStamp(now),0);
writerList.put(NOT_IN_ORG,notInOrgW);
-
+
// These will have been double-checked by the Organization, and can be deleted immediately.
String fn = NOT_IN_ORG+"Delete";
file = new File(logDir(),fn + sdate +CSV);
@@ -90,7 +90,7 @@ public class NotInOrg extends Batch {
notInOrgDeleteW = csvDelete.writer(false);
notInOrgDeleteW.row(INFO,fn,Chrono.dateOnlyStamp(now),0);
writerList.put(NOT_IN_ORG,notInOrgW);
-
+
} finally {
tt0.done();
}
@@ -102,7 +102,7 @@ public class NotInOrg extends Batch {
Map<String,Boolean> checked = new TreeMap<String, Boolean>();
trans.info().log("Process Organization Identities");
trans.info().log("User Roles");
-
+
final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
UserRole.load(trans, session, UserRole.v2_0_11, ur -> {
try {
@@ -113,9 +113,9 @@ public class NotInOrg extends Batch {
trans.error().log(e, "Error Decrypting X509");
}
});
-
+
trans.info().log("Checking for Creds without IDs");
-
+
for (Cred cred : Cred.data.values()) {
if(!check(transNoAvg,checked, cred.id)) {
CSV.Writer cw = whichWriter(transNoAvg, cred.id);
@@ -124,13 +124,13 @@ public class NotInOrg extends Batch {
}
}
}
-
+
} catch (OrganizationException e) {
trans.info().log(e);
}
}
-
-
+
+
private Writer whichWriter(AuthzTrans transNoAvg, String id) {
Writer w = whichWriter.get(id);
if(w==null) {
@@ -146,7 +146,7 @@ public class NotInOrg extends Batch {
Boolean rv = checked.get(id);
if(rv==null) {
if(isSpecial(id)) { // do not check against org... too important to delete.
- return true;
+ return true;
}
Organization org = trans.org();
if(org != null) {
@@ -160,7 +160,7 @@ public class NotInOrg extends Batch {
return rv;
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
index 54cb7378..981f300d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -134,7 +134,7 @@ import org.onap.aaf.misc.env.util.Chrono;
}
urgent = false;
-
+
sb.setLength(0);
fhh = new File(footer_html);
if(!fhh.exists()) {
@@ -153,14 +153,14 @@ import org.onap.aaf.misc.env.util.Chrono;
}
noAvg = trans.env().newTransNoAvg();
- cqlBatch = new CQLBatch(noAvg.debug(),session);
+ cqlBatch = new CQLBatch(noAvg.debug(),session);
cbl = new CQLBatchLoop(cqlBatch,50,dryRun);
-
+
lastN = new LastNotified(session);
}
/*
- * Note: We try to put things related to Notify as Main Class in Run, where we might have put in
+ * Note: We try to put things related to Notify as Main Class in Run, where we might have put in
* Constructor, so that we can have other Classes call just the "notify" method.
*/
@Override
@@ -175,7 +175,7 @@ import org.onap.aaf.misc.env.util.Chrono;
NotifyBody.load(env.access());
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
Set<File> notifyFile = new HashSet<>();
if(args().length>0) {
@@ -219,14 +219,14 @@ import org.onap.aaf.misc.env.util.Chrono;
e.printStackTrace();
}
- }
+ }
// now create Notification
for(NotifyBody nb : NotifyBody.getAll()) {
int count = notify(noAvg, nb);
trans.info().printf("Emailed %d for %s",count,nb.name());
}
-
+
//
// Do Pending Approval Notifies. We do this separately, because we are consolidating
// all the new entries, etc.
@@ -238,7 +238,7 @@ import org.onap.aaf.misc.env.util.Chrono;
csvList.add(new CSV(access,f));
}
}
-
+
Map<String,Pending> mpending = new TreeMap<>();
Holder<Integer> count = new Holder<>(0);
for(CSV approveCSV : csvList) {
@@ -261,7 +261,7 @@ import org.onap.aaf.misc.env.util.Chrono;
count.set(count.get()+1);
} catch (ParseException e) {
trans.error().log(e);
- }
+ }
break;
}
});
@@ -272,23 +272,23 @@ import org.onap.aaf.misc.env.util.Chrono;
}
}
trans.info().printf("Read %d Reminder Rows", count.get());
-
+
NotifyPendingApprBody npab = new NotifyPendingApprBody(access);
GregorianCalendar gc = new GregorianCalendar();
gc.add(GregorianCalendar.DAY_OF_MONTH, 7); // Get from INFO?
Date oneWeek = gc.getTime();
CSV.Saver rs = new CSV.Saver();
-
+
TimeTaken tt = trans.start("Obtain Last Notifications for Approvers", Trans.SUB);
try {
lastN.add(mpending.keySet());
} finally {
tt.done();
}
-
+
Pending p;
-
+
tt = trans.start("Notify for Pending", Trans.SUB);
List<String> idList = new ArrayList<>();
String id;
@@ -336,7 +336,7 @@ import org.onap.aaf.misc.env.util.Chrono;
String run = nb.type()+nb.name();
String test = dryRun?run:null;
-
+
ONE_EMAIL:
for(String id : nb.users()) {
toList.clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
index bcdd4401..072363f0 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,9 +51,9 @@ public class PrepExtend extends Batch {
/**
* Create a list of Creds and UserRoles to extend
* Note: Certificates cannot be renewed in this way.
- *
+ *
* Arguments From (0 = today, -2 = 2 weeks back) and To (weeks from today)
- *
+ *
* @param trans
* @throws APIException
* @throws IOException
@@ -80,15 +80,15 @@ public class PrepExtend extends Batch {
protected void run(AuthzTrans trans) {
GregorianCalendar gc = new GregorianCalendar();
Date now = gc.getTime();
-
+
int ifrom = 0;
int ito = 4;
-
+
for(int i=0; i< args().length;++i) {
switch(args()[i]) {
case "-from":
if(args().length>i+1) {
- ifrom = Integer.parseInt(args()[i++ +1]);
+ ifrom = Integer.parseInt(args()[i++ +1]);
}
break;
case "-to":
@@ -102,23 +102,23 @@ public class PrepExtend extends Batch {
System.err.println("Invalid -from param");
return;
}
-
+
if(ito<=0 || ito>24 || ifrom>ito) {
System.err.println("Invalid -to param");
return;
}
-
+
// Make sure to is Zero based from today.
if(ifrom<0) {
ito+= ifrom*-1;
}
-
+
gc.add(GregorianCalendar.WEEK_OF_MONTH, ifrom);
Date from = gc.getTime();
-
+
gc.add(GregorianCalendar.WEEK_OF_MONTH, ito /* with From calculated in */);
Date to = gc.getTime();
-
+
try {
File file = new File(logDir(), PREP_EXTEND + Chrono.dateOnlyStamp(now) + CSV);
final CSV puntCSV = new CSV(env.access(),file);
@@ -128,7 +128,7 @@ public class PrepExtend extends Batch {
try {
trans.info().log("Process UserRoles for Extending");
/**
- Run through User Roles.
+ Run through User Roles.
If match Date Range, write out to appropriate file.
*/
UserRole.load(trans, session, UserRole.v2_0_11, ur -> {
@@ -136,7 +136,7 @@ public class PrepExtend extends Batch {
ur.row(cw,UserRole.UR);
}
});
-
+
trans.info().log("Process BasicAuth for Extending");
TimeTaken tt0 = trans.start("Load Credentials", Env.REMOTE);
try {
@@ -148,7 +148,7 @@ public class PrepExtend extends Batch {
/**
- Run through Creds.
+ Run through Creds.
If match Date Range, write out to appropriate file.
*/
Map<Integer,Instance> imap = new HashMap<>();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
index 6c95f02e..04814e01 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,13 +53,13 @@ public abstract class NotifyBody {
protected Map<String,List<List<String>>> rows;
protected final String env;
protected final String gui_url;
-
+
private final String name;
private final String type;
private String date;
private int escalation;
private int count;
-
+
public NotifyBody(Access access, final String type, final String name) {
rows = new TreeMap<>();
this.name = name;
@@ -70,7 +70,7 @@ public abstract class NotifyBody {
env = access.getProperty("CASS_ENV","DEVL");
gui_url = access.getProperty("GUI_URL", "");
}
-
+
public void store(List<String> row) {
if(!row.isEmpty()) {
if("info".equals(row.get(0))) {
@@ -84,7 +84,7 @@ public abstract class NotifyBody {
} else if(type.equals(row.get(0))) {
String user = user(row);
if(user!=null) {
- List<List<String>> lss = rows.get(user);
+ List<List<String>> lss = rows.get(user);
if(lss == null) {
lss = new ArrayList<>();
rows.put(user,lss);
@@ -98,25 +98,25 @@ public abstract class NotifyBody {
public String name() {
return name;
}
-
+
public String type() {
return type;
}
-
+
public String date() {
return date;
}
public int escalation() {
return escalation;
}
-
+
public Set<String> users() {
return rows.keySet();
}
-
+
/**
* ID must be set from Row for Email lookup
- *
+ *
* @param trans
* @param n
* @param id
@@ -124,30 +124,30 @@ public abstract class NotifyBody {
* @return
*/
public abstract boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id);
-
+
/**
* Return "null" if user not found in row... Code will handle.
* @param row
* @return
*/
protected abstract String user(List<String> row);
-
+
/**
* Provide a context-sensitive Subject, which includes ENV as well as details
- *
+ *
* @return
*/
public abstract String subject();
/**
* Record the fact that a particular Notification was marked as "sent" by Emailer.
- *
+ *
* @param trans
* @param approver
* @param ln
*/
public abstract void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified ln);
-
+
/**
* Get Notify Body based on key of
* type|name
@@ -155,10 +155,10 @@ public abstract class NotifyBody {
public static NotifyBody get(String key) {
return bodyMap.get(key);
}
-
+
/**
* Return set of loaded NotifyBodies
- *
+ *
*/
public static Collection<NotifyBody> getAll() {
// Note: The same Notify Body is entered several times with different keys.
@@ -167,11 +167,11 @@ public abstract class NotifyBody {
set.addAll(bodyMap.values());
return set;
}
-
+
/**
- * @param propAccess
- * @throws URISyntaxException
- *
+ * @param propAccess
+ * @throws URISyntaxException
+ *
*/
public static void load(Access access) throws APIException, IOException {
// class load available NotifyBodies
@@ -199,7 +199,7 @@ public abstract class NotifyBody {
File dir = new File(url.getFile());
for( String f : dir.list()) {
if(f.endsWith(".class")) {
- classNames.add(pkg.getName()+'.'+f.substring(0,f.length()-6));
+ classNames.add(pkg.getName() + '.' + f.substring(0,f.length() - 6));
}
}
}
@@ -210,8 +210,8 @@ public abstract class NotifyBody {
Constructor<?> cst = c.getConstructor(Access.class);
NotifyBody nb = (NotifyBody)cst.newInstance(access);
if(nb!=null) {
- bodyMap.put("info|"+nb.name, nb);
- bodyMap.put(nb.type+'|'+nb.name, nb);
+ bodyMap.put("info|" + nb.name, nb);
+ bodyMap.put(nb.type+'|' + nb.name, nb);
}
}
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
@@ -221,14 +221,14 @@ public abstract class NotifyBody {
}
protected void print(StringBuilder sb, int indent, Object ... objs) {
- for(int i=0;i<indent;++i) {
+ for(int i = 0; i < indent; ++i) {
sb.append(' ');
}
for(Object o : objs) {
sb.append(o.toString());
}
}
-
+
protected void println(StringBuilder sb, int indent, Object ... objs) {
print(sb,indent,objs);
sb.append('\n');
@@ -246,15 +246,15 @@ public abstract class NotifyBody {
}
return current; // use to set prev...
}
-
+
protected void printCell(StringBuilder sb, int indent, String current) {
println(sb,indent,"<td>",current,"</td>");
}
-
+
public synchronized void inc() {
++count;
}
-
+
public int count() {
return count;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
index 67013a9a..1ef83441 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,16 +35,16 @@ public abstract class NotifyCredBody extends NotifyBody {
private final String explanation;
private final String instruction;
-
+
public NotifyCredBody(Access access, String name) {
super(access,"cred",name);
-
+
// Default
explanation = "The following Credentials that you are responsible for "
+ "are expiring on the dates shown. <br><br>"
;
-
- instruction = "<br><h3>Instructions for 'Password':</h3><ul>"
+
+ instruction = "<br><h3>Instructions for 'Password':</h3><ul>"
+ "<li><b><i>Click</i></b> on the Fully Qualified ID to ADD a new Password</li>"
+ "<li><b>REMEMBER!</b> You are not finished until you <ol>"
+ "<li><b>CHANGE <i>ALL</i></b> the configurations on <b><i>ALL</i></b> your processes!!</li>"
@@ -52,7 +52,7 @@ public abstract class NotifyCredBody extends NotifyBody {
+ "<li>IF there is a WARNING, click the link for more information</li>"
+ "</ul>";
}
-
+
/**
* Default Dynamic Text. Override is expected
* @return
@@ -67,15 +67,15 @@ public abstract class NotifyCredBody extends NotifyBody {
print(sb,indent,dynamic());
println(sb,indent,instruction);
println(sb,indent,"<table>");
- indent+=2;
+ indent += 2;
println(sb,indent,"<tr>");
- indent+=2;
+ indent += 2;
println(sb,indent,"<th>Fully Qualified ID</th>");
println(sb,indent,"<th>Unique ID</th>");
println(sb,indent,"<th>Type</th>");
println(sb,indent,"<th>Expires</th>");
println(sb,indent,"<th>Warnings</th>");
- indent-=2;
+ indent -= 2;
println(sb,indent,"</tr>");
String theid;
String type;
@@ -97,13 +97,13 @@ public abstract class NotifyCredBody extends NotifyBody {
type = "Unknown, see AAF GUI";
break;
}
- theid = "<a href=\""+n.guiURL+"/creddetail?ns="+row.get(2)+"\">"+theid+"</a>";
+ theid = "<a href=\"" + n.guiURL + "/creddetail?ns=" + row.get(2) + "\">" + theid + "</a>";
gc.setTimeInMillis(Long.parseLong(row.get(5)));
expires = Chrono.niceUTCStamp(gc);
info = row.get(6);
- //TODO get Warnings
+ //TODO get Warnings
warnings = "";
-
+
println(sb,indent,"<tr>");
indent+=2;
printCell(sb,indent,theid);
@@ -116,10 +116,10 @@ public abstract class NotifyCredBody extends NotifyBody {
}
indent-=2;
println(sb,indent,"</table>");
-
+
return true;
}
-
+
@Override
public void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified ln) {
for(List<String> row : rows.get(id)) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
index 76a44166..cfb0f3c8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ public class NotifyPendingApprBody extends NotifyBody {
rv = true;
break; // only one
}
-
+
return rv;
}
@@ -64,7 +64,7 @@ public class NotifyPendingApprBody extends NotifyBody {
return String.format("AAF Pending Approval Notification (ENV: %s)",env);
}
-
+
@Override
public void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified lastN) {
for(String n : notified) {
@@ -72,7 +72,7 @@ public class NotifyPendingApprBody extends NotifyBody {
lastN.update(query,n,"pending","");
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyBody#store(java.util.List)
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
index d4c0463f..1c1a25a5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,12 +29,12 @@ public class OneMonthNotifyCredBody extends NotifyCredBody {
public OneMonthNotifyCredBody(Access access) {
super(access, ExpireRange.ONE_MONTH);
}
-
+
@Override
public String subject() {
return String.format("AAF One Month Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
index 3362a251..bd7a0dfd 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@ public class OneWeekNotifyCredBody extends NotifyCredBody {
public String subject() {
return String.format("AAF Final Week Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
index 1a047754..d986e580 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ public class TwoMonthNotifyCredBody extends NotifyCredBody {
public TwoMonthNotifyCredBody(Access access) {
super(access, ExpireRange.TWO_MONTH);
}
-
+
@Override
public String subject() {
return String.format("AAF Two Month Credential Notification (ENV: %s)",env);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
index a802bb4e..0264d349 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ public class TwoWeeksNotifyCredBody extends NotifyCredBody {
public String subject() {
return String.format("AAF Two Week Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
index e2d052ac..e3164571 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,11 +52,11 @@ import com.datastax.driver.core.Row;
public class DataMigrateDublin extends Batch {
private final SecureRandom sr;
private final AuthzTrans noAvg;
-
+
public DataMigrateDublin(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("Migrate"));
@@ -71,7 +71,7 @@ public class DataMigrateDublin extends Batch {
} finally {
tt0.done();
}
-
+
sr = new SecureRandom();
}
@@ -97,7 +97,7 @@ public class DataMigrateDublin extends Batch {
switch(type) {
case CredDAO.BASIC_AUTH:
case CredDAO.BASIC_AUTH_SHA256:
- String key = row.getString(0) + '|' + type + '|' + Hash.toHex(row.getBytesUnsafe(3).array());
+ String key = row.getString(0) + '|' + type + '|' + Hash.toHex(row.getBytesUnsafe(3).array());
String btag = ba_tag.get(key);
if(btag == null) {
if(tag==null || tag.isEmpty()) {
@@ -108,7 +108,7 @@ public class DataMigrateDublin extends Batch {
}
ba_tag.put(key, btag);
}
-
+
if(!btag.equals(tag)) {
update(cbl,row,btag);
}
@@ -129,9 +129,9 @@ public class DataMigrateDublin extends Batch {
cbl.flush();
trans.info().printf("Processes %d cred records, updated %d records in %d batches.", count, cbl.total(), cbl.batches());
count = 0;
-
+
cbl.reset();
-
+
trans.info().log("Add Serial to X509 Creds");
rs = session.execute("SELECT ca, id, x509 FROM authz.x509");
iter = rs.iterator();
@@ -164,18 +164,18 @@ public class DataMigrateDublin extends Batch {
trans.error().log(e);
}
}
-
+
private static class CredInfo {
public final String id;
public final int type;
public final Date expires;
-
+
public CredInfo(String id, int type, Date expires) {
this.id = id;
this.type = type;
this.expires = expires;
}
-
+
public void update(CQLBatchLoop cbl, String newtag) {
StringBuilder sb = cbl.inc();
sb.append("UPDATE authz.cred SET tag='");
@@ -189,7 +189,7 @@ public class DataMigrateDublin extends Batch {
sb.append("));");
}
}
-
+
private void update(CQLBatchLoop cbl, Row row, String newtag) {
StringBuilder sb = cbl.inc();
sb.append("UPDATE authz.cred SET tag='");
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
index 43e234b2..c63a8a9f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -63,7 +63,7 @@ public class Approvals extends Batch {
private final String sdate;
private static final String CSV = ".csv";
private static final String APPROVALS_NEW = "ApprovalsNew";
-
+
public Approvals(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
now = new GregorianCalendar();
@@ -95,13 +95,13 @@ public class Approvals extends Batch {
trans.error().printf("CSV File %s does not exist",f.getAbsolutePath());
}
}
-
+
File file = new File(logDir(),APPROVALS_NEW + sdate +CSV);
CSV approveCSV = new CSV(env.access(),file);
napproveCW = approveCSV.writer();
napproveCW.row("info",APPROVALS_NEW,sdate,1);
-
+
}
@Override
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
index c65130cf..86381008 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,11 +56,11 @@ public class Extend extends Batch {
private List<File> extFiles;
private final int extendBy;
private int gcType;
-
+
public Extend(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("Extend"));
@@ -73,14 +73,14 @@ public class Extend extends Batch {
} finally {
tt.done();
}
- cqlBatch = new CQLBatch(noAvg.info(),session);
+ cqlBatch = new CQLBatch(noAvg.info(),session);
} finally {
tt0.done();
}
gcType = GregorianCalendar.WEEK_OF_YEAR;
int weeks = 4;
-
+
Set<String> cmd = new HashSet<>();
for(int i=0; i< args().length;++i) {
if("-weeks".equals(args()[i])) {
@@ -91,13 +91,13 @@ public class Extend extends Batch {
cmd.add(args()[i]);
}
}
-
+
if(weeks<1 || weeks > 24) {
throw new APIException("Invalid --weeks");
}
extendBy = weeks;
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
extFiles = new ArrayList<>();
if(cmd.isEmpty()) {
@@ -107,7 +107,7 @@ public class Extend extends Batch {
extFiles.add(new File(logDir, fn));
}
}
-
+
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
// to find the last one.
}
@@ -130,7 +130,7 @@ public class Extend extends Batch {
CSV csv = new CSV(env.access(),f);
try {
csv.visit(new CSV.Visitor() {
- final Holder<Integer> hi = new Holder<>(0);
+ final Holder<Integer> hi = new Holder<>(0);
@Override
public void visit(List<String> row) throws IOException, CadiException {
@@ -199,12 +199,12 @@ public class Extend extends Batch {
e.printStackTrace();
}
}
-
+
// Cleanup, if required.
cqlBatch.execute(dryRun);
}
-
+
@Override
protected void _close(AuthzTrans trans) {
trans.info().log("End " + this.getClass().getSimpleName() + " processing" );
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
index 89fbfacc..087ab952 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,9 +76,7 @@ public class Remove extends Batch {
} finally {
tt2.done();
}
- cqlBatch = new CQLBatch(noAvg.info(),session);
-
-
+ cqlBatch = new CQLBatch(noAvg.info(),session);
} finally {
tt0.done();
}
@@ -87,7 +85,7 @@ public class Remove extends Batch {
@Override
protected void run(AuthzTrans trans) {
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
List<File> remove = new ArrayList<>();
@@ -116,7 +114,7 @@ public class Remove extends Batch {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
hdd.yr_mon = Integer.parseInt(sdf.format(new Date()));
- try {
+ try {
final CQLBatchLoop cbl = new CQLBatchLoop(cqlBatch,50,dryRun);
for(File f : remove) {
trans.info().log("Processing ",f.getAbsolutePath(),"for Deletions");
@@ -140,9 +138,9 @@ public class Remove extends Batch {
ur.set(true);
}
//TODO If deleted because Role is no longer there, double check...
-
+
UserRole.batchDelete(cbl.inc(),row);
- hdd.target=UserRoleDAO.TABLE;
+ hdd.target=UserRoleDAO.TABLE;
hdd.subject=UserRole.histSubject(row);
hdd.memo=UserRole.histMemo(memoFmt.get(), row);
historyDAO.createBatch(cbl.inc(), hdd);
@@ -152,7 +150,7 @@ public class Remove extends Batch {
cred.set(true);
}
Cred.batchDelete(cbl.inc(),row);
- hdd.target=CredDAO.TABLE;
+ hdd.target=CredDAO.TABLE;
hdd.subject=Cred.histSubject(row);
hdd.memo=Cred.histMemo(memoFmt.get(), orgName,row);
historyDAO.createBatch(cbl.inc(), hdd);
@@ -162,7 +160,7 @@ public class Remove extends Batch {
x509.set(true);
}
X509.batchDelete(cbl.inc(),row);
- hdd.target="x509";
+ hdd.target="x509";
hdd.subject=X509.histSubject(row);
hdd.memo=X509.histMemo(memoFmt.get(),row);
historyDAO.createBatch(cbl.inc(), hdd);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
index e2580ae8..b0db0a79 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,7 +53,7 @@ public class Upload extends Batch {
public Upload(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -62,9 +62,9 @@ public class Upload extends Batch {
} finally {
tt.done();
}
-
+
cqlBatch = new CQLBatch(LogTarget.NULL,session);
-
+
feeds=new HashMap<>();
new Feed(feeds,"ns",1,"name,description,parent,scope=int,type=int",300);
new Feed(feeds,"notified",3,"user,target,key,last",300);
@@ -114,7 +114,7 @@ public class Upload extends Batch {
trans.info().log(msg);
System.out.println(msg);
CQLBatchLoop cbl = new CQLBatchLoop(cqlBatch,feed.batchSize,dryRun).showProgress();
-
+
try {
if(file.exists()) {
CSV csv = new CSV(trans.env().access(),file).setDelimiter('|');
@@ -135,7 +135,7 @@ public class Upload extends Batch {
}
}
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
@@ -162,7 +162,7 @@ public class Upload extends Batch {
}
feeds.put(feed,this);
}
-
+
public String getName() {
return name;
}
@@ -198,7 +198,7 @@ public class Upload extends Batch {
break;
default:
values.append('\'');
- values.append(value.replaceAll("'","''"));
+ values.append(value.replaceAll("'","''"));
values.append('\'');
}
} else switch(type) {
@@ -210,7 +210,7 @@ public class Upload extends Batch {
default:
values.append(value);
break;
-
+
}
}
}