X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Fupdate%2FRemove.java;h=bcc8591a0d239f06cbc55fda44092c0712fe383a;hb=59ffb7d529245c3bd0233dbf6cb0ae9fe9ccb856;hp=3e1a8df2f1b9e1c97686b8cc5f06fe0c65be5e50;hpb=8838d6b2f3fcaf0f6d0c87f6bfb18a3e9e012394;p=aaf%2Fauthz.git 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 3e1a8df2..bcc8591a 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 @@ -31,8 +31,10 @@ import java.util.List; import org.onap.aaf.auth.batch.Batch; import org.onap.aaf.auth.batch.BatchPrincipal; +import org.onap.aaf.auth.batch.helpers.Approval; import org.onap.aaf.auth.batch.helpers.CQLBatch; import org.onap.aaf.auth.batch.helpers.Cred; +import org.onap.aaf.auth.batch.helpers.Future; import org.onap.aaf.auth.batch.helpers.UserRole; import org.onap.aaf.auth.batch.helpers.X509; import org.onap.aaf.auth.dao.CassAccess; @@ -71,7 +73,7 @@ public class Remove extends Batch { } finally { tt2.done(); } - cqlBatch = new CQLBatch(session); + cqlBatch = new CQLBatch(noAvg.info(),session); } finally { @@ -84,7 +86,7 @@ public class Remove extends Batch { final int maxBatch = 25; // Create Intermediate Output - File logDir = new File(logDir()); + File logDir = logDir(); List remove = new ArrayList<>(); if(args().length>0) { @@ -95,6 +97,10 @@ public class Remove extends Batch { remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv")); } + for(File f : remove) { + trans.init().log("Processing File:",f.getAbsolutePath()); + } + final Holder ur = new Holder<>(false); final Holder cred = new Holder<>(false); final Holder x509 = new Holder<>(false); @@ -112,7 +118,7 @@ public class Remove extends Batch { for(File f : remove) { trans.info().log("Processing ",f.getAbsolutePath(),"for Deletions"); if(f.exists()) { - CSV removeCSV = new CSV(f); + CSV removeCSV = new CSV(env.access(),f); try { final StringBuilder sb = cqlBatch.begin(); @@ -136,6 +142,7 @@ public class Remove extends Batch { case "NotInOrgDelete": memoFmt.set("Identity %s was removed from %s on %s"); break; + } break; case "ur": @@ -143,7 +150,7 @@ public class Remove extends Batch { ur.set(true); } hi.set(++i); - UserRole.row(sb,row); + UserRole.batchDelete(sb,row); hdd.target=UserRoleDAO.TABLE; hdd.subject=UserRole.histSubject(row); hdd.memo=UserRole.histMemo(memoFmt.get(), row); @@ -154,7 +161,7 @@ public class Remove extends Batch { cred.set(true); } hi.set(++i); - Cred.row(sb,row); + Cred.batchDelete(sb,row); hdd.target=CredDAO.TABLE; hdd.subject=Cred.histSubject(row); hdd.memo=Cred.histMemo(memoFmt.get(), orgName,row); @@ -171,6 +178,16 @@ public class Remove extends Batch { hdd.memo=X509.histMemo(memoFmt.get(),row); historyDAO.createBatch(sb, hdd); break; + case "future": + // Not cached + hi.set(++i); + Future.deleteByIDBatch(sb,row.get(1)); + break; + case "approval": + // Not cached + hi.set(++i); + Approval.deleteByIDBatch(sb,row.get(1)); + break; } } });