List of usage examples for java.util Date equals
public boolean equals(Object obj)
From source file:org.mifos.accounts.business.AccountBO.java
public boolean isTrxnDateValid(final Date trxnDate, Date lastCustomerMeetingDate, boolean repaymentIndependentOfMeetingEnabled) { if (AccountingRules.isBackDatedTxnAllowed()) { return isTrxnDateBeforePreviousMeetingDateAllowed(trxnDate, lastCustomerMeetingDate, repaymentIndependentOfMeetingEnabled); }// ww w. j a va2 s. c o m return trxnDate.equals(DateUtils.getCurrentDateWithoutTimeStamp()); }
From source file:at.jclehner.rxdroid.ui.DoseLogFragment.java
private void gatherEventInfos(int flags) { final Timer t; if (LOGV)//ww w.j a va 2 s . c o m t = new Timer(); else t = null; final Drug drug = getDrug(); final List<EventInfo> infos = new ArrayList<EventInfo>(); final List<DoseEvent> events = Entries.findDoseEvents(drug, null, null); for (DoseEvent event : events) { boolean isSkipped = event.getDose().isZero(); if ((isSkipped && (flags & SHOW_SKIPPED) == 0) || (!isSkipped && (flags & SHOW_TAKEN) == 0)) { continue; } infos.add(EventInfo.newTakenOrIgnoredEvent(event)); } Date date = Settings.getDate(Keys.OLDEST_POSSIBLE_DOSE_EVENT_TIME); if (date != null && !events.isEmpty()) { Collections.sort(infos, EventInfoByDateComparator.INSTANCE); date = DateTime.max(date, Settings.getOldestPossibleHistoryDate(mToday)); date = DateTime.min(date, events.get(events.size() - 1).getDate()); } else if (date == null) date = Settings.getOldestPossibleHistoryDate(mToday); final Date lastScheduleUpdateDate = drug.getLastScheduleUpdateDate(); if (date == null) { if ((date = lastScheduleUpdateDate) == null) { Log.w(TAG, "gatherEventInfos(" + flags + "): no date to begin; giving up"); return; } } // final Date lastDosesClearedDate = drug.getLastDosesClearedDate(); // if(lastDosesClearedDate != null) // { // while(!date.after(lastDosesClearedDate)) // date = DateTime.add(date, Calendar.DAY_OF_MONTH, 1); // } final DoseTimeInfo dtInfo = Settings.getDoseTimeInfo(); if ((flags & SHOW_MISSED) != 0) { while (!date.after(mToday)) { if (lastScheduleUpdateDate == null || !date.before(lastScheduleUpdateDate)) { if (drug.hasDoseOnDate(date)) { for (int doseTime : Constants.DOSE_TIMES) { if (date.equals(mToday) && doseTime == dtInfo.activeOrNextDoseTime()) break; Fraction dose = drug.getDose(doseTime, date); if (!dose.isZero() && !containsDoseEvent(events, date, doseTime)) { //Log.d(TAG, "Creating missed event: date=" + date + ", doseTime=" + doseTime); infos.add(EventInfo.newMissedEvent(date, doseTime, dose)); } } } } date = DateTime.add(date, Calendar.DAY_OF_MONTH, 1); } } Collections.sort(infos, EventInfoByDateComparator.INSTANCE); mGroupedEvents = new ArrayList<List<EventInfo>>(); for (int i = 0; i < infos.size();) { date = infos.get(i).date; List<EventInfo> group = new ArrayList<EventInfo>(); while (i < infos.size() && date.equals(infos.get(i).date)) { //Log.d(TAG, " CHILD: " + events.get(i)); group.add(infos.get(i)); ++i; } if (!group.isEmpty()) { Collections.sort(group, EventInfoByDoseTimeComparator.INSTANCE); mGroupedEvents.add(group); } // if i == infos.size() this is the last entry, in which case it's not // neccessary to confuse the user with the lastScheduleUpdateDate message // (it only matters if taken doses exist before this date) if (date.equals(lastScheduleUpdateDate) && i != infos.size()) { group = new ArrayList<EventInfo>(); group.add(EventInfo.newScheduleUpdatedEvent(date)); mGroupedEvents.add(group); } } if (LOGV) Log.d(TAG, "gatherEvents: " + t); }
From source file:fr.gael.dhus.sync.impl.ODataUserSynchronizer.java
@Override public boolean synchronize() throws InterruptedException { int created = 0, updated = 0; try {//from www . ja v a 2s .c o m // Makes query parameters Map<String, String> query_param = new HashMap<>(); if (skip != 0) { query_param.put("$skip", String.valueOf(skip)); } query_param.put("$top", String.valueOf(pageSize)); log(Level.DEBUG, "Querying users from " + skip + " to " + skip + pageSize); ODataFeed userfeed = readFeedLogPerf("/Users", query_param); // For each entry, creates a DataBase Object for (ODataEntry pdt : userfeed.getEntries()) { String username = null; try { Map<String, Object> props = pdt.getProperties(); username = (String) props.get(UserEntitySet.USERNAME); String email = (String) props.get(UserEntitySet.EMAIL); String firstname = (String) props.get(UserEntitySet.FIRSTNAME); String lastname = (String) props.get(UserEntitySet.LASTNAME); String country = (String) props.get(UserEntitySet.COUNTRY); String domain = (String) props.get(UserEntitySet.DOMAIN); String subdomain = (String) props.get(UserEntitySet.SUBDOMAIN); String usage = (String) props.get(UserEntitySet.USAGE); String subusage = (String) props.get(UserEntitySet.SUBUSAGE); String phone = (String) props.get(UserEntitySet.PHONE); String address = (String) props.get(UserEntitySet.ADDRESS); String hash = (String) props.get(UserEntitySet.HASH); String password = (String) props.get(UserEntitySet.PASSWORD); Date creation = ((GregorianCalendar) props.get(UserEntitySet.CREATED)).getTime(); // Uses the Scheme encoder as it is the most restrictives, it only allows // '+' (forbidden char in usernames, so it's ok) // '-' (forbidden char in usernames, so it's ok) // '.' (allowed char in usernames, not problematic) // the alphanumeric character class (a-z A-Z 0-9) String encoded_username = UriUtils.encodeScheme(username, "UTF-8"); // Retrieves Roles String roleq = String.format("/Users('%s')/SystemRoles", encoded_username); ODataFeed userrole = readFeedLogPerf(roleq, null); List<ODataEntry> roles = userrole.getEntries(); List<Role> new_roles = new ArrayList<>(); for (ODataEntry role : roles) { String rolename = (String) role.getProperties().get(SystemRoleEntitySet.NAME); new_roles.add(Role.valueOf(rolename)); } // Has restriction? String restricq = String.format("/Users('%s')/Restrictions", encoded_username); ODataFeed userrestric = readFeedLogPerf(restricq, null); boolean has_restriction = !userrestric.getEntries().isEmpty(); // Reads user in database, may be null User user = USER_SERVICE.getUserNoCheck(username); // Updates existing user if (user != null && (force || creation.equals(user.getCreated()))) { boolean changed = false; // I wish users had their `Updated` field exposed on OData if (!username.equals(user.getUsername())) { user.setUsername(username); changed = true; } if (email == null && user.getEmail() != null || email != null && !email.equals(user.getEmail())) { user.setEmail(email); changed = true; } if (firstname == null && user.getFirstname() != null || firstname != null && !firstname.equals(user.getFirstname())) { user.setFirstname(firstname); changed = true; } if (lastname == null && user.getLastname() != null || lastname != null && !lastname.equals(user.getLastname())) { user.setLastname(lastname); changed = true; } if (country == null && user.getCountry() != null || country != null && !country.equals(user.getCountry())) { user.setCountry(country); changed = true; } if (domain == null && user.getDomain() != null || domain != null && !domain.equals(user.getDomain())) { user.setDomain(domain); changed = true; } if (subdomain == null && user.getSubDomain() != null || subdomain != null && !subdomain.equals(user.getSubDomain())) { user.setSubDomain(subdomain); changed = true; } if (usage == null && user.getUsage() != null || usage != null && !usage.equals(user.getUsage())) { user.setUsage(usage); changed = true; } if (subusage == null && user.getSubUsage() != null || subusage != null && !subusage.equals(user.getSubUsage())) { user.setSubUsage(subusage); changed = true; } if (phone == null && user.getPhone() != null || phone != null && !phone.equals(user.getPhone())) { user.setPhone(phone); changed = true; } if (address == null && user.getAddress() != null || address != null && !address.equals(user.getAddress())) { user.setAddress(address); changed = true; } if (password == null && user.getPassword() != null || password != null && !password.equals(user.getPassword())) { if (hash == null) hash = PasswordEncryption.NONE.getAlgorithmKey(); user.setEncryptedPassword(password, User.PasswordEncryption.valueOf(hash)); changed = true; } //user.setPasswordEncryption(User.PasswordEncryption.valueOf(hash)); if (!SetUtils.isEqualSet(user.getRoles(), new_roles)) { user.setRoles(new_roles); changed = true; } if (has_restriction != !user.getRestrictions().isEmpty()) { if (has_restriction) { user.addRestriction(new LockedAccessRestriction()); } else { user.setRestrictions(Collections.EMPTY_SET); } changed = true; } if (changed) { log(Level.DEBUG, "Updating user " + user.getUsername()); USER_SERVICE.systemUpdateUser(user); updated++; } } // Creates new user else if (user == null) { user = new User(); user.setUsername(username); user.setEmail(email); user.setFirstname(firstname); user.setLastname(lastname); user.setCountry(country); user.setDomain(domain); user.setSubDomain(subdomain); user.setUsage(usage); user.setSubUsage(subusage); user.setPhone(phone); user.setAddress(address); user.setPassword(password); //user.setPasswordEncryption(User.PasswordEncryption.valueOf(hash)); user.setCreated(creation); user.setRoles(new_roles); if (has_restriction) { user.addRestriction(new LockedAccessRestriction()); } log(Level.DEBUG, "Creating new user " + user.getUsername()); USER_SERVICE.systemCreateUser(user); created++; } else { log(Level.ERROR, "Namesake '" + username + "' detected!"); } } catch (RootNotModifiableException e) { } // Ignored exception catch (RequiredFieldMissingException ex) { log(Level.ERROR, "Cannot create user '" + username + "'", ex); } catch (IOException | ODataException ex) { log(Level.ERROR, "OData failure on user '" + username + "'", ex); } this.skip++; } // This is the end, resets `skip` to 0 if (userfeed.getEntries().size() < pageSize) { this.skip = 0; } } catch (IOException | ODataException ex) { log(Level.ERROR, "OData failure", ex); } catch (LockAcquisitionException | CannotAcquireLockException e) { throw new InterruptedException(e.getMessage()); } finally { StringBuilder sb = new StringBuilder("done: "); sb.append(created).append(" new Users, "); sb.append(updated).append(" updated Users, "); sb.append(" from ").append(this.client.getServiceRoot()); log(Level.INFO, sb.toString()); this.syncConf.setConfig("skip", String.valueOf(skip)); SYNC_SERVICE.saveSynchronizer(this); } return false; }
From source file:com.virtusa.akura.student.controller.FaithLifeRatingController.java
/** * populate data for faith life page for relevant student for a selected grade. * /*www . j av a 2 s .c o m*/ * @param request - HttpServletRequest * @param session - HttpSession * @param model - ModelMap * @return name of the view which is redirected to. * @throws AkuraAppException - if error occurs when deleting a Achievement instance. */ @RequestMapping(value = POPULATE_FAITHLIFE_HTM, method = RequestMethod.POST) public String populateData(HttpServletRequest request, HttpSession session, ModelMap model) throws AkuraAppException { int studentId = 0; Date date = null; String strYr = null; double averFaithLife = 0.0; double academicLifeAverage = 0.0; double attendanceAverage = 0.0; String selectedStudClassId = null; if (session.getAttribute(STUDENT_ID) != null) { studentId = (Integer) session.getAttribute(STUDENT_ID); } int studentClassInfoId = 0; if (request.getParameter(SELECTED_GRADE) != null) { studentClassInfoId = (Integer.parseInt(request.getParameter(SELECTED_GRADE))); StudentClassInfo studentClassInfo = studentService.findStudentClassInfoById(studentClassInfoId); strYr = studentClassInfo.getYear().toString(); selectedStudClassId = studentClassInfo.getClassGrade().getGrade().getDescription(); if (DateUtil.getStringYear(studentClassInfo.getYear()).equals(DateUtil.getStringYear(new Date()))) { model.addAttribute(ENABLE_ADD_EDIT_DELETE, NONE); } } else { String studentGrade = (String) session.getAttribute(SESSION_ATT_STUDENT_GRADE); selectedStudClassId = studentGrade; strYr = Integer.toString(DateUtil.currentYearOnly()); model.addAttribute(ENABLE_ADD_EDIT_DELETE, NONE); } date = DateUtil.getDateTypeYearValue(strYr); List<FaithLifeRating> faithLifeRatingList = studentService.getFaithLifeRatingsListForStudent(studentId, date); if (date.equals(DateUtil.getDateTypeYearValue(Integer.toString(DateUtil.currentYearOnly())))) { if (session.getAttribute(AVERAGE_ACADEMIC_LIFE_RATING) != null) { academicLifeAverage = (Double) session.getAttribute(AVERAGE_ACADEMIC_LIFE_RATING); } if (session.getAttribute(AVERAGE_ATTENDANCE_RATING) != null) { attendanceAverage = (Double) session.getAttribute(AVERAGE_ATTENDANCE_RATING); model.addAttribute(MODEL_ATT_ATTENDANCE_RATING, (int) Math.round(attendanceAverage)); } averFaithLife = this.calFaithLifeValue(studentId, date); session.setAttribute(AVERAGE_FAITH_LIFE_RATING, averFaithLife); } else { Map<String, Double> averageMap = studentLoginDelegate.populateStudentProgressBar(studentId, date); averFaithLife = averageMap.get(AVERAGE_FAITH_LIFE_RATING); model.addAttribute(MODEL_ATT_STUDENT_FAITH_LIFE, (int) Math.round(averFaithLife)); academicLifeAverage = averageMap.get(AVERAGE_ACADEMIC_LIFE_RATING); model.addAttribute(MODEL_ATT_STUDENT_ACADEMIC_LIFE, (int) Math.round(academicLifeAverage)); attendanceAverage = averageMap.get(AVERAGE_ATTENDANCE_RATING); model.addAttribute(MODEL_ATT_ATTENDANCE_RATING, (int) Math.round(attendanceAverage)); } FaithLifeRating newFaithLifeRating = (FaithLifeRating) model.get(MODEL_ATT_FAITH_LIFE); if (newFaithLifeRating == null) { newFaithLifeRating = new FaithLifeRating(); } model.addAttribute(MODEL_ATT_FAITH_LIFE, newFaithLifeRating); model.addAttribute(MODEL_ATT_FAITH_LIFE_LIST, faithLifeRatingList); model.addAttribute(MODEL_ATT_SELECTED_ID, selectedStudClassId); model.addAttribute(MODEL_ATT_STUDENT_FAITH_LIFE, (int) Math.round(averFaithLife)); model.addAttribute(MODEL_ATT_STUDENT_ACADEMIC_LIFE, (int) Math.round(academicLifeAverage)); return VIEW_GET_FAITH_LIFE; }
From source file:com.virtusa.akura.student.controller.StudentAcademicLifeController.java
/** * Method to validate studentScholarship types. * //from w ww . ja v a 2 s . co m * @param studentId - student id defined by integer. * @param intsTypeId scholarship type id defined by an integer. * @param year - year which holding the scholarship details defined by Date type variable. * @return boolean value indicating the validation status * @throws AkuraAppException throws when error occurs */ public boolean valiateScholarshipForStudent(int studentId, int intsTypeId, Date year) throws AkuraAppException { boolean flag = false; List<StudentScholarship> stScholList = studentService.getAllStudentScholarshipDetails(); Iterator<StudentScholarship> itr = stScholList.iterator(); // check Scholarship type id if (intsTypeId == 0) { flag = true; } else { while (itr.hasNext()) { StudentScholarship studSchol = (StudentScholarship) itr.next(); int scholTypeId = studSchol.getScholarship().getScholarshipId(); Date yearNew = studSchol.getYear(); int studentNewId = studSchol.getStudent().getStudentId(); if (scholTypeId == intsTypeId && year.equals(yearNew) && studentId == studentNewId) { flag = true; } } } return flag; }
From source file:org.sakaiproject.signup.tool.jsf.organizer.CopyMeetingSignupMBean.java
/** * This is a validator to make sure that the event/meeting starting time is * before ending time etc.// www . ja v a2s . c om * * @param e * an ActionEvent object. */ public void validateCopyMeeting(ActionEvent e) { Date eventEndTime = signupMeeting.getEndTime(); Date eventStartTime = signupMeeting.getStartTime(); /*user defined own TS case*/ if (isUserDefinedTS()) { eventEndTime = getUserDefineTimeslotBean().getEventEndTime(); eventStartTime = getUserDefineTimeslotBean().getEventStartTime(); /*pass the value since they may be null*/ this.signupMeeting.setStartTime(eventStartTime); this.signupMeeting.setEndTime(eventEndTime); if (getUserDefineTimeslotBean().getDestTSwrpList() == null || getUserDefineTimeslotBean().getDestTSwrpList().isEmpty()) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("event.create_custom_defined_TS_blocks")); return; } } if (eventEndTime.before(eventStartTime) || eventStartTime.equals(eventEndTime)) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("event.endTime_should_after_startTime")); return; } if (!(getRepeatType().equals(ONCE_ONLY))) { int repeatNum = getOccurrences(); if ("1".equals(getRecurLengthChoice())) { repeatNum = CreateMeetings.getNumOfRecurrence(getRepeatType(), eventStartTime, getRepeatUntil()); } if ((DAILY.equals(getRepeatType()) || WEEKDAYS.equals(getRepeatType())) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 1)) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.daily.problem")); return; } if (WEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 7)) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.weekly.problem")); return; } if (BIWEEKLY.equals(getRepeatType()) && isMeetingOverRepeatPeriod(eventStartTime, eventEndTime, 14)) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("crossDay.event.repeat.biweekly.problem")); return; } if (repeatNum < 1) { validationError = true; if ("1".equals(getRecurLengthChoice())) Utilities.addErrorMessage(Utilities.rb.getString("event.repeatbeforestart")); else Utilities.addErrorMessage(Utilities.rb.getString("event.repeatNnum.bigger.than.one")); return; } } if (!CreateSitesGroups.isAtleastASiteOrGroupSelected(this.getCurrentSite(), this.getOtherSites())) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("select.atleast.oneGroup.for.copyMeeting")); } /*for custom defined time slot case*/ if (!validationError && isUserDefinedTS()) { this.signupMeeting.setStartTime(eventStartTime); this.signupMeeting.setEndTime(eventEndTime); this.signupMeeting.setMeetingType(CUSTOM_TIMESLOTS); } //Set Location if (StringUtils.isBlank(getCustomLocation())) { if (StringUtils.isBlank(selectedLocation) || selectedLocation.equals(Utilities.rb.getString("select_location"))) { validationError = true; Utilities.addErrorMessage(Utilities.rb.getString("event.location_not_assigned")); return; } this.signupMeeting.setLocation(selectedLocation); } else { this.signupMeeting.setLocation(getCustomLocation()); } //clear the location fields??? this.selectedLocation = ""; //Set Category //if textfield is blank, check the dropdown if (StringUtils.isBlank(getCustomCategory())) { //if dropdown is not the default, then use its value if (!StringUtils.equals(selectedCategory, Utilities.rb.getString("select_category"))) { this.signupMeeting.setCategory(selectedCategory); } } else { this.signupMeeting.setCategory(getCustomCategory()); } //clear the category fields??? this.selectedCategory = ""; //set the creator/organiser this.signupMeeting.setCreatorUserId(creatorUserId); this.creatorUserId = ""; }
From source file:org.linagora.linshare.core.service.impl.UploadRequestServiceImpl.java
/** * Check if the current input date is after now and not before now more the * functionality duration if delegation policy allowed it. * now() < currentDate < now() + func.value * Otherwise functionality value is used as default value. * @param func/*from w w w. j a va 2s. com*/ * @param currentDate * @param expirationDate TODO * @return the proper date is returned according to activation policy, * configuration policy and others checks. */ private Date checkNotificationDate(TimeUnitValueFunctionality func, Date currentDate, Date expirationDate) { if (func.getActivationPolicy().getStatus()) { logger.debug(func.getIdentifier() + " is activated"); Calendar c = new GregorianCalendar(); c.setTime(expirationDate); c.add(func.toCalendarValue(), -func.getValue()); Date minDate = c.getTime(); if (func.getDelegationPolicy() != null && func.getDelegationPolicy().getStatus()) { logger.debug(func.getIdentifier() + " has a delegation policy"); if (currentDate != null) { if (!(currentDate.before(expirationDate) && currentDate.after(minDate))) { // if (!(currentDate.after(new Date()) && currentDate.before(maxDate))) { logger.warn("the current value " + currentDate.toString() + " is out of range : " + func.toString()); return minDate; } return currentDate; } else { return minDate; } } else { // there is no delegation, the current value should be the // system value or null logger.debug(func.getIdentifier() + " does not have a delegation policy"); if (currentDate != null) { if (!currentDate.equals(minDate)) { logger.warn("the current value " + currentDate.toString() + " is different than system value " + minDate); } } return minDate; } } else { logger.debug(func.getIdentifier() + " is not activated"); if (currentDate != null) { logger.warn("the current value " + currentDate.toString() + " should be null for the functionality " + func.toString()); } return null; } }
From source file:at.treedb.db.Base.java
/** * Checks the map containing the changes. Redundant update entries will be * removed.//from www . jav a 2 s . c o m * * @param map * map containing the changes * @throws Exception */ protected void check(UpdateMap map) throws Exception { Class<?> c = this.getClass(); Enum<?>[] list = map.getMap().keySet().toArray(new Enum[map.getMap().keySet().size()]); for (Enum<?> field : list) { Update u = map.get(field); Field f; try { f = c.getDeclaredField(field.name()); } catch (java.lang.NoSuchFieldException e) { f = c.getSuperclass().getDeclaredField(field.name()); } f.setAccessible(true); switch (u.getType()) { case STRING: String value = u.getString(); String s = (String) f.get(this); if ((value == null && s == null) || (s != null && value != null && s.equals(value))) { map.remove(field); } break; case DOUBLE: if (u.getDouble() == (Double) f.get(this)) { map.remove(field); } break; case LONG: if (u.getLong() == (Long) f.get(this)) { map.remove(field); } break; case INT: if (u.getInt() == (Integer) f.get(this)) { map.remove(field); } break; case BINARY: byte[] a = (byte[]) f.get(this); byte[] b = u.getBinary(); if ((a == null && b == null) || (a != null && b != null && Arrays.equals(a, b))) { map.remove(field); } break; case BOOLEAN: if (u.getBoolean() == (Boolean) f.get(this)) { map.remove(field); } break; case DATE: Date dvalue = u.getDate(); Date d = (Date) f.get(this); if ((dvalue == null && d == null) || (d != null && dvalue != null && d.equals(dvalue))) { map.remove(field); } break; case ENUM: if (u.getEnum() == (Enum<?>) f.get(this)) { map.remove(field); } break; case BIGDECIMAL: if (u.getBigDecimal().equals((BigDecimal) f.get(this))) { map.remove(field); } // no check for these types case IMAGE: case ISTRING_DELETE: case ISTRING: case IMAGE_DELETE: case IMAGE_DUMMY: break; default: throw new Exception("Base.check(): Type not implemented: " + u.getType().toString()); } } }
From source file:org.kuali.kfs.module.cam.batch.service.impl.AssetDepreciationServiceImpl.java
protected boolean runAssetDepreciation() throws ParseException { boolean executeJob = false; List<String> errorMessages = new ArrayList<String>(); Date currentDate = convertToDate(dateTimeService.toDateString(dateTimeService.getCurrentDate())); Date beginDate = getBlankOutBeginDate(errorMessages); Date endDate = getBlankOutEndDate(errorMessages); if (hasBlankOutPeriodStarted(beginDate, endDate, errorMessages)) { String blankOutPeriodrunDate = parameterService.getParameterValueAsString(AssetDepreciationStep.class, CamsConstants.Parameters.BLANK_OUT_PERIOD_RUN_DATE); if (!StringHelper.isNullOrEmpty(blankOutPeriodrunDate)) { Date runDate = convertToDate(blankOutPeriodrunDate); if (runDate.compareTo(beginDate) >= 0 && runDate.compareTo(endDate) <= 0) { if (currentDate.equals(runDate)) { executeJob = true;/*from w ww . j a v a 2 s.c o m*/ } else { LOG.info("Today is not BLANK_OUT_PERIOD_RUN_DATE. executeJob not set to true"); } } else { String blankOutBegin = parameterService.getParameterValueAsString(AssetDepreciationStep.class, CamsConstants.Parameters.BLANK_OUT_BEGIN_MMDD); String blankOutEnd = parameterService.getParameterValueAsString(AssetDepreciationStep.class, CamsConstants.Parameters.BLANK_OUT_END_MMDD); String message = "BLANK_OUT_PERIOD_RUN_DATE: " + blankOutPeriodrunDate + " is not in the blank out period range." + "Blank out period range is [ " + blankOutBegin + "-" + blankOutEnd + " ] ."; errorMessages.add(message); LOG.info(message); } } else { String message = "Parameter BLANK_OUT_PERIOD_RUN_DATE (component: Asset Depreciation Step) is not set" + " Please set the date correctly to run the job."; errorMessages.add(message); LOG.info(message); } } else { if (getSchedulerService().cronConditionMet(this.cronExpression)) { executeJob = true; } else { LOG.info("Cron condition not met. executeJob not set to true"); } } if (!executeJob && !errorMessages.isEmpty()) { sendWarningMail(errorMessages); } return executeJob; }
From source file:org.quartz.simpl.RAMJobStore.java
protected boolean applyMisfire(TriggerWrapper tw) { long misfireTime = System.currentTimeMillis(); if (getMisfireThreshold() > 0) { misfireTime -= getMisfireThreshold(); }//from w w w .j a v a 2 s .c o m Date tnft = tw.trigger.getNextFireTime(); if (tnft == null || tnft.getTime() > misfireTime) { return false; } Calendar cal = null; if (tw.trigger.getCalendarName() != null) { cal = retrieveCalendar(null, tw.trigger.getCalendarName()); } signaler.notifyTriggerListenersMisfired((Trigger) tw.trigger.clone()); tw.trigger.updateAfterMisfire(cal); if (tw.trigger.getNextFireTime() == null) { tw.state = TriggerWrapper.STATE_COMPLETE; signaler.notifySchedulerListenersFinalized(tw.trigger); synchronized (triggerLock) { timeTriggers.remove(tw); } } else if (tnft.equals(tw.trigger.getNextFireTime())) { return false; } return true; }