X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Fhelpers%2FCred.java;h=1f5a1f409ba48f4ee63dcd5349a4213ceede7306;hb=886cd982dff59ef087b94a3b6eb0e4be37259019;hp=f566933174156551faee23ccc252c29ab95dacc3;hpb=bd7def7ee2098af56ce66752f59c062d7923fb69;p=aaf%2Fauthz.git 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 f5669331..1f5a1f40 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 @@ -79,29 +79,29 @@ public class Cred { * @return */ public List notes() { - return notes; + return notes; } public void addNote(int level, String note) { - if(notes==null) { - notes=new ArrayList<>(); - } - notes.add(new Note(level,note)); + if(notes==null) { + notes=new ArrayList<>(); + } + notes.add(new Note(level,note)); } public String toString() { - return expires.toString() + ": " + type + ' ' + tag; + 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; - } + public final int level; + public final String note; + + public Note(int level, String note) { + this.level = level; + this.note = note; + } } public Date last(final int ... types) { Date last = null; @@ -168,7 +168,7 @@ public class Cred { boolean hastype = false; for (int t : types) { if (t==type) { - hastype=true; + hastype=true; break; } } @@ -177,7 +177,7 @@ public class Cred { } } add(row.getString(0), row.getInt(1),row.getTimestamp(2),row.getInt(3),row.getLong(4), - row.getString(5)); + row.getString(5)); } } finally { tt.done(); @@ -188,13 +188,13 @@ public class Cred { } public static void add( - final String id, - final int type, - final Date timestamp, - final int other, - final long written, - final String tag - ) { + final String id, + final int type, + final Date timestamp, + final int other, + final long written, + final String tag + ) { Cred cred = data.get(id); if (cred==null) { cred = new Cred(id); @@ -216,10 +216,10 @@ public class Cred { if (!found) { lscd.add(cred); } - } + } - /** + /** * Count entries in Cred data. * Note, as opposed to other methods, need to load the whole cred table for the Types. * @param numbuckets @@ -306,28 +306,28 @@ public class Cred { } 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); + csvw.row("cred",id,ns,Integer.toString(inst.type),Chrono.dateOnlyStamp(inst.expires), + inst.expires.getTime(),inst.tag); } public void row(final CSV.Writer csvw, final Instance inst, final String reason) { - csvw.row("cred",id,ns,Integer.toString(inst.type),Chrono.dateOnlyStamp(inst.expires), - inst.expires.getTime(),inst.tag,reason); + csvw.row("cred",id,ns,Integer.toString(inst.type),Chrono.dateOnlyStamp(inst.expires), + inst.expires.getTime(),inst.tag,reason); } public static void batchDelete(StringBuilder sb, List row) { - sb.append("DELETE from authz.cred WHERE id='"); - sb.append(row.get(1)); - sb.append("' AND type="); - sb.append(Integer.parseInt(row.get(3))); - // Note: We have to work with long, because Expires is part of Key... can't easily do date. - sb.append(" AND expires=dateof(maxtimeuuid("); - sb.append(row.get(5)); - sb.append("));\n"); - } + sb.append("DELETE from authz.cred WHERE id='"); + sb.append(row.get(1)); + sb.append("' AND type="); + sb.append(Integer.parseInt(row.get(3))); + // Note: We have to work with long, because Expires is part of Key... can't easily do date. + sb.append(" AND expires=dateof(maxtimeuuid("); + sb.append(row.get(5)); + sb.append("));\n"); + } - public String toString() { + public String toString() { StringBuilder sb = new StringBuilder(id); sb.append('['); for (Instance i : instances) { @@ -358,24 +358,24 @@ public class Cred { } - public static String histSubject(List row) { - return row.get(1); - } + public static String histSubject(List row) { + return row.get(1); + } - public static String histMemo(String fmt, String orgName, List row) { - String reason; - if(row.size()>5) { // Reason included - reason = row.get(5); - } else { - reason = String.format(fmt, row.get(1),orgName,row.get(4)); - } - return reason; - } + public static String histMemo(String fmt, String orgName, List row) { + String reason; + if(row.size()>5) { // Reason included + reason = row.get(5); + } else { + reason = String.format(fmt, row.get(1),orgName,row.get(4)); + } + return reason; + } - public static void clear() { - data.clear(); - byNS.clear(); - } + public static void clear() { + data.clear(); + byNS.clear(); + } } \ No newline at end of file