List of usage examples for java.util Date before
public boolean before(Date when)
From source file:org.opensafety.hishare.managers.implementation.http.UserManagerImpl.java
public boolean verifyAuthentication(String username, String authenticationId) { User user = userDao.getByName(username); if (user == null) { return false; }//from w w w . j ava 2s .c om Date expiration = user.getAuthenticationExpiration(); Date now = Calendar.getInstance().getTime(); return (user.getAuthenticationId().equals(authenticationId)) && now.before(expiration); }
From source file:ch.ge.ve.protopoc.jwt.JwtTokenUtil.java
private Boolean isTokenExpired(String token) { final Date expiration = getExpirationDateFromToken(token); return expiration.before(new Date()); }
From source file:com.jdom.get.stuff.done.domain.DueWithinDatesFilterOption.java
public boolean accept(Task task) { Date date = task.getDueDate(); return (date.equals(earliest) || date.equals(latest) || (date.after(earliest) && date.before(latest))); }
From source file:com.china317.gmmp.gmmp_report_analysis.App.java
private static void analysisBaoChe(String yyyyMMdd, ApplicationContext context) throws Exception { try {/*from w w w.j a v a2 s . c om*/ log.info("[Baoche App started]"); String businessType = "3"; // System.out.println("[classpath]"+System.getProperty("java.class.path"));//classpaht // System.out.println("[path]"+System.getProperty("user.dir"));//? log.info("[Baoche get baseVehicle begin---------]"); VehicleDao vehicleDao = (VehicleDao) context.getBean("vehicleDao"); List<Vehicle> vehs = vehicleDao.getBaseVehicleByDate(yyyyMMdd, businessType); List<List<Vehicle>> list_tm = ListUtil.splitList(vehs, 400); log.info("[Baoche get baseVehicle end1---------],vehicle total:" + vehs.size()); log.info("[Baoche get baseVehicle end2---------],list_tm total:" + list_tm.size()); for (List<Vehicle> vls : list_tm) { Map<String, Vehicle> vehMap = new HashMap<String, Vehicle>(); log.info("[Baoche code set init------]"); HashSet<String> codes = new HashSet<String>(); for (Vehicle v : vls) { codes.add(v.getCode()); vehMap.put(v.getCode(), v); } log.info("[Baoche code set end------]" + "setSize:" + vehMap.size()); List<VehicleLocate> list = new ArrayList<VehicleLocate>(); if (codes.size() > 0) { VehicleLocateDao vehicleLocateDao_gmmpraw = (VehicleLocateDao) context .getBean("vehicleLocateDaoGmmpRaw"); list = vehicleLocateDao_gmmpraw.findHistoryByParams(yyyyMMdd, codes); log.info("[Baoche this time total Points Size]:" + list.size()); } Map<String, List<VehicleLocate>> map = new HashMap<String, List<VehicleLocate>>(); for (VehicleLocate entity : list) { if (entity.getGpsSpeed() < 160) { // businessType Vehicle tmpV = vehMap.get(entity.getCode()); entity.setBusinessType(tmpV.getBusinessType()); List<VehicleLocate> records = map.get(entity.getCode()); if (records == null) { records = new ArrayList<VehicleLocate>(); } long lastlong = DateTime.accountTime3(entity.getGpsTime(), entity.getGetTime()); if (lastlong <= 10 * 60) { records.add(entity); } map.put(entity.getCode(), records); } } log.info("analysis begin ,total:" + map.size()); Iterator<String> it = map.keySet().iterator(); while (it.hasNext()) { String key = it.next(); List<VehicleLocate> tmps = map.get(key); log.info("analysis vehicle code:" + key + "sort list begin, list size:" + tmps.size()); Collections.sort(tmps, new Comparator<VehicleLocate>() { public int compare(VehicleLocate o1, VehicleLocate o2) { Date d1 = o1.getGpsTime(); Date d2 = o2.getGpsTime(); if (d1.after(d2)) { return 1; } else if (d1.before(d2)) { return -1; } else { return 0; } } }); log.info("analysis vehicle code:" + key + "sort list end"); log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS begin"); for (int i = 0; i < tmps.size(); i++) { VehicleLocate e = tmps.get(i); AreaAddProcessor.addAreaRuleInfo(e); /* * log.info("[Baoche vehcilelocate properties]" + * e.getCode() + "; gpstime:" + e.getGpsTime() + * "; gpsSpeed:" + e.getGpsSpeed() + "; businessType:" + * e.getBusinessType() + "; lon:" + e.getLon() + * "; lat:" + e.getLat() + "; acc:" + e.getACCState()); */ BaocheAnalysisImp.getInstance().overSpeedAnalysis(e); // BaocheAnalysisImp.getInstance().offlineAnalysis(e, // yyyyMMdd); // ?? BaocheAnalysisImp.getInstance().xlpAlarmAnalysis(e); // ? BaocheAnalysisImp.getInstance().putLastRecord(e); } // BaocheAnalysisImp.getInstance().clear(); log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS end"); log.info("result: overspeed:" + BaocheAnalysisImp.getInstance().getOverSpeedRecordsSize() + "; offline:" + BaocheAnalysisImp.getInstance().getOfflineRecordsSize()); } LybcOverSpeedRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getOverSpeedRecords(), context); // IntOutNoneRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getIniOutNoneRecords(), context); // InOutMoreRecordsStoreIntoDB(BaocheAnalysisImp.getInstance().getIniOutMoreRecords(), context); } log.info("analysis end"); log.info("[Baoche ended]"); } catch (Exception e) { log.error(e); } }
From source file:com.vmware.bdd.cli.http.DefaultTrustManager.java
private boolean checkExpired(Date notBefore, Date notAfter) { Date now = new Date(); if (now.before(notBefore) || now.after(notAfter)) { return true; }//from www. j a v a 2 s. c o m return false; }
From source file:ch.ge.ve.protopoc.jwt.JwtTokenUtil.java
private Boolean isCreatedBeforeLastPasswordReset(Date created, Date lastPasswordReset) { return (lastPasswordReset != null && created.before(lastPasswordReset)); }
From source file:com.china317.gmmp.gmmp_report_analysis.App.java
private static void analysisDgm(String yyyyMMdd, ApplicationContext context) { try {/*from w w w .j a v a 2 s . c o m*/ log.info("[Dgm App started]"); String businessType = "1"; DgmAnalysisImp.getInstance().clear(); // System.out.println("[classpath]"+System.getProperty("java.class.path"));//classpaht // System.out.println("[path]"+System.getProperty("user.dir"));//? log.info("[Dgm get baseVehicle begin---------]"); VehicleDao vehicleDao = (VehicleDao) context.getBean("vehicleDao"); List<Vehicle> vehs = vehicleDao.getBaseVehicleByDate(yyyyMMdd, businessType); List<List<Vehicle>> list_tm = ListUtil.splitList(vehs, 400); log.info("[Dgm get baseVehicle end1---------],vehicle total:" + vehs.size()); log.info("[Dgm get baseVehicle end2---------],list_tm total:" + list_tm.size()); for (List<Vehicle> vls : list_tm) { Map<String, Vehicle> vehMap = new HashMap<String, Vehicle>(); log.info("[Dgm code set init------]"); HashSet<String> codes = new HashSet<String>(); for (Vehicle v : vls) { codes.add(v.getCode()); vehMap.put(v.getCode(), v); } log.info("[Dgm code set end------]" + "setSize:" + vehMap.size()); List<VehicleLocate> list = new ArrayList<VehicleLocate>(); if (codes.size() > 0) { VehicleLocateDao vehicleLocateDao_gmmpraw = (VehicleLocateDao) context .getBean("vehicleLocateDaoGmmpRaw"); list = vehicleLocateDao_gmmpraw.findHistoryByParams(yyyyMMdd, codes); log.info("[Dgm this time total Points Size]:" + list.size()); } Map<String, List<VehicleLocate>> map = new HashMap<String, List<VehicleLocate>>(); for (VehicleLocate entity : list) { if (entity.getGpsSpeed() < 160) { // businessType Vehicle tmpV = vehMap.get(entity.getCode()); entity.setBusinessType(tmpV.getBusinessType()); List<VehicleLocate> records = map.get(entity.getCode()); if (records == null) { records = new ArrayList<VehicleLocate>(); } long lastlong = DateTime.accountTime3(entity.getGpsTime(), entity.getGetTime()); if (lastlong <= 10 * 60) { records.add(entity); } map.put(entity.getCode(), records); } } log.info("analysis begin ,total:" + map.size()); Iterator<String> it = map.keySet().iterator(); int index = 0; while (it.hasNext()) { index++; String key = it.next(); List<VehicleLocate> tmps = map.get(key); log.info("[Dgm]" + index + "analysis vehicle code:" + key + "sort list begin, list size:" + tmps.size()); Collections.sort(tmps, new Comparator<VehicleLocate>() { public int compare(VehicleLocate o1, VehicleLocate o2) { Date d1 = o1.getGpsTime(); Date d2 = o2.getGpsTime(); if (d1.after(d2)) { return 1; } else if (d1.before(d2)) { return -1; } else { return 0; } } }); log.info("analysis vehicle code:" + key + "sort list end"); DgmAnalysisImp.getInstance().fatigueAnalysis(tmps, yyyyMMdd); log.info("-------Fatigue Analysis end"); for (int i = 0; i < tmps.size(); i++) { VehicleLocate e = tmps.get(i); AreaAddProcessor.addAreaRuleInfo(e); /* * log.info("[Dgm vehcilelocate properties]" + * e.getCode() + "; gpstime:" + e.getGpsTime() + * "; gpsSpeed:" + e.getGpsSpeed() + "; businessType:" + * e.getBusinessType() + "; lon:" + e.getLon() + * "; lat:" + e.getLat() + "; acc:" + e.getACCState()); */ DgmAnalysisImp.getInstance().addZeroBegin(e); DgmAnalysisImp.getInstance().overSpeedAnalysis(e); DgmAnalysisImp.getInstance().offlineAnalysis(e, yyyyMMdd); DgmAnalysisImp.getInstance().fobiddenAnalysis(e, i, tmps.size(), yyyyMMdd); DgmAnalysisImp.getInstance().illegalParkingAnalysis(e); DgmAnalysisImp.getInstance().illegalInOutAnalysis(e); // ? DgmAnalysisImp.getInstance().putLastRecord(e); } log.info("analysis vehicle code:" + key + "OVERSPEED OFFLINE ANALYSIS end"); log.info("result: overspeed:" + DgmAnalysisImp.getInstance().getOverSpeedRecordsSize() + "; offline:" + DgmAnalysisImp.getInstance().getOfflineRecordsSize()); // DgmAnalysisImp.getInstance().clear(); } FatigueRecordsStoreIntoDB(DgmAnalysisImp.getInstance().getFatigueMap(), context); log.info("--------Fatigue store into DB end"); // OverSpeedRecordsStoreIntoDB(DgmAnalysisImp.getInstance() // .getOverSpeedMap(), context); DgmOverSpeedRecordsStoreIntoDB(DgmAnalysisImp.getInstance().getOverSpeedMap(), context); DgmEntryExitStoreIntoDB(DgmAnalysisImp.getInstance().getExitMap(), context); DgmFobbidenStoreIntoDB(DgmAnalysisImp.getInstance().getForbiddeningMap(), context); DgmIllegalParkingStoreIntoDB(DgmAnalysisImp.getInstance().getIllegalParking(), context); } log.info("analysis end"); log.info("[Dgm ended]"); } catch (Exception e) { log.error(e); } }
From source file:de.u808.simpleinquest.service.scheduler.SchedulerManager.java
public Date getNextExecutionDate(Trigger[] triggers) { Date nextExecutionDate = null; for (Trigger trigger : triggers) { Date nextFireTime = trigger.getNextFireTime(); if (nextExecutionDate == null || ((nextFireTime != null) && (nextFireTime.before(nextExecutionDate)))) { nextExecutionDate = trigger.getNextFireTime(); }/* w w w. ja v a 2s . c om*/ } return nextExecutionDate; }
From source file:com.redhat.rhn.frontend.action.tasko.ScheduleDetailAction.java
private Boolean isActive(Map schedule) { Date till = (Date) schedule.get("active_till"); if (till == null) { return Boolean.TRUE; }/*ww w . j a v a 2s.c o m*/ Date now = new Date(); return now.before(till); }
From source file:net.kenblair.scheduler.jpa.JpaScheduledJobRepositoryTest.java
@Test public void testUpdateLastRun() throws Exception { ScheduledJob job = repository.findEnabledJobs().get(0); final Date lastDateRun = job.getLastRun(); repository.updateLastRun(job.getId()); job = repository.findOne(new Long(job.getId())); assertTrue(lastDateRun.before(job.getLastRun())); }