private VirtualRouterVmVO findTheEarliestOne(List<VirtualRouterVmVO> vrs) { VirtualRouterVmVO vr = null; for (VirtualRouterVmVO v : vrs) { if (vr == null) { vr = v; continue; } vr = vr.getCreateDate().before(v.getCreateDate()) ? vr : v; } return vr; }
/** * {@inheritDoc} */ @Override public boolean isIntervalSet() { if (null != fromDate) { if (null == toDate) { return true; } else { return fromDate.before(toDate); } } else if (null != toDate) { return true; } return false; }
private boolean isModelUptoDate(String tenantId, Timestamp currentLastModifiedTimestamp) { Timestamp timestampInCache = tenantLastModifiedTime.get(tenantId); return timestampInCache != null && !(timestampInCache.before(currentLastModifiedTimestamp)); } }
/** * Shows whether the sequence is expired or not. * @param actualTimestamp is the timestamp of current time. * @return If the sequence is expired, its timestamp is before than the given timestamp. */ public boolean isExpired(final Timestamp actualTimestamp) { return this.timestamp.get().before(actualTimestamp); }
public boolean hasExpired(long timeoutInSecs) { return new Timestamp(System.currentTimeMillis() - timeoutInSecs * 1000).before(createdAt); } }
private Integer calculateSnapshotsCount(Timestamp from, Timestamp to, Integer dayInterval) { Integer result = 0; for (Timestamp i = from; i.before(to); i = TimestampUtil .getNextTimestamp(i, dayInterval)) { result++; } return result; }
public static boolean isDateBeforeNow(Timestamp date) { Timestamp now = UtilDateTime.nowTimestamp(); if (date != null) { return date.before(now); } return false; }
/** * Reset the ship group's shipBeforeDate if it is after the parameter * @param newShipBeforeDate the ship group's shipBeforeDate to be reset */ public void resetShipBeforeDateIfAfter(Timestamp newShipBeforeDate) { if (newShipBeforeDate != null) { if ((this.shipBeforeDate == null) || (!this.shipBeforeDate.before(newShipBeforeDate))) { this.shipBeforeDate = (Timestamp) newShipBeforeDate.clone(); } } }
private boolean stale(DvObject dvObject) { Timestamp indexTime = dvObject.getIndexTime(); Timestamp modificationTime = dvObject.getModificationTime(); if (indexTime == null) { return true; } else if (indexTime.before(modificationTime)) { return true; } return false; }
public AuthenticatedUser lookupUser( String apiToken ) { ApiToken tkn = findApiToken(apiToken); if ( tkn == null ) return null; if ( tkn.isDisabled() ) return null; if ( tkn.getExpireTime() != null ) { if ( tkn.getExpireTime().before( new Timestamp(new Date().getTime())) ) { em.remove(tkn); return null; } } return tkn.getAuthenticatedUser(); }
public int compare(Object o1, Object o2) { Timestamp date1 = ((Note) o1).getNoteCreateDate(); Timestamp date2 = ((Note) o2).getNoteCreateDate(); if (date1.before(date2)) { return returnCode * -1; } else if (date1.after(date2)) { return returnCode; } else { return 0; } } });
public static boolean isSellable(GenericValue product, Timestamp atTime) { if (product != null) { Timestamp introDate = product.getTimestamp("introductionDate"); Timestamp discDate = product.getTimestamp("salesDiscontinuationDate"); if (introDate == null || introDate.before(atTime)) { if (discDate == null || discDate.after(atTime)) { return true; } } } return false; }
public static boolean isValueActive(GenericValue datedValue, java.sql.Timestamp moment, String fromDateName, String thruDateName) { java.sql.Timestamp fromDate = datedValue.getTimestamp(fromDateName); java.sql.Timestamp thruDate = datedValue.getTimestamp(thruDateName); return (thruDate == null || thruDate.after(moment)) && (fromDate == null || fromDate.before(moment) || fromDate.equals(moment)); }
private ApiToken getCurrentApiToken(AuthenticatedUser au) { if (au != null) { CommandContext ctxt = engine.getContext(); ApiToken token = ctxt.authentication().findApiTokenByUser(au); if ((token == null) || (token.getExpireTime().before(new Date()))) { token = ctxt.authentication().generateApiTokenForUser(au); } return token; } return null; }
/** * Deletes from the database all jobs for which the destruction time has * passed. */ public static void purge() throws PersistenceException { List<Job> jobs = Job.list(); Date now = new Date(); for (Job j : jobs) { if (j.getDestructionTime().before(now)) { Job.delete(j.getId()); new ResultFile(j.getId()).delete(); } } }
@Override public int compare(Row first, Row second) { Timestamp ts1 = first.getAs(field.name()); Timestamp ts2 = second.getAs(field.name()); if (ts1.before(ts2)) { return -1; } else if (ts1.after(ts2)) { return 1; } else { return 0; } }
private static boolean isProductOld(String productId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product != null) { Timestamp salesDiscontinuationDate = product.getTimestamp("salesDiscontinuationDate"); if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp)) { return true; } } return false; }
@Test public void testTimeStampDefault() throws Exception { Dao<TimeStampDefault, Object> dao = createDao(TimeStampDefault.class, true); TimeStampDefault foo = new TimeStampDefault(); Timestamp before = new Timestamp(System.currentTimeMillis()); Thread.sleep(1); assertEquals(1, dao.create(foo)); Thread.sleep(1); Timestamp after = new Timestamp(System.currentTimeMillis()); TimeStampDefault result = dao.queryForId(foo.id); assertTrue(result.timestamp.after(before)); assertTrue(result.timestamp.before(after)); }