List of usage examples for java.util Date before
public boolean before(Date when)
From source file:authentication.jwt.ReferenceDateClaimsVerifier.java
/** {@inheritDoc} */ @Override//ww w . j a v a2s .com public void verify(final JWT jwt) { final ReadOnlyJWTClaimsSet claims; try { claims = jwt.getJWTClaimsSet(); } catch (final ParseException exception) { throw new JwtTokenException("Invalid JWT."); } final Date referenceTime = new Date(); final Date expirationTime = claims.getExpirationTime(); if (expirationTime == null || expirationTime.before(referenceTime)) { throw new JwtTokenException("The token is expired"); } }
From source file:com.l2jfree.gameserver.script.DateRange.java
/** * /*w w w . ja v a2s . c o m*/ * @param date * @return true if date is after startDate and before endDate */ public boolean isWithinRange(Date date) { return date.after(_startDate) && date.before(_endDate); }
From source file:hudson.plugins.simpleupdatesite.model.RssEntry.java
/** * Check if the entry is new/*from w w w .j a v a 2 s .c om*/ * * @return Return true if the news is updated after 2 week ago. */ public boolean isNew() { Date previousDate = DateUtils.addDays(new Date(), -14); return previousDate.before(getUpdatedDate()); }
From source file:com.springsource.greenhouse.events.sessions.EventSessionsScheduleActivity.java
private void refreshScheduleDays() { if (event == null) { return;//from w w w . java2 s .c o m } conferenceDates = new ArrayList<Date>(); List<String> conferenceDays = new ArrayList<String>(); Date day = (Date) event.getStartTime().clone(); while (day.before(event.getEndTime())) { conferenceDates.add((Date) day.clone()); conferenceDays.add(new SimpleDateFormat("EEEE, MMM d").format(day)); day.setDate(day.getDate() + 1); } setListAdapter(new ArrayAdapter<String>(this, R.layout.menu_list_item, conferenceDays)); }
From source file:com.liferay.jenkins.tools.BetweenTimestampsMatcher.java
@Override public boolean matches(Build jenkinsBuild) { Date date = new Date(jenkinsBuild.getTimestamp()); if (date.after(start) && date.before(end)) { return true; }/*from w ww . j a v a 2 s. c om*/ return false; }
From source file:com.haulmont.timesheets.core.HolidaysCache.java
private String doLoadCache(boolean lockReadBeforeFinish) { try {// w w w.j a v a 2s . c o m lock.writeLock().lock(); cache = new TreeMap<>(); LoadContext<Holiday> loadContext = new LoadContext<>(Holiday.class); loadContext .setQueryString("select e from ts$Holiday e " + "where (e.startDate between :start and :end) or (e.endDate between :start and :end)") .setParameter("start", DateUtils.addYears(timeSource.currentTimestamp(), -1)) .setParameter("end", DateUtils.addYears(timeSource.currentTimestamp(), 1)); List<Holiday> holidays = dataManager.loadList(loadContext); for (Holiday holiday : holidays) { Date startDate = holiday.getStartDate(); Date endDate = holiday.getEndDate(); Date currentDate = startDate; while (currentDate.before(endDate)) { cache.put(currentDate, holiday); currentDate = DateUtils.addDays(currentDate, 1); } } if (lockReadBeforeFinish) { lock.readLock().lock(); } return "Successfully loaded"; } finally { lock.writeLock().unlock(); } }
From source file:technology.tikal.ventas.model.pedido.GrupoPartida.java
public void updateFechaCreacion(Date fecha) { if (fechaDeCreacion == null || fecha.before(fechaDeCreacion)) { this.fechaDeCreacion = fecha; }/* w ww.java 2s .c om*/ }
From source file:com.fxforbiz.softphone.core.managers.UpdateManager.java
/** * This methods checks in the properties of the application if an update is needed. * @return Either an update is needed or not. *//* w w w . ja va2 s .c o m*/ public boolean checkForUpdate() { String dateStr = Application.getInstance().getPropertyManger().getProperty("END_DATE_LICENCE"); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date end = null; try { end = sdf.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); } Date now = new Date(); return !now.before(end); }
From source file:com.qcadoo.mes.operationalTasks.validators.OperationalTaskValidators.java
private boolean datesAreInCorrectOrder(final DataDefinition operationalTaskDD, final Entity operationalTask) { Date startDate = operationalTask.getDateField(OperationalTaskFields.START_DATE); Date finishDate = operationalTask.getDateField(OperationalTaskFields.FINISH_DATE); if (finishDate.before(startDate)) { operationalTask.addError(operationalTaskDD.getField(OperationalTaskFields.START_DATE), WRONG_DATES_ORDER_MESSAGE); operationalTask.addError(operationalTaskDD.getField(OperationalTaskFields.FINISH_DATE), WRONG_DATES_ORDER_MESSAGE); return false; }//w ww.jav a2s .c o m return true; }
From source file:fr.gotorennes.remote.NextMetroDepartureService.java
protected Date getNextDate(JSONObject station, int platform) { String departure1 = station.optString("nextTrain1Platform" + platform); String departure2 = station.optString("nextTrain2Platform" + platform); if (departure1 != null && !departure1.equals("")) { try {// w ww . j ava2 s . com Date departureDate = dateFormat.parse(departure1); if (departureDate.before(new Date()) && departure2 != null && !departure2.equals("")) { departureDate = dateFormat.parse(departure2); if (departureDate.before(new Date())) { departureDate = null; } } return departureDate; } catch (Exception ex) { Log.e("GoToRennes", "Invalid date format : " + departure1 + " or " + departure2); } } return null; }