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%2FUserRole.java;h=bea3b5ec946aa67e329481ee2c21b8ed957d281b;hb=fad7e682d0a0bbb8e218dabd9381634955ff80ad;hp=30069d64bea74c080188b374ea05fd55ea5540cc;hpb=71340cf50ea2c0fc9cfd0670052c4b4fcabe3db6;p=aaf%2Fauthz.git 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 30069d64..bea3b5ec 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 @@ -309,10 +309,10 @@ public class UserRole implements Cloneable, CacheChange.Data { } public void row(final CSV.Writer csvw) { - csvw.row("ur",user(),ns(),rname(),Chrono.dateOnlyStamp(expires())); + csvw.row("ur",user(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime()); } - public static void row(StringBuilder sb, List row) { + public static void batchDelete(StringBuilder sb, List row) { sb.append("DELETE from authz.user_role WHERE user='"); sb.append(row.get(1)); sb.append("' AND role='"); @@ -321,6 +321,24 @@ public class UserRole implements Cloneable, CacheChange.Data { sb.append(row.get(3)); sb.append("';\n"); } + + public static void batchExtend(StringBuilder sb, List row, String newDate ) { + sb.append("UPDATE authz.user_role SET expires='"); + sb.append(newDate); + sb.append("' WHERE user='"); + sb.append(row.get(1)); + sb.append("' AND role='"); + sb.append(row.get(2)); + sb.append('.'); + sb.append(row.get(3)); + sb.append("';\n"); + } + public static String histMemo(String fmt, List row) { + return String.format(fmt, row.get(1),row.get(2)+'.'+row.get(3), row.get(4)); + } + public static String histSubject(List row) { + return row.get(1) + '|' + row.get(2)+'.'+row.get(3); + } } \ No newline at end of file