List of usage examples for java.time LocalDateTime plus
@Override
public LocalDateTime plus(TemporalAmount amountToAdd)
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00); LocalDateTime t = a.plus(Period.ofDays(100)); System.out.println(t);/*ww w.ja va 2 s . c o m*/ }
From source file:nu.yona.server.subscriptions.service.NewDeviceRequestService.java
private boolean isExpired(NewDeviceRequest newDeviceRequestEntity) { LocalDateTime creationTime = newDeviceRequestEntity.getCreationTime(); return creationTime.plus(getExpirationTime()).isBefore(TimeUtil.utcNow()); }
From source file:nu.yona.server.subscriptions.service.PinResetRequestService.java
public boolean isExpired(ConfirmationCode confirmationCode) { LocalDateTime creationTime = confirmationCode.getCreationTime(); return creationTime.plus(yonaProperties.getSecurity().getPinResetRequestExpirationTime()) .isBefore(TimeUtil.utcNow()); }
From source file:de.decoit.siemgui.service.TicketServiceImpl.java
/** * Create a new ticket for a specific incident. * * @param inc Incident to create a ticket for * @return The created ticket//from w w w . j a v a2 s . c o m * * @throws ExternalServiceException if an error occurs while accessing the external service */ private Ticket createTicketForIncident(Incident inc) throws ExternalServiceException { if (LOG.isDebugEnabled()) { LOG.debug("Creating ticket for incident ID " + inc.getId()); } LocalDateTime dueOn = inc.getTimestamp(); switch (inc.getThreatLevel()) { case LOW: dueOn = dueOn.plus(sysConf.getThreatLevelLowDueIn()); break; case MEDIUM: dueOn = dueOn.plus(sysConf.getThreatLevelMedDueIn()); break; case HIGH: dueOn = dueOn.plus(sysConf.getThreatLevelHighDueIn()); break; default: throw new IllegalStateException("No thread level calculated on incident"); } NewTicket tmpTicket = new NewTicket(); TicketQueue queue = ticketQueueDao.getTicketQueueDetails(sysConf.getSiemTicketQueueName(), authSysUser); StringBuilder sb = new StringBuilder("[Incident "); sb.append(inc.getId()); sb.append("] "); sb.append(inc.getName()); StringBuilder sbText = new StringBuilder("[p]"); sbText.append(inc.getDescription()); sbText.append("[/p]"); if (!StringUtils.isBlank(inc.getRecommendation())) { sbText.append("[p]"); sbText.append(inc.getRecommendation()); sbText.append("[/p]"); } // for(IncidentRecommendation iRec : inc.getRecommendations()) { // StringBuilder sbRec = new StringBuilder("[p]"); // sbRec.append(iRec.getRecommendation()); // sbRec.append("[/p]"); // // sbText.append(sbRec); // } tmpTicket.setTitle(sb.toString()); tmpTicket.setQueue(queue); tmpTicket.setText(sbText.toString()); tmpTicket.setRequestor(authSysUser.getUsername()); tmpTicket.setStarts(LocalDateTime.now()); tmpTicket.setIncidentId(inc.getId()); tmpTicket.setRisk(inc.getRisk()); tmpTicket.setDueOn(dueOn); if (LOG.isDebugEnabled()) { LOG.debug("Ticket recommendation text: " + tmpTicket.getText()); } long newId = ticketDao.createTicket(tmpTicket, authSysUser); return ticketDao.getTicketDetails(newId, authSysUser); }
From source file:org.darkware.wpman.util.TimeWindow.java
/** * Creates a new time window with the declared start and a given duration. * * @param earliest The earliest allowed time in the window. * @param duration The length of the window. *//*from w w w . ja v a 2 s . com*/ public TimeWindow(final LocalDateTime earliest, final TemporalAmount duration) { this(earliest, earliest.plus(duration)); }