List of usage examples for java.util Date after
public boolean after(Date when)
From source file:org.motechproject.server.service.PNCMotherScheduleTest.java
public void testCreateExpected() { Date date = new Date(); Patient patient = new Patient(); Capture<Date> minDate1Capture = new Capture<Date>(); Capture<Date> dueDate1Capture = new Capture<Date>(); Capture<Date> lateDate1Capture = new Capture<Date>(); Capture<Date> maxDate1Capture = new Capture<Date>(); Capture<Date> minDate2Capture = new Capture<Date>(); Capture<Date> dueDate2Capture = new Capture<Date>(); Capture<Date> lateDate2Capture = new Capture<Date>(); Capture<Date> maxDate2Capture = new Capture<Date>(); Capture<Date> minDate3Capture = new Capture<Date>(); Capture<Date> dueDate3Capture = new Capture<Date>(); Capture<Date> lateDate3Capture = new Capture<Date>(); Capture<Date> maxDate3Capture = new Capture<Date>(); List<Encounter> encounterList = new ArrayList<Encounter>(); List<ExpectedEncounter> expectedEncounterList = new ArrayList<ExpectedEncounter>(); Date deliveryDate = new Date(); expect(registrarBean.getCurrentDeliveryDate(patient)).andReturn(deliveryDate); expect(registrarBean.getEncounters(patient, pncSchedule.getEncounterTypeName(), deliveryDate)) .andReturn(encounterList);//from ww w .j a v a2 s.c om expect(registrarBean.getExpectedEncounters(patient, pncSchedule.getName())) .andReturn(expectedEncounterList); expect(registrarBean.createExpectedEncounter(eq(patient), eq(pncSchedule.getEncounterTypeName()), capture(minDate1Capture), capture(dueDate1Capture), capture(lateDate1Capture), capture(maxDate1Capture), eq(pnc1Event.getName()), eq(pncSchedule.getName()))) .andReturn(new ExpectedEncounter()); expect(registrarBean.createExpectedEncounter(eq(patient), eq(pncSchedule.getEncounterTypeName()), capture(minDate2Capture), capture(dueDate2Capture), capture(lateDate2Capture), capture(maxDate2Capture), eq(pnc2Event.getName()), eq(pncSchedule.getName()))) .andReturn(new ExpectedEncounter()); expect(registrarBean.createExpectedEncounter(eq(patient), eq(pncSchedule.getEncounterTypeName()), capture(minDate3Capture), capture(dueDate3Capture), capture(lateDate3Capture), capture(maxDate3Capture), eq(pnc3Event.getName()), eq(pncSchedule.getName()))) .andReturn(new ExpectedEncounter()); replay(registrarBean); pncSchedule.updateSchedule(patient, date); verify(registrarBean); Date minDate1 = minDate1Capture.getValue(); Date dueDate1 = dueDate1Capture.getValue(); Date lateDate1 = lateDate1Capture.getValue(); Date maxDate1 = maxDate1Capture.getValue(); assertNotNull("Min date is null", minDate1); assertNotNull("Due date is null", dueDate1); assertNotNull("Late date is null", lateDate1); assertTrue("Late date is not after due date", lateDate1.after(dueDate1)); assertNotNull("Max date is null", maxDate1); Date minDate2 = minDate1Capture.getValue(); Date dueDate2 = dueDate1Capture.getValue(); Date lateDate2 = lateDate1Capture.getValue(); Date maxDate2 = maxDate1Capture.getValue(); assertNotNull("Min date is null", minDate2); assertNotNull("Due date is null", dueDate2); assertNotNull("Late date is null", lateDate2); assertTrue("Late date is not after due date", lateDate2.after(dueDate2)); assertNotNull("Max date is null", maxDate2); Date minDate3 = minDate1Capture.getValue(); Date dueDate3 = dueDate1Capture.getValue(); Date lateDate3 = lateDate1Capture.getValue(); Date maxDate3 = maxDate1Capture.getValue(); assertNotNull("Min date is null", minDate3); assertNotNull("Due date is null", dueDate3); assertNotNull("Late date is null", lateDate3); assertTrue("Late date is not after due date", lateDate3.after(dueDate3)); assertNotNull("Max date is null", maxDate3); }
From source file:de.u808.simpleinquest.indexer.impl.IndexUpdater.java
private boolean isDocumentIndexedAndModified(File file, Term uidTerm) throws IOException { TermQuery query = new TermQuery(uidTerm); Hits hits = this.indexSearcher.search(query); if (hits.length() > 0) { Document doc = hits.doc(0); Date lastModified = new Date(DateTools.round(file.lastModified(), DateTools.Resolution.MINUTE)); Date storedDate;//from w w w . j a v a2s . c o m try { storedDate = DateTools.stringToDate(doc.getField(Indexer.MODIFIED_FIELD_NAME).stringValue()); if (lastModified.after(storedDate)) { log.info("File changed " + file.getAbsolutePath()); return true; } else { log.info("File not changed " + file.getAbsolutePath()); return false; } } catch (ParseException e) { log.error("Date pare Exception", e); //zur sicherheit neu indizieren return true; } } else { return false; } }
From source file:de.codesourcery.eve.skills.ui.components.impl.PriceHistoryComponent.java
protected void rememberDate(Date d) { if (this.earliestDate == null || d.before(this.earliestDate)) { earliestDate = d;//from w w w.j ava 2 s. c om } if (latestDate == null || d.after(latestDate)) { latestDate = d; } }
From source file:com.aurel.track.fieldType.bulkSetters.SystemDateBulkSetter.java
/** * Sets the workItemBean's attribute depending on the value and bulkRelation * @param workItemBean//from www .j av a 2s. c o m * @param fieldID * @param parameterCode * @param bulkTranformContext * @param selectContext * @param value * @return ErrorData if an error is found */ @Override public ErrorData setWorkItemAttribute(TWorkItemBean workItemBean, Integer fieldID, Integer parameterCode, BulkTranformContext bulkTranformContext, SelectContext selectContext, Object value) { IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID); if (fieldTypeRT.getHierarchicalBehavior(fieldID, selectContext.getFieldConfigBean(), selectContext.getFieldSettings()) == HIERARCHICAL_BEHAVIOR_OPTIONS.COMPUTE_BOTTOM_UP && ItemBL.hasChildren(workItemBean.getObjectID())) { //if the current workItem has children the start and end date should be derived and not directly set -> //silently ignore the value to set and leave it unchanged. //The dates will be computed starting from the leaf workItems return null; } Boolean adjustBothDates = Boolean.FALSE; int bulkRelation = getRelation(); if (bulkRelation == BulkRelations.SET_EARLIEST_STARTING_FROM || bulkRelation == BulkRelations.SET_LATEST_ENDING_AT || bulkRelation == BulkRelations.MOVE_BY_DAYS) { //for these bulkRelation the value is a map Map<Integer, Object> dateWithAdjustBothDates = null; try { dateWithAdjustBothDates = (Map<Integer, Object>) value; } catch (Exception e) { LOGGER.warn("Converting the " + value + " to Map for setting the attribute failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (dateWithAdjustBothDates == null) { return null; } try { //!!!!!change the value from a map to a date //because super.setWorkItemAttribute() works only with dates!!!!! value = dateWithAdjustBothDates.get(Integer.valueOf(0)); } catch (Exception e) { LOGGER.warn("Converting the " + dateWithAdjustBothDates.get(Integer.valueOf(0)) + " to Date for setting the attribute failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } try { adjustBothDates = (Boolean) dateWithAdjustBothDates.get(Integer.valueOf(1)); } catch (Exception e) { LOGGER.warn("Converting the " + dateWithAdjustBothDates.get(Integer.valueOf(1)) + " to Boolean for setting the attribute failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } super.setWorkItemAttribute(workItemBean, fieldID, parameterCode, bulkTranformContext, selectContext, value); Set<Integer> selectedFieldsSet = bulkTranformContext.getSelectedFieldsSet(); if (adjustBothDates != null && adjustBothDates.booleanValue()) { Integer oppositeDate = getOppositeField(fieldID); if ((bulkRelation == BulkRelations.SET_EARLIEST_STARTING_FROM || bulkRelation == BulkRelations.SET_LATEST_ENDING_AT)) { //combined shift by days: if adjust both dates checkbox is checked //only one date can be selected (either start or end date) //the offset is already calculated in the valueCache of the BulkTranformContext //so use the same offset for the other date to shift days by Map<Integer, Object> valueCache = bulkTranformContext.getValueCache(); if (valueCache != null && valueCache.get(fieldID) != null) { valueCache.put(oppositeDate, valueCache.get(fieldID)); } super.setWorkItemAttribute(workItemBean, oppositeDate, parameterCode, bulkTranformContext, selectContext, value); } else { if (bulkRelation == BulkRelations.MOVE_BY_DAYS) { Integer moveByDays = null; try { moveByDays = (Integer) value; } catch (Exception e) { LOGGER.warn("Converting the move by days " + value + " to Integer failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (moveByDays != null) { //start dates already shifted: now shift also end dates but with the same offset as the one for start dates Object originalValue = workItemBean.getAttribute(oppositeDate, parameterCode); if (originalValue == null) { return null; } Date originalDate = null; try { originalDate = (Date) originalValue; } catch (Exception e) { LOGGER.warn("Converting the original value " + originalValue + " to Date failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } workItemBean.setAttribute(oppositeDate, parameterCode, shiftByDays(originalDate, moveByDays)); } } } } else { //when the start date is set already (super.setWorkItemAttribute()) and the endDate is not yet set //but it is selected for mass operation (will be set in a the next call to setWorkItemAttribute()) //then do not validate for 'startDateAfterEndDate' now. The validation should take place after the end date is also set //WARNING: we suppose that the startDate is set before the endDate if both are selected for bulk operation if (SystemFields.INTEGER_STARTDATE.equals(fieldID) && selectedFieldsSet.contains(SystemFields.INTEGER_ENDDATE)) { //setWorkItemAttribute() will be called soon also for endDate return null; } if (SystemFields.INTEGER_TOP_DOWN_START_DATE.equals(fieldID) && selectedFieldsSet.contains(SystemFields.INTEGER_TOP_DOWN_END_DATE)) { //setWorkItemAttribute() will be called soon also for top down endDate return null; } } Date startDate = workItemBean.getStartDate(); Date endDate = workItemBean.getEndDate(); if (startDate != null && endDate != null && startDate.after(endDate) && !CalendarUtil.sameDay(startDate, endDate)) { return new ErrorData("itemov.massOperation.err.startDateAfterEndDate"); } Date topDownStartDate = workItemBean.getTopDownStartDate(); Date topDownEndDate = workItemBean.getTopDownEndDate(); if (topDownStartDate != null && topDownEndDate != null && topDownStartDate.after(topDownEndDate) && !CalendarUtil.sameDay(topDownStartDate, topDownEndDate)) { return new ErrorData("itemov.massOperation.err.startDateAfterEndDate"); } return null; }
From source file:com.gsma.mobileconnect.impl.DiscoveryImpl.java
/** * Determine the time-to-live for a discovery response. * <p>/*from w w w . j av a2s. c o m*/ * Ensure the ttl is between a minimum and maximum value. * * @param ttlTime The ttl value from the discovery result. * @return The ttl to use. */ Date determineTtl(Long ttlTime) { Long now = new Date().getTime(); Date min = new Date(now + Constants.MINIMUM_TTL_MS); Date max = new Date(now + Constants.MAXIMUM_TTL_MS); if (null == ttlTime) { return min; } Date currentTtl = new Date(ttlTime); if (currentTtl.before(min)) { return min; } if (currentTtl.after(max)) { return max; } return currentTtl; }
From source file:com.virtusa.akura.reporting.controller.GenerateTeacherEarlyLateAttendiesReportController.java
/** * Perform the logic of the controller to generate Teacher Wise Attendance Report . * * @param attendeesWrapperTemplate of type AttendeesWrapperTemplate * @param request of type HttpServletRequest * @param response of type HttpServletResponse * @param errors of type BindingResult/*from w w w. j a v a 2 s . c om*/ * @return java.lang.String * @param map of type ModelMap * @throws AkuraAppException AkuraAppException */ @SuppressWarnings("unchecked") @RequestMapping(value = REQUEST_PARA_TEACHER_LATE, method = RequestMethod.POST) public String onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute(MODEL_ATT_ATTENDANCE_WRAPPER_TEMPLATE) AttendeesWrapperTemplate attendeesWrapperTemplate, BindingResult errors, ModelMap map) throws AkuraAppException { String returnString = STRING_EMPTY; lateComersValidator.validate(attendeesWrapperTemplate, errors); if (errors.hasErrors()) { return VIEW_PAGE; } Map<String, Object> params = new HashMap<String, Object>(); params.put(REPORT_PARA_TITLE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_LATE_ATTEND_REPORT)); params.put(REPORT_PARA_TEACHERID, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_ID)); params.put(REPORT_PARA_TEACHERNAME, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TEACHER_NAME)); params.put(REPORT_PARA_DATE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_DATE_CONSIDERED)); params.put(REPORT_PARA_TIMEIN, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_IN)); params.put(REPORT_PARA_TIMEOUT, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_OUT)); params.put(REPORT_PARA_DATEFROM, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateFrom()); params.put(REPORT_PARA_DATETO, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateTo()); params.put(REPORT_PARA_TIMEINFROM, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getTimeInFrom() + VARIABLE_HOURS_HR); params.put(REPORT_PARA_TIMEINTO, attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getTimeInTo() + VARIABLE_HOURS_HR); params.put(REPORT_PARA_LOGO_PATH, ReportUtil.getReportLogo()); params.put(STYLE_TEMPLATE, PropertyReader.getPropertyValue(SYSTEM_CONFIG, APPSERVER_HOME) + PropertyReader.getPropertyValue(SYSTEM_CONFIG, STYLE_PATH)); params.put(DATE_FROM, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_DATE_FROM)); params.put(DATE_TO, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_DATE_TO)); params.put(TIME_IN_FROM, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_TIME_IN_FROM)); params.put(TIME_IN_TO, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, STAFF_WISE_ATTENDEES_TIME_IN_TO)); params.put(REPORT_GENERATED_ON, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_ON_TEXT)); params.put(REPORT_KEY_DATE_TYPE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_DATE_TYPE_ON_TEXT)); params.put(GENERATED_DATE, DateUtil.getReportGeneratedDate( PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_DATE_LOCALE))); params.put(PAGE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_PAGE)); params.put(GPL, AkuraWebConstant.REPORT_GPL); JRBeanCollectionDataSource jrBeanDataSource = attendanceReportingService .getTeacherLateAttendies(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate()); List<TeacherAttendance> objList = null; if (jrBeanDataSource.getRecordCount() != 0) { objList = (List<TeacherAttendance>) jrBeanDataSource.getData(); } Date fromDate = DateUtil .getParseDate(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateFrom()); Date toDate = DateUtil.getParseDate(attendeesWrapperTemplate.getTeacherLateAttendiesTemplate().getDateTo()); if (objList != null) { for (TeacherAttendance obj : objList) { int staffId = obj.getStaffId(); Date attDate = DateUtil.getParseDate(obj.getDate()); List<StaffLeave> staffLeaveList = staffService.getStaffLeaveListByDatePeriodAndStaffId(fromDate, toDate, staffId); if (!staffLeaveList.isEmpty()) { for (StaffLeave sl : staffLeaveList) { Date getFromDate = DateUtil.getParseDate(sl.getFromDate().toString()); Date getToDate = DateUtil.getParseDate(sl.getToDate().toString()); if ((sl.getStaffLeaveStatusId() == 1) && (getFromDate.before(attDate) && getToDate.after(attDate))) { setDayType(obj, sl); } else if ((sl.getStaffLeaveStatusId() == 1) && (getFromDate.equals(attDate) || getToDate.equals(attDate))) { setDayType(obj, sl); } } } } } if (jrBeanDataSource.getRecordCount() != 0) { displayReportForm(response, jrBeanDataSource, params, REPORT_NAME); } else { returnString = VIEW_PAGE; setErrorMessage(map); } return returnString; }
From source file:ru.apertum.qsystem.reports.formirovators.StatisticUsers.java
@Override public String validate(String driverClassName, String url, String username, String password, HttpRequest request, HashMap<String, String> params) { //sd=20.01.2009&ed=28.01.2009 // ? /*from w ww .j a va 2 s . c o m*/ QLog.l().logger().trace("? \"" + params.toString() + "\"."); if (params.size() == 2) { Date sd, fd, fd1; try { sd = Uses.format_dd_MM_yyyy.parse(params.get("sd")); fd = Uses.format_dd_MM_yyyy.parse(params.get("ed")); fd1 = DateUtils.addDays(Uses.format_dd_MM_yyyy.parse(params.get("ed")), 1); } catch (ParseException ex) { return "<br> ! ? ? (..)."; } if (!sd.after(fd)) { paramMap.put("sd", sd); paramMap.put("ed", fd); paramMap.put("ed1", fd1); } else { return "<br> ! ?."; } } else { return "<br> !"; } return null;// ? }
From source file:com.virtusa.akura.reporting.controller.GenerateStudentWiseAttendanceReportController.java
/** * Perform the logic of the controller to generate Teacher Wise Attendance Report . * /*from ww w .j a v a2s . co m*/ * @param studentTemplate of type StudentWiseAttendanceTemplate * @param request of type HttpServletRequest * @param response of type HttpServletResponse * @param errors of type BindingResult * @return java.lang.String * @param map of type ModelMap * @throws AkuraAppException AkuraAppException */ @RequestMapping(value = REQ_MAP_STUDENT_ATTENDANCE_REPORT, method = RequestMethod.POST) public String onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute(MODEL_ATT_STUDENT_WISE_ATTENDANCE_TEMPLATE) StudentWiseAttendanceTemplate studentTemplate, BindingResult errors, ModelMap map) throws AkuraAppException { String selectedClass = request.getParameter(SELECTED_CLASS); String reqAddmission = request.getParameter(SELECTED_ADDMISSION); String[] noParts = reqAddmission.split( AkuraWebConstant.SPACE_STRING + AkuraWebConstant.DASH_STRING + AkuraWebConstant.SPACE_STRING); String selectedAddmission = noParts[0]; ClassGrade classGrade = commonService.findClassGrade(Integer.parseInt(selectedClass)); studentTemplate.setStudentID(selectedAddmission); if (selectedAddmission == null) { String message = new ErrorMsgLoader().getErrorMessage(ERROR_MSG_MANDATORY_FIELD_REQUIRED); map.addAttribute(MESSAGE, message); if (classGrade != null) { map.addAttribute(MODEL_ATT_SELECTED_CLASS_GRADE_ID, classGrade.getClassGradeId()); } return VIEW_PAGE; } String returnString = STRING_EMPTY; studentWiseAttendanceValidator.validate(studentTemplate, errors); if (errors.hasErrors()) { if (classGrade != null) { map.addAttribute(MODEL_ATT_SELECTED_CLASS_GRADE_ID, classGrade.getClassGradeId()); } map.addAttribute(MODEL_ATT_SELECTED_ADDMISSION_NO, selectedAddmission); return VIEW_PAGE; } if (selectedClass.equals(AkuraWebConstant.STRING_ZERO)) { String message = new ErrorMsgLoader().getErrorMessage(ERROR_MSG_MANDATORY_FIELD_REQUIRED); map.addAttribute(MESSAGE, message); if (classGrade != null) { map.addAttribute(MODEL_ATT_SELECTED_CLASS_GRADE_ID, classGrade.getClassGradeId()); } map.addAttribute(MODEL_ATT_SELECTED_ADDMISSION_NO, selectedAddmission); return VIEW_PAGE; } Map<String, Object> params = new HashMap<String, Object>(); params.put(REPORT_PARA_TITLE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_STUDENT_WISE_ATTENDANCE_REPORT)); params.put(REPORT_PARA_STUDENTID, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_STUDENT_ID)); params.put(REPORT_PARA_STUDENTNAME, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_STUDENT_NAME)); params.put(REPORT_PARA_DATE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_DATE)); params.put(REPORT_PARA_TIMEIN, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_IN)); params.put(REPORT_PARA_TIMEOUT, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_VALUE_TIME_OUT)); params.put(REPORT_PARA_STUDENT, studentTemplate.getDateFrom()); params.put(REPORT_PARA_DATEFROM, studentTemplate.getDateFrom()); params.put(REPORT_PARA_DATETO, studentTemplate.getDateTo()); params.put(REPORT_PARA_ATTENDANCE_FROM, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_PARA_ATTENDANCE_FROM_TEXT)); params.put(REPORT_PARA_ATTENDANCE_TO, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_PARA_ATTENDANCE_TO_TEXT)); params.put(REPORT_PARA_LOGO_PATH, ReportUtil.getReportLogo()); params.put(STYLE_TEMPLATE, PropertyReader.getPropertyValue(SYSTEM_CONFIG, APPSERVER_HOME) + PropertyReader.getPropertyValue(SYSTEM_CONFIG, STYLE_PATH)); params.put(REPORT_GENERATED_ON, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_ON_TEXT)); params.put(GENERATED_DATE, DateUtil.getReportGeneratedDate( PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_GENERATED_DATE_LOCALE))); params.put(PAGE, PropertyReader.getPropertyValue(ReportUtil.REPORT_TEMPLATE, REPORT_PAGE)); params.put(GPL, AkuraWebConstant.REPORT_GPL); String todateString = studentTemplate.getDateTo(); String fromDateString = studentTemplate.getDateFrom(); Date toDate = DateUtil.getParseDate(todateString); Date fromDate = DateUtil.getParseDate(fromDateString); int studentId = studentService.findStudentIdForAdmissionNo(selectedAddmission); Student student = studentService.findStudent(studentId); Date departureDate = student.getDateOfDeparture(); if (departureDate != null) { if (departureDate.before(toDate) && departureDate.after(fromDate)) { String depatureDateString = DateUtil.getFormatDate(departureDate); studentTemplate.setDateTo(depatureDateString); } } JRBeanCollectionDataSource studentWiseAttendanceSummary = attendanceReportingService .getStudentWiseAttendanceSummary(studentTemplate); if (studentWiseAttendanceSummary.getRecordCount() != 0) { ReportUtil.displayReportInPdfForm(response, studentWiseAttendanceSummary, params, REPORT_NAME_STUDENT_WISE_ATTENDANCE); } else { setErrorMessage(map); if (classGrade != null) { map.addAttribute(MODEL_ATT_SELECTED_CLASS_GRADE_ID, classGrade.getClassGradeId()); } map.addAttribute(MODEL_ATT_SELECTED_ADDMISSION_NO, selectedAddmission); returnString = VIEW_PAGE; } return returnString; }