From 83b93fc82cc39590f1f3aa1e92a53f37cd191416 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 5 Nov 2019 14:19:36 -0600 Subject: Fix Batch Cred Deletes Issue-ID: AAF-1038 Change-Id: I30ea4ec04cd3ca6c416010f99e46aa44c5f2fd24 Signed-off-by: Instrumental --- .../src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java | 5 +---- .../src/main/java/org/onap/aaf/auth/batch/update/Remove.java | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'auth/auth-batch/src') 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 49309004..4c14f0fd 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 @@ -316,7 +316,7 @@ public class Cred { } public static void batchDelete(StringBuilder sb, List row) { - Long l = Long.parseLong(row.get(5)); + long l = Long.parseLong(row.get(5)); String date = Chrono.batchFmt.format(new Date(l)); sb.append("DELETE from authz.cred WHERE id='"); sb.append(row.get(1)); @@ -326,9 +326,6 @@ public class Cred { sb.append(" AND expires='"); sb.append(date); sb.append("';\n"); -// sb.append(" AND expires=dateof(maxtimeuuid("); -// sb.append(row.get(5)); -// sb.append("));\n"); } 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 087ab952..3d26ce99 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 @@ -94,7 +94,14 @@ public class Remove extends Batch { remove.add(new File(logDir, args()[i])); } } else { - remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv")); + final String ending = Chrono.dateOnlyStamp()+".csv"; + for (File file : logDir.listFiles(f -> { + String name = f.getName(); + return name.endsWith(ending) && ( + name.startsWith("Delete") || name.startsWith("Clean.")); + })) { + remove.add(file); + }; } for(File f : remove) { -- cgit 1.2.3-korg