Code Review
/
aaf
/
authz.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge this if statement with the enclosing one
[aaf/authz.git]
/
auth
/
auth-batch
/
src
/
main
/
java
/
org
/
onap
/
aaf
/
auth
/
batch
/
helpers
/
Cred.java
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
1f5a1f4
..
640efae
100644
(file)
--- 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
@@
-21,6
+21,7
@@
package org.onap.aaf.auth.batch.helpers;
package org.onap.aaf.auth.batch.helpers;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
@@
-139,7
+140,7
@@
public class Cred {
}
public static void loadOneNS(Trans trans, Session session, String ns,int ... types ) {
}
public static void loadOneNS(Trans trans, Session session, String ns,int ... types ) {
- load(trans, session,"select id, type, expires, other, writetime(cred), tag from authz.cred WHERE ns='" + ns + "';");
+ load(trans, session,"select id, type, expires, other, writetime(cred), tag from authz.cred WHERE ns='" + ns + "';"
, types
);
}
private static void load(Trans trans, Session session, String query, int ...types) {
}
private static void load(Trans trans, Session session, String query, int ...types) {
@@
-270,11
+271,9
@@
public class Cred {
public void inc(int type, Date start, Date expires) {
for (int i=0;i<dates.length-1;++i) {
if (start.before(dates[i])) {
public void inc(int type, Date start, Date expires) {
for (int i=0;i<dates.length-1;++i) {
if (start.before(dates[i])) {
- if (type==CredDAO.CERT_SHA256_RSA) {
- if (start.after(dates[i+1])) {
+ if ((type==CredDAO.CERT_SHA256_RSA)&&(start.after(dates[i+1]))) {
++x509Added[i];
++x509Added[i];
- }
- }
+ }
if (expires.after(dates[i])) {
switch(type) {
case CredDAO.RAW:
if (expires.after(dates[i])) {
switch(type) {
case CredDAO.RAW:
@@
-315,16
+314,22
@@
public class Cred {
inst.expires.getTime(),inst.tag,reason);
}
inst.expires.getTime(),inst.tag,reason);
}
-
+ static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
public static void batchDelete(StringBuilder sb, List<String> row) {
public static void batchDelete(StringBuilder sb, List<String> row) {
+ Long l = Long.parseLong(row.get(5));
+ String date = sdf.format(new Date(l));
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
sb.append("' AND type=");
sb.append(Integer.parseInt(row.get(3)));
// Note: We have to work with long, because Expires is part of Key... can't easily do date.
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
sb.append("' AND type=");
sb.append(Integer.parseInt(row.get(3)));
// Note: We have to work with long, because Expires is part of Key... can't easily do date.
- sb.append(" AND expires=dateof(maxtimeuuid(");
- sb.append(row.get(5));
- sb.append("));\n");
+ sb.append(" AND expires='");
+ sb.append(date);
+ sb.append("';\n");
+// sb.append(" AND expires=dateof(maxtimeuuid(");
+// sb.append(row.get(5));
+// sb.append("));\n");
+
}
public String toString() {
}
public String toString() {