List of usage examples for java.util Date after
public boolean after(Date when)
From source file:de.kasoki.jfeedly.model.FeedlyConnection.java
/** Is the access token expired? */ public boolean isExpired() { Date currentDate = new Date(); return currentDate.after(this.expireDate); }
From source file:fr.amapj.service.services.mescontrats.ContratDTO.java
/** * Indique si le contrat est modifiable/*from ww w . java 2s . co m*/ */ public boolean isModifiable() { Date d = DateUtils.addHours(dateFinInscription, 23); d = DateUtils.addMinutes(d, 59); return d.after(new Date()); }
From source file:org.eyeseetea.malariacare.network.PullClient.java
/** * Find the last survey in the server for that orgunit and program (given a program) in the last month from now. * * @param orgUnit//w w w . j av a2 s . c om * @param program * @return */ public Event getLastEventInServerWith(OrgUnit orgUnit, Program program) { Event lastEventInServer = null; Date oneMonthAgo = getOneMonthAgo(); //Lets for a last event with that orgunit/program String data = QueryFormatterUtils.getInstance().prepareLastEventData(orgUnit.getUid(), program.getUid(), oneMonthAgo); try { JSONObject response = networkUtils.getData(data); JsonNode jsonNode = networkUtils.toJsonNode(response); List<Event> eventsFromThatDate = EventsWrapper.getEvents(jsonNode); for (Event event : eventsFromThatDate) { //First event or events without date so far if (lastEventInServer == null) { lastEventInServer = event; continue; } //Update event only if it comes afterwards String lastEventInServerEventDateStr = lastEventInServer.getEventDate(); String eventDateStr = event.getEventDate(); Date lastEventInServerEventDate = EventExtended.parseLongDate(lastEventInServerEventDateStr); Date eventDate = EventExtended.parseLongDate(eventDateStr); if (eventDate.after(lastEventInServerEventDate)) { lastEventInServer = event; } } } catch (Exception ex) { Log.e(TAG, String.format("Cannot read last event from server with orgunit:%s | program:%s", orgUnit.getUid(), program.getUid())); ex.printStackTrace(); } return lastEventInServer; }
From source file:eionet.transfer.dao.UploadsServiceDBFiles.java
/** * Download a file.//from ww w . j ava2 s .c o m */ public Upload getById(String fileId) throws IOException { Upload uploadRec; try { uploadRec = metadataService.getById(fileId); } catch (Exception e) { throw new FileNotFoundException(fileId); } Date today = new Date(System.currentTimeMillis()); if (today.after(uploadRec.getExpires())) { throw new FileNotFoundException(fileId); } uploadRec.setContentStream(storageService.getById(fileId)); return uploadRec; }
From source file:tasly.greathealth.oms.cronjob.services.impl.DefaultTaslyCronjobConfigServiceImpl.java
private boolean isValidExpression(final CronExpression cronExpression) { final CronTriggerImpl trigger = new CronTriggerImpl(); trigger.setCronExpression(cronExpression); final Date date = trigger.computeFirstFireTime(null); return date != null && date.after(new Date()); }
From source file:net.solarnetwork.node.setup.web.NodeCertificatesController.java
/** * View the main certs page.//from www .j a v a2s .c om * * @param model * the view model * @return */ @RequestMapping public String home(Model model) { X509Certificate nodeCert = pkiService.getNodeCertificate(); final Date now = new Date(); final boolean expired = (nodeCert != null && now.after(nodeCert.getNotAfter())); final boolean valid = (nodeCert != null && (!nodeCert.getIssuerDN().equals(nodeCert.getSubjectDN()) && !now.before(nodeCert.getNotBefore()) && !expired)); model.addAttribute("nodeCert", nodeCert); model.addAttribute("nodeCertExpired", expired); model.addAttribute("nodeCertValid", valid); return "certs/home"; }
From source file:com.vmware.identity.util.TimePeriod.java
/** * Creates time interval [startTime, endTime) if times are not null. Creates * time interval (-Inf, endTime) if start time is null. Creates time interval * [startTime, +Inf) if end time is null. Creates time interval (-Inf, +Inf) * if both times are null.// w w w .j a va 2s.c o m * * @param startTime * as UTC milliseconds from the epoch. Can be null. * @param endTime * as UTC milliseconds from the epoch. Should be after start time, * if it is not null. Can be null. * @throws IllegalArgumentException * when start and end times are not null and the end time is not * greater than start time */ public TimePeriod(Date startTime, Date endTime) { if (startTime != null && endTime != null && !endTime.after(startTime)) { throw new IllegalArgumentException("EndTime: " + endTime + " is not after startTime: " + startTime); } this.startTime = startTime; this.endTime = endTime; }
From source file:io.apiman.test.integration.rest.apis.metrics.AbstractIntervalMetricsIT.java
@Test public void shouldHaveConsecutiveValueOnSubintervals() throws Exception { HistogramBean<HistogramDataPoint> metrics = getMetrics(); Date prevDate = formatter.parse(metrics.getData().get(0).getLabel()); for (int i = 1; i < metrics.getData().size(); i++) { Date date = formatter.parse(metrics.getData().get(i).getLabel()); assertTrue("Unexpected label value", date.after(prevDate)); prevDate = date;//from ww w . j ava 2s.co m } }
From source file:org.musicrecital.service.impl.PasswordTokenManagerImpl.java
/** * {@inheritDoc}/*from ww w . j a va 2s. c om*/ */ @Override public boolean isRecoveryTokenValid(final User user, final String token) { if (user != null && token != null) { final String expirationTimeStamp = getTimestamp(token); final String tokenWithoutTimestamp = getTokenWithoutTimestamp(token); final String tokenSource = expirationTimeStamp + getTokenSource(user); final Date expirationTime = parseTimestamp(expirationTimeStamp); return expirationTime != null && expirationTime.after(new Date()) && passwordTokenEncoder.matches(tokenSource, tokenWithoutTimestamp); } return false; }
From source file:com.evolveum.midpoint.web.page.admin.certification.dto.CertCaseDto.java
private Date getReviewedTimestamp(AccessCertificationCaseType certCase) { Date lastDate = null;/*from w w w . j a va 2 s . c o m*/ for (AccessCertificationDecisionType decision : certCase.getDecision()) { Date decisionDate = XmlTypeConverter.toDate(decision.getTimestamp()); if (lastDate == null || decisionDate.after(lastDate)) { lastDate = decisionDate; } } return lastDate; }