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%2FExtend.java;h=bb09c6c772396335203fa6af8a04a15eced14e3f;hb=deb396a3d53a84b2eb5a46d40122b4902d72c601;hp=0077e9fc7e04a887e89de4fa65112eeaf07c4a3b;hpb=2e49787dbbb3093c52babb3ec8a0ab4827d649ce;p=aaf%2Fauthz.git 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 0077e9fc..bb09c6c7 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. @@ -42,7 +42,7 @@ import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; import org.onap.aaf.auth.org.OrganizationException; import org.onap.aaf.cadi.CadiException; -import org.onap.aaf.cadi.client.Holder; +import org.onap.aaf.cadi.util.Holder; import org.onap.aaf.cadi.util.CSV; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.Env; @@ -56,11 +56,11 @@ public class Extend extends Batch { private List 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 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 hi = new Holder<>(0); + final Holder hi = new Holder<>(0); @Override public void visit(List row) throws IOException, CadiException { @@ -190,7 +190,8 @@ public class Extend extends Batch { if(i%maxBatch==0 && sb!=null) { cqlBatch.execute(dryRun); hi.set(1); - hsb.set(sb=null); + sb=null; + hsb.set(sb); } } }); @@ -198,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" );