- public Date get(AuthzTrans trans, String table, int seg) {
- Date[] dates = info.get(table);
- if(dates==null) {
- dates = new Date[seg+1];
- touch(trans,table, seg);
- } else if(dates.length<=seg) {
- Date[] temp = new Date[seg+1];
- System.arraycopy(dates, 0, temp, 0, dates.length);
- dates = temp;
- }
- Date rv = dates[seg];
- if(rv==null) {
- rv=dates[seg]=startTime;
- }
- return rv;
- }
+ public Result<Void> check(AuthzTrans trans) {
+ ResultSet rs;
+ TimeTaken tt = trans.start("Check Table Timestamps",Env.REMOTE);
+ try {
+ rs = getSession(trans).execute(new BoundStatement(psCheck));
+ } catch (DriverException | APIException | IOException e) {
+ reportPerhapsReset(trans,e);
+ return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG);
+ } finally {
+ tt.done();
+ }
+
+ String lastName = null;
+ Date[] dates = null;
+ for (Row row : rs.all()) {
+ String name = row.getString(0);
+ int seg = row.getInt(1);
+ if (!name.equals(lastName)) {
+ dates = info.get(name);
+ lastName=name;
+ }
+ if (dates==null) {
+ dates=new Date[seg+1];
+ info.put(name,dates);
+ } else if (dates.length<=seg) {
+ Date[] temp = new Date[seg+1];
+ System.arraycopy(dates, 0, temp, 0, dates.length);
+ dates = temp;
+ info.put(name, dates);
+ }
+ Date temp = row.getTimestamp(2);
+ if (dates[seg]==null || dates[seg].before(temp)) {
+ dates[seg]=temp;
+ }
+ }
+ return Result.ok();
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.aaf.auth.dao.cass.CIDAO#get(java.lang.String, int)
+ */
+ @Override
+ public Date get(AuthzTrans trans, String table, int seg) {
+ Date[] dates = info.get(table);
+ if (dates==null) {
+ dates = new Date[seg+1];
+ touch(trans,table, seg);
+ } else if (dates.length<=seg) {
+ Date[] temp = new Date[seg+1];
+ System.arraycopy(dates, 0, temp, 0, dates.length);
+ dates = temp;
+ }
+ Date rv = dates[seg];
+ if (rv==null) {
+ rv=dates[seg]=startTime;
+ }
+ return rv;
+ }