List of usage examples for org.joda.time DateTimeComparator getDateOnlyInstance
public static DateTimeComparator getDateOnlyInstance()
From source file:Handler.VendegMenu.java
public Message SzabadSzobakListazasa() { String kezdoDatumStr = null, vegDatumStr = null; Date kezdoDatum = null, vegDatum = null; try {//from w w w .ja v a 2s. com System.out.print("Adja meg a megtekinteni kivan idoszak kezdodatumat (pelda: 2017-04-12): "); kezdoDatumStr = br.readLine(); kezdoDatum = df.parse(kezdoDatumStr); System.out.print("Adja meg a megtekinteni kivan idoszak vegdatumat (pelda: 2017-04-12): "); vegDatumStr = br.readLine(); vegDatum = df.parse(vegDatumStr); //df.setTimeZone(TimeZone.getTimeZone("CEST")); if (DateTimeComparator.getDateOnlyInstance().compare(kezdoDatum, vegDatum) == 1) { throw new Exception("A megtekinteni kivan idoszak kezdodatuma nem lehet kesobbi, mint a vegdatum"); } } catch (ParseException exc) { System.err.println("!!! Ervenytelen datum !!!"); message = SzabadSzobakListazasa(); } catch (Exception ex) { // Logger.getLogger(ClientMuveletFeldolgozas.class.getName()).log(Level.SEVERE, null, ex); System.out.println("!!! Hiba a datumok megadasanak modjaban !!!"); message = SzabadSzobakListazasa(); } ArrayList<String> kezdoEsVeg = new ArrayList<>(); kezdoEsVeg.add(kezdoDatumStr); kezdoEsVeg.add(vegDatumStr); message.getHead().setFeladat(null); message.getBody().setData(kezdoEsVeg); return message; }
From source file:mekhq.campaign.universe.Planet.java
License:Open Source License
@SuppressWarnings("unchecked") public PlanetaryEvent getOrCreateEvent(DateTime when) { if (null == when) { return null; }//w w w. j a v a 2 s . co m if (null == events) { events = new TreeMap<DateTime, PlanetaryEvent>(DateTimeComparator.getDateOnlyInstance()); } PlanetaryEvent event = events.get(when); if (null == event) { event = new PlanetaryEvent(); event.date = when; events.put(when, event); } return event; }
From source file:mekhq.campaign.universe.Planet.java
License:Open Source License
@SuppressWarnings({ "unused", "unchecked" }) private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { if (null == id) { id = name;/*from w w w.j a v a2 s. com*/ } // Spectral classification: use spectralType if available, else the separate values if (null != spectralType) { setSpectralType(spectralType); } else { spectralType = StarUtil.getSpectralType(spectralClass, subtype, luminosity); } nadirCharge = Utilities.nonNull(nadirCharge, Boolean.FALSE); zenithCharge = Utilities.nonNull(zenithCharge, Boolean.FALSE); // Generate a bunch of data if we still don't have it if (null == spectralType) { setSpectralType(StarUtil.generateSpectralType(new Random(id.hashCode() + 133773), true, (null != spectralClass) ? spectralClass.intValue() : -1)); } // Fill up events events = new TreeMap<DateTime, PlanetaryEvent>(DateTimeComparator.getDateOnlyInstance()); if (null != eventList) { for (PlanetaryEvent event : eventList) { if (null != event && null != event.date) { events.put(event.date, event); } } eventList.clear(); } eventList = null; // Merge faction change events into the event data if (null != factionChanges) { for (FactionChange change : factionChanges) { if (null != change && null != change.date) { PlanetaryEvent event = getOrCreateEvent(change.date); event.faction = change.faction; } } factionChanges.clear(); } factionChanges = null; }
From source file:org.apigw.authserver.x509.CertifiedClientAuthenticationUserDetailsService.java
License:Open Source License
boolean hasExpired(CertifiedClient clientDetails) { return (clientDetails.getExpireDate() != null) && DateTimeComparator.getDateOnlyInstance() .compare(clientDetails.getExpireDate(), getCurrentDate()) < 0; }
From source file:org.egov.ptis.web.controller.masters.mutationfee.MutationFeeController.java
License:Open Source License
@RequestMapping(value = "/modify/{id}", method = RequestMethod.POST) public String modifyMutationFee(@PathVariable("id") final Long id, @RequestParam("toDate") final Date toDate, @ModelAttribute final MutationFeeDetails mutationFeeDetails, final RedirectAttributes redirectAttributes, final BindingResult resultBinder, final Model model) { final MutationFeeDetails mfd = mutationFeeService.getDetailsById(id); final Date date = new Date(); if (DateTimeComparator.getDateOnlyInstance().compare(toDate, date) >= 0) { mfd.setToDate(toDate);//from w w w . j a va 2s.co m mutationFeeService.createMutationFee(mfd); redirectAttributes.addFlashAttribute(MSG, "msg.mutationfee.update.success"); return "redirect:/mutationfee/modify"; } else { redirectAttributes.addFlashAttribute(ERROR, "error.mutationfee.update.fail"); return "redirect:/mutationfee/modify"; } }
From source file:org.kuali.coeus.propdev.impl.sponsor.ProposalDevelopmentSponsorProgramInformationAuditRule.java
License:Open Source License
protected boolean isDeadlineDateBeforeCurrentDate(DevelopmentProposal proposal) { DateTime deadlineDate = new DateTime(proposal.getDeadlineDate()); DateTime currentDate = new DateTime(); return DateTimeComparator.getDateOnlyInstance().compare(currentDate, deadlineDate) > 0; }
From source file:org.libreplan.importers.notifications.realization.SendEmailOnTaskShouldFinish.java
License:Open Source License
@Transactional public void taskShouldFinish() { // Check if current date equals with item date DateTime currentDate = new DateTime(); DateTimeComparator dateTimeComparator = DateTimeComparator.getDateOnlyInstance(); List<TaskElement> tasks = taskElementDAO.getTaskElementsWithParentsWithoutMilestones(); for (TaskElement item : tasks) { DateTime endDate = new DateTime(item.getEndDate()); if (dateTimeComparator.compare(currentDate, endDate) == 0) { // Get all resources for current task and send them email notification sendEmailNotificationAboutTaskShouldFinish(item); }/* w w w . jav a 2 s . c om*/ } }
From source file:org.libreplan.importers.notifications.realization.SendEmailOnTaskShouldStart.java
License:Open Source License
@Transactional public void taskShouldStart() { // Check if current date equals with item date DateTime currentDate = new DateTime(); DateTimeComparator dateTimeComparator = DateTimeComparator.getDateOnlyInstance(); List<TaskElement> tasks = taskElementDAO.getTaskElementsWithParentsWithoutMilestones(); for (TaskElement item : tasks) { DateTime startDate = new DateTime(item.getStartDate()); if (dateTimeComparator.compare(currentDate, startDate) == 0) { // Get all resources for current task and send them email notification sendEmailNotificationAboutTaskShouldStart(item); }/*from w ww .j a v a2s .com*/ } }
From source file:org.sakaiproject.tool.summarycalendar.ui.EventSummary.java
License:Educational Community License
private boolean isToday(long dateMs) { TimeZone timeZone = getCurrentUserTimezone(); DateTime thisDate = new DateTime(dateMs).withZone(DateTimeZone.forTimeZone(timeZone)); //Start of day at this local DateTime today = new DateTime().withTime(0, 0, 0, 0).withZone(DateTimeZone.forTimeZone(timeZone)); DateTimeComparator dtComp = DateTimeComparator.getDateOnlyInstance(); return (dtComp.compare(thisDate, today) == 0); }