import com.datastax.driver.core.Cluster;
public class CredPunt extends ActionPuntDAO<CredDAO.Data,Void,String> {
-
- public CredPunt(AuthzTrans trans, Cluster cluster, int months, int range, boolean dryRun) throws IOException, APIException {
- super(trans,cluster,months,range,dryRun);
- }
+
+ public CredPunt(AuthzTrans trans, Cluster cluster, int months, int range, boolean dryRun) throws IOException, APIException {
+ super(trans,cluster,months,range,dryRun);
+ }
- public CredPunt(AuthzTrans trans, ActionDAO<?,?,?> adao, int months, int range) throws IOException {
- super(trans, adao, months,range);
- }
+ public CredPunt(AuthzTrans trans, ActionDAO<?,?,?> adao, int months, int range) throws IOException {
+ super(trans, adao, months,range);
+ }
- public Result<Void> exec(AuthzTrans trans, CredDAO.Data cdd,String text) {
- Result<Void> rv = null;
- Result<List<CredDAO.Data>> read = q.credDAO.read(trans, cdd);
- if(read.isOKhasData()) {
- for(CredDAO.Data data : read.value) {
- Date from = data.expires;
- data.expires = puntDate(from);
- if(data.expires.compareTo(from)<=0) {
- trans.debug().printf("Error: %s is before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
- } else {
- if(dryRun) {
- trans.info().log("Would Update Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
- } else {
- trans.info().log("Updated Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
- rv = q.credDAO.update(trans, data);
- }
- }
- }
- }
- if(rv==null) {
- rv=Result.err(read);
- }
- return rv;
- }
+ public Result<Void> exec(AuthzTrans trans, CredDAO.Data cdd,String text) {
+ Result<Void> rv = null;
+ Result<List<CredDAO.Data>> read = q.credDAO.read(trans, cdd);
+ if(read.isOKhasData()) {
+ for(CredDAO.Data data : read.value) {
+ Date from = data.expires;
+ data.expires = puntDate(from);
+ if(data.expires.compareTo(from)<=0) {
+ trans.debug().printf("Error: %s is before %s", Chrono.dateOnlyStamp(data.expires), Chrono.dateOnlyStamp(from));
+ } else {
+ if(dryRun) {
+ trans.info().log("Would Update Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
+ } else {
+ trans.info().log("Updated Cred",cdd.id, CredPrint.type(cdd.type), "from",Chrono.dateOnlyStamp(from),"to",Chrono.dateOnlyStamp(data.expires));
+ rv = q.credDAO.update(trans, data);
+ }
+ }
+ }
+ }
+ if(rv==null) {
+ rv=Result.err(read);
+ }
+ return rv;
+ }
}
\ No newline at end of file