List of usage examples for org.joda.time LocalDate minusDays
public LocalDate minusDays(int days)
From source file:com.gst.portfolio.savings.domain.SavingsHelper.java
License:Apache License
public List<LocalDateInterval> determineInterestPostingPeriods( final LocalDate startInterestCalculationLocalDate, final LocalDate interestPostingUpToDate, final SavingsPostingInterestPeriodType postingPeriodType, final Integer financialYearBeginningMonth, List<LocalDate> postInterestAsOn) { final List<LocalDateInterval> postingPeriods = new ArrayList<>(); LocalDate periodStartDate = startInterestCalculationLocalDate; LocalDate periodEndDate = periodStartDate; LocalDate actualPeriodStartDate = periodStartDate; while (!periodStartDate.isAfter(interestPostingUpToDate) && !periodEndDate.isAfter(interestPostingUpToDate)) { final LocalDate interestPostingLocalDate = determineInterestPostingPeriodEndDateFrom(periodStartDate, postingPeriodType, interestPostingUpToDate, financialYearBeginningMonth); periodEndDate = interestPostingLocalDate.minusDays(1); if (!postInterestAsOn.isEmpty()) { for (LocalDate transactiondate : postInterestAsOn) { if (periodStartDate.isBefore(transactiondate) && (periodEndDate.isAfter(transactiondate) || periodEndDate.isEqual(transactiondate))) { periodEndDate = transactiondate.minusDays(1); actualPeriodStartDate = periodEndDate; break; }//from w w w. java2 s.co m } } postingPeriods.add(LocalDateInterval.create(periodStartDate, periodEndDate)); if (actualPeriodStartDate.isEqual(periodEndDate)) { periodEndDate = actualPeriodStartDate.plusDays(1); periodStartDate = actualPeriodStartDate.plusDays(1); } else { periodEndDate = interestPostingLocalDate; periodStartDate = interestPostingLocalDate; } } return postingPeriods; }
From source file:com.gst.portfolio.savings.service.DepositAccountPreMatureCalculationPlatformServiceImpl.java
License:Apache License
@Transactional @Override/*w w w . j a v a2 s .c o m*/ public DepositAccountData calculatePreMatureAmount(final Long accountId, final JsonQuery query, final DepositAccountType depositAccountType) { final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService .isSavingsInterestPostingAtCurrentPeriodEnd(); final Integer financialYearBeginningMonth = this.configurationDomainService .retrieveFinancialYearBeginningMonth(); this.depositAccountTransactionDataValidator.validatePreMatureAmountCalculation(query.json(), depositAccountType); final SavingsAccount account = this.depositAccountAssembler.assembleFrom(accountId, depositAccountType); DepositAccountData accountData = null; Collection<EnumOptionData> onAccountClosureOptions = SavingsEnumerations.depositAccountOnClosureType( new DepositAccountOnClosureType[] { DepositAccountOnClosureType.WITHDRAW_DEPOSIT, DepositAccountOnClosureType.TRANSFER_TO_SAVINGS }); final Collection<PaymentTypeData> paymentTypeOptions = this.paymentTypeReadPlatformService .retrieveAllPaymentTypes(); final Collection<SavingsAccountData> savingsAccountDatas = this.savingsAccountReadPlatformService .retrieveActiveForLookup(account.clientId(), DepositAccountType.SAVINGS_DEPOSIT); final JsonElement element = this.fromJsonHelper.parse(query.json()); final LocalDate preMaturityDate = this.fromJsonHelper.extractLocalDateNamed(closedOnDateParamName, element); // calculate interest before one day of closure date final LocalDate interestCalculatedToDate = preMaturityDate.minusDays(1); final boolean isPreMatureClosure = true; if (depositAccountType.isFixedDeposit()) { final FixedDepositAccount fd = (FixedDepositAccount) account; accountData = FixedDepositAccountData.preClosureDetails(account.getId(), fd.calculatePreMatureAmount(interestCalculatedToDate, isPreMatureClosure, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth), onAccountClosureOptions, paymentTypeOptions, savingsAccountDatas); } else if (depositAccountType.isRecurringDeposit()) { final RecurringDepositAccount rd = (RecurringDepositAccount) account; accountData = RecurringDepositAccountData.preClosureDetails(account.getId(), rd.calculatePreMatureAmount(interestCalculatedToDate, isPreMatureClosure, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth), onAccountClosureOptions, paymentTypeOptions, savingsAccountDatas); } return accountData; }
From source file:com.helger.datetime.holiday.mgr.XMLHolidayManagerJapan.java
License:Apache License
/** * Implements the rule which requests if two holidays have one non holiday * between each other than this day is also a holiday. *//*from ww w.java2 s . c o m*/ @Override public HolidayMap getHolidays(final int nYear, @Nullable final String... aArgs) { final HolidayMap aHolidays = super.getHolidays(nYear, aArgs); final HolidayMap aAdditionalHolidays = new HolidayMap(); for (final Map.Entry<LocalDate, ISingleHoliday> aEntry : aHolidays.getMap().entrySet()) { final LocalDate aTwoDaysLater = aEntry.getKey().plusDays(2); if (aHolidays.containsHolidayForDate(aTwoDaysLater)) { final LocalDate aBridgingDate = aTwoDaysLater.minusDays(1); aAdditionalHolidays.add(aBridgingDate, new ResourceBundleHoliday(EHolidayType.OFFICIAL_HOLIDAY, BRIDGING_HOLIDAY_PROPERTIES_KEY)); } } aHolidays.addAll(aAdditionalHolidays); return aHolidays; }
From source file:com.helger.datetime.holiday.parser.impl.ChristianHolidayParser.java
License:Apache License
/** * {@inheritDoc} Parses all christian holidays relative to eastern. */// w w w . j a v a2s .com @Override public void parse(final int nYear, final HolidayMap aHolidayMap, final Holidays aConfig) { for (final ChristianHoliday aChristianHoliday : aConfig.getChristianHoliday()) { if (!isValid(aChristianHoliday, nYear)) continue; LocalDate aEasterSunday; if (aChristianHoliday.getChronology() == ChronologyType.JULIAN) aEasterSunday = getJulianEasterSunday(nYear); else if (aChristianHoliday.getChronology() == ChronologyType.GREGORIAN) aEasterSunday = getGregorianEasterSunday(nYear); else aEasterSunday = getEasterSunday(nYear); switch (aChristianHoliday.getType()) { case EASTER: break; case CLEAN_MONDAY: case SHROVE_MONDAY: aEasterSunday = aEasterSunday.minusDays(48); break; case MARDI_GRAS: case CARNIVAL: aEasterSunday = aEasterSunday.minusDays(47); break; case ASH_WEDNESDAY: aEasterSunday = aEasterSunday.minusDays(46); break; case MAUNDY_THURSDAY: aEasterSunday = aEasterSunday.minusDays(3); break; case GOOD_FRIDAY: aEasterSunday = aEasterSunday.minusDays(2); break; case EASTER_SATURDAY: aEasterSunday = aEasterSunday.minusDays(1); break; case EASTER_MONDAY: aEasterSunday = aEasterSunday.plusDays(1); break; case EASTER_TUESDAY: aEasterSunday = aEasterSunday.plusDays(2); break; case GENERAL_PRAYER_DAY: aEasterSunday = aEasterSunday.plusDays(26); break; case ASCENSION_DAY: aEasterSunday = aEasterSunday.plusDays(39); break; case PENTECOST: case WHIT_SUNDAY: aEasterSunday = aEasterSunday.plusDays(49); break; case WHIT_MONDAY: case PENTECOST_MONDAY: aEasterSunday = aEasterSunday.plusDays(50); break; case CORPUS_CHRISTI: aEasterSunday = aEasterSunday.plusDays(60); break; case SACRED_HEART: aEasterSunday = aEasterSunday.plusDays(68); break; default: throw new IllegalArgumentException("Unknown christian holiday type " + aChristianHoliday.getType()); } final LocalDate aConvertedDate = CalendarUtil.convertToGregorianDate(aEasterSunday); final IHolidayType aType = XMLUtil.getType(aChristianHoliday.getLocalizedType()); final String sPropertiesKey = "christian." + aChristianHoliday.getType().name(); addChrstianHoliday(aConvertedDate, sPropertiesKey, aType, aHolidayMap); } }
From source file:com.helger.datetime.holiday.parser.impl.FixedWeekdayRelativeToFixedParser.java
License:Apache License
/** * Parses the provided configuration and creates holidays for the provided * year.//from www .ja v a 2s . c om */ public void parse(final int nYear, final HolidayMap aHolidayMap, final Holidays aConfig) { for (final FixedWeekdayRelativeToFixed aFixedWeekdayRelativeToFixed : aConfig .getFixedWeekdayRelativeToFixed()) { if (!isValid(aFixedWeekdayRelativeToFixed, nYear)) continue; // parsing fixed day final int nExpectedWeekday = XMLUtil.getWeekday(aFixedWeekdayRelativeToFixed.getWeekday()); LocalDate aDay = XMLUtil.create(nYear, aFixedWeekdayRelativeToFixed.getDay()); do { // move fixed to first occurrence of weekday aDay = aFixedWeekdayRelativeToFixed.getWhen() == When.AFTER ? aDay.plusDays(1) : aDay.minusDays(1); } while (aDay.getDayOfWeek() != nExpectedWeekday); int nDays = 0; switch (aFixedWeekdayRelativeToFixed.getWhich()) { case FIRST: break; case SECOND: nDays = 7; break; case THIRD: nDays = 14; break; case FOURTH: nDays = 21; break; case LAST: // seems to be unsupported break; } // move day further if it is second, third or fourth weekday aDay = aFixedWeekdayRelativeToFixed.getWhen() == When.AFTER ? aDay.plusDays(nDays) : aDay.minusDays(nDays); final IHolidayType aType = XMLUtil.getType(aFixedWeekdayRelativeToFixed.getLocalizedType()); final String sPropertyKey = aFixedWeekdayRelativeToFixed.getDescriptionPropertiesKey(); aHolidayMap.add(aDay, new ResourceBundleHoliday(aType, sPropertyKey)); } }
From source file:com.index.IndexServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods./*from ww w. j a v a 2 s. co m*/ * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if (request.getParameter("startdate") == null && request.getParameter("enddate") == null) { DateTime now = new DateTime(); LocalDate today = now.toLocalDate(); LocalDate tomorrow = today.plusDays(1); IndexData data = new IndexData(today.minusDays(7).toString(), tomorrow.toString(), "leadSession", request.getContextPath()); request.setAttribute("mostlyVisited", data.getMostlyVisited()); request.setAttribute("totalSessionCount", data.getTotalSessionCount()); request.setAttribute("totalAddressCount", data.getTotalAddressCount()); request.setAttribute("companyLinks", data.getCompanyLinks()); request.setAttribute("contacts", data.getContacts()); } if (request.getParameter("startdate") != null && request.getParameter("enddate") != null) { IndexData data = new IndexData(request.getParameter("startdate"), request.getParameter("enddate"), "leadSession", request.getContextPath()); request.setAttribute("mostlyVisited", data.getMostlyVisited()); request.setAttribute("totalSessionCount", data.getTotalSessionCount()); request.setAttribute("totalAddressCount", data.getTotalAddressCount()); request.setAttribute("companyLinks", data.getCompanyLinks()); request.setAttribute("contacts", data.getContacts()); } request.getRequestDispatcher("/index.jsp").forward(request, response); }
From source file:com.inkubator.hrm.web.HomeDashboardController.java
@PostConstruct @Override/*from ww w . j a v a 2 s .co m*/ public void initialization() { super.initialization(); distribusiKaryawanPerDepartment = new CartesianChartModel(); barChartDistribusiByDept = new BarChartModel(); pieModel = new PieChartModel(); totalMale = new Long(0); totalFemale = new Long(0); try { /** * find All holiday date based on JadwalKaryawan "DEFAULT" which is * OFF and public holiday */ LocalDate now = new LocalDate(); startCalendarDate = now.dayOfMonth().withMinimumValue().toDate(); endCalendarDate = now.dayOfMonth().withMaximumValue().toDate(); Set<Date> holidays = wtScheduleShiftService.getAllRegulerOffDaysBetween(startCalendarDate, endCalendarDate); for (Date holiday : holidays) { DateTime dtHoliday = new DateTime(holiday); listHolidayDate.add(dtHoliday.getDayOfMonth()); } /** * calculate employee distribution based on GENDER */ Map<String, Long> employeesByGender = empDataService.getTotalByGender(HrmUserInfoUtil.getCompanyId()); totalFemale = employeesByGender.get("male"); totalMale = employeesByGender.get("female"); lastUpdateEmpDistByGender = new Date(employeesByGender.get("lastUpdate")); /** * calculate employee distribution based on DEPARTMENT */ Map<String, Long> employeesByDepartment = empDataService .getTotalByDepartment(HrmUserInfoUtil.getCompanyId()); int i = 0; for (Map.Entry<String, Long> entry : employeesByDepartment.entrySet()) { /** * only 8 department is allowed to show atau jika entry key nya * "lastUpdate" berarti itu akhir dari list */ if (i == 8 || StringUtils.equals(entry.getKey(), "lastUpdate")) { break; } i++; ChartSeries deptSeries = new ChartSeries(); deptSeries.setLabel(entry.getKey()); deptSeries.set("Department", entry.getValue()); barChartDistribusiByDept.addSeries(deptSeries); } barChartDistribusiByDept.setLegendPosition("ne"); barChartDistribusiByDept.setStacked(false); barChartDistribusiByDept.setShowDatatip(true); barChartDistribusiByDept.setLegendCols(4); barChartDistribusiByDept.setLegendRows(2); barChartDistribusiByDept.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc,006666,660066"); lastUpdateEmpDistByDepartment = new Date(employeesByDepartment.get("lastUpdate")); /** * calculate employee distribution based on AGE */ Map<String, Long> employeesByAge = empDataService.getTotalByAge(HrmUserInfoUtil.getCompanyId()); pieModel.set("< 26", employeesByAge.get("lessThan26")); pieModel.set("25-30", employeesByAge.get("between26And30")); pieModel.set("31-35", employeesByAge.get("between31And35")); pieModel.set("36-40", employeesByAge.get("between36And40")); pieModel.set("> 40", employeesByAge.get("moreThan40")); pieModel.setLegendPosition("e"); pieModel.setFill(false); pieModel.setShowDataLabels(true); pieModel.setSliceMargin(4); pieModel.setDiameter(120); pieModel.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc"); lastUpdateEmpDistByAge = new Date(employeesByAge.get("lastUpdate")); /** * calculate employee resume */ employeeResumeModel = empDataService.getEmployeeResumeOnDashboard(HrmUserInfoUtil.getCompanyId()); /** * calculate attendance statistic */ attendanceModel = tempAttendanceRealizationService.getStatisticEmpAttendaceRealization(); double totalPresent = Double.parseDouble(String.valueOf(attendanceModel.getTotaldayPresent())); double totalSchedule = Double.parseDouble(String.valueOf(attendanceModel.getTotaldaySchedule())); totalPersent = (totalPresent / totalSchedule); persentasiKehadiranPerWeek = new CartesianChartModel(); barChartModel = new BarChartModel(); barChartModel.setStacked(false); barChartModel.setLegendPosition("ne"); barChartModel.setLegendCols(6); barChartModel.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc"); barChartModel.setShowDatatip(true); barChartModel.setShadow(true); barChartModel.setShowPointLabels(true); Axis yAxis = barChartModel.getAxis(AxisType.Y); yAxis.setMax(150); yAxis.setMin(0); //Get Attendance Percentation per Department on Active Period Map<String, List<DepAttendanceRealizationViewModel>> mapResult = empDataService .getListDepAttendanceByCompanyId(HrmUserInfoUtil.getCompanyId()); //Looping and render it for (Map.Entry<String, List<DepAttendanceRealizationViewModel>> entry : mapResult.entrySet()) { ChartSeries charDepartmentSeries = new ChartSeries(); charDepartmentSeries.setLabel(entry.getKey()); List<DepAttendanceRealizationViewModel> listDepartmentModel = Lambda.sort(entry.getValue(), Lambda.on(DepAttendanceRealizationViewModel.class).getWeekNumber()); for (DepAttendanceRealizationViewModel depAttendanceModel : listDepartmentModel) { charDepartmentSeries.set( ResourceBundleUtil.getAsString("global.week") + " " + depAttendanceModel.getWeekNumber(), depAttendanceModel.getAttendancePercentage().doubleValue() * 100); } barChartModel.addSeries(charDepartmentSeries); } /** * calculate attendance statistic from 6 days ago until yesterday */ SimpleDateFormat formatter = new SimpleDateFormat("MMMM yyyy", LocaleContextHolder.getLocale()); int week = Calendar.getInstance().get(Calendar.WEEK_OF_MONTH); StringBuffer buff = new StringBuffer(); buff.append(week); if (LocaleContextHolder.getLocale().getLanguage().equals("en")) { buff.append(StringUtils.suffixesDayOfMonth[week]); } Object[] parameters = { buff.toString(), formatter.format(now.toDate()) }; ResourceBundle bundle = ResourceBundle.getBundle("Messages", LocaleContextHolder.getLocale()); presentationAttendancePerDayLabel = MessageFormat.format(bundle.getString("home.week_update_data"), parameters); List<Date> listTanggalWaktuKerja = new ArrayList<>(); IntStream.range(1, 6).forEach(num -> listTanggalWaktuKerja.add(now.minusDays(num).toDate())); List<ChartSeries> listPresentasiAttendance = empDataService .getEmployeePresentationAttendanceOnDashboard(HrmUserInfoUtil.getCompanyId(), listTanggalWaktuKerja, "dd MMM yyyy"); presentationAttendancePerDayBarChartModel = new HorizontalBarChartModel(); listPresentasiAttendance.forEach(series -> presentationAttendancePerDayBarChartModel.addSeries(series)); presentationAttendancePerDayBarChartModel.setStacked(true); presentationAttendancePerDayBarChartModel.setShowDatatip(true); presentationAttendancePerDayBarChartModel.setLegendPosition("se"); presentationAttendancePerDayBarChartModel .setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc,d500d5,ff2a55"); Axis xAxis = presentationAttendancePerDayBarChartModel.getAxis(AxisType.X); xAxis.setMax(300); xAxis.setTickInterval("20"); xAxis.setMin(0); } catch (Exception e) { LOGGER.error("Error ", e); } }
From source file:com.inkubator.hrm.web.mobile.HomeMobileController.java
@PostConstruct @Override//from w w w. ja va 2 s .c om public void initialization() { try { super.initialization(); loginHistories = loginHistoryService.getByParam(0, 4, Order.desc("loginDate")); barChartDistribusiByDept = new BarChartModel(); totalRequestHistory = approvalActivityService.getTotalRequestHistory(UserInfoUtil.getUserName()); totalPendingTask = approvalActivityService.getTotalPendingTask(UserInfoUtil.getUserName()); totalPendingRequest = approvalActivityService.getTotalPendingRequest(UserInfoUtil.getUserName()); Long empDataId = HrmUserInfoUtil.getEmpId(); List<LeaveImplementationDateModel> listLeaveImplementationDateModel = leaveImplementationDateService .getAllDataWithTotalTakenLeaveByEmpDataId(empDataId); totalLeaveType = listLeaveImplementationDateModel.size(); pieModel = new PieChartModel(); Map<String, Long> employeesByAge = empDataService.getTotalByAge(HrmUserInfoUtil.getCompanyId()); pieModel.set("< 26", employeesByAge.get("lessThan26")); pieModel.set("25-30", employeesByAge.get("between26And30")); pieModel.set("31-35", employeesByAge.get("between31And35")); pieModel.set("36-40", employeesByAge.get("between36And40")); pieModel.set("> 40", employeesByAge.get("moreThan40")); pieModel.setLegendPosition("e"); pieModel.setFill(true); pieModel.setShowDataLabels(true); pieModel.setSliceMargin(4); pieModel.setDiameter(150); pieModel.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc"); lastUpdateEmpDistByAge = new Date(employeesByAge.get("lastUpdate")); Map<String, Long> employeesByGender = empDataService.getTotalByGender(HrmUserInfoUtil.getCompanyId()); totalFemale = employeesByGender.get("male"); totalMale = employeesByGender.get("female"); lastUpdateEmpDistByGender = new Date(employeesByGender.get("lastUpdate")); LocalDate now = new LocalDate(); SimpleDateFormat formatter = new SimpleDateFormat("MMMM yyyy", LocaleContextHolder.getLocale()); int week = Calendar.getInstance().get(Calendar.WEEK_OF_MONTH); StringBuffer buff = new StringBuffer(); buff.append(week); if (LocaleContextHolder.getLocale().getLanguage().equals("en")) { buff.append(StringUtils.suffixesDayOfMonth[week]); } Object[] parameters = { buff.toString(), formatter.format(now.toDate()) }; ResourceBundle bundle = ResourceBundle.getBundle("Messages", LocaleContextHolder.getLocale()); presentationAttendancePerDayLabel = MessageFormat.format(bundle.getString("home.week_update_data"), parameters); List<Date> listTanggalWaktuKerja = new ArrayList<>(); IntStream.range(1, 6).forEach(num -> listTanggalWaktuKerja.add(now.minusDays(num).toDate())); List<ChartSeries> listPresentasiAttendance = empDataService .getEmployeePresentationAttendanceOnDashboard(HrmUserInfoUtil.getCompanyId(), listTanggalWaktuKerja, "dd"); presentationAttendancePerDayBarChartModel = new HorizontalBarChartModel(); listPresentasiAttendance.forEach(series -> presentationAttendancePerDayBarChartModel.addSeries(series)); presentationAttendancePerDayBarChartModel.setStacked(true); presentationAttendancePerDayBarChartModel.setShowDatatip(true); presentationAttendancePerDayBarChartModel.setShowPointLabels(true); presentationAttendancePerDayBarChartModel.setLegendPosition("se"); presentationAttendancePerDayBarChartModel .setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc,d500d5,ff2a55"); Axis xAxis = presentationAttendancePerDayBarChartModel.getAxis(AxisType.X); xAxis.setMax(100); xAxis.setTickInterval("20"); xAxis.setMin(0); Map<String, Long> employeesByDepartment = empDataService .getTotalByDepartment(HrmUserInfoUtil.getCompanyId()); int i = 0; for (Map.Entry<String, Long> entry : employeesByDepartment.entrySet()) { /** * only 8 department is allowed to show atau jika entry key nya * "lastUpdate" berarti itu akhir dari list */ if (i == 8 || StringUtils.equals(entry.getKey(), "lastUpdate")) { break; } i++; ChartSeries deptSeries = new ChartSeries(); deptSeries.setLabel(entry.getKey()); deptSeries.set("Department", entry.getValue()); barChartDistribusiByDept.addSeries(deptSeries); } barChartDistribusiByDept.setLegendPosition("ne"); barChartDistribusiByDept.setStacked(false); barChartDistribusiByDept.setShowDatatip(true); barChartDistribusiByDept.setShowPointLabels(true); barChartDistribusiByDept.setLegendCols(4); barChartDistribusiByDept.setLegendRows(2); barChartDistribusiByDept.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc,006666,660066"); lastUpdateEmpDistByDepartment = new Date(employeesByDepartment.get("lastUpdate")); barChartModel = new BarChartModel(); barChartModel.setStacked(false); barChartModel.setLegendPosition("ne"); barChartModel.setLegendCols(4); barChartModel.setLegendRows(2); barChartModel.setSeriesColors("66cc00,629de1,003366,990000,cccc00,6600cc"); barChartModel.setShowDatatip(true); barChartModel.setShadow(true); barChartModel.setShowPointLabels(true); Axis yAxis = barChartModel.getAxis(AxisType.Y); yAxis.setMax(150); yAxis.setMin(0); //Get Attendance Percentation per Department on Active Period Map<String, List<DepAttendanceRealizationViewModel>> mapResult = empDataService .getListDepAttendanceByCompanyId(HrmUserInfoUtil.getCompanyId()); //Looping and render it for (Map.Entry<String, List<DepAttendanceRealizationViewModel>> entry : mapResult.entrySet()) { ChartSeries charDepartmentSeries = new ChartSeries(); charDepartmentSeries.setLabel(entry.getKey()); List<DepAttendanceRealizationViewModel> listDepartmentModel = Lambda.sort(entry.getValue(), Lambda.on(DepAttendanceRealizationViewModel.class).getWeekNumber()); for (DepAttendanceRealizationViewModel depAttendanceModel : listDepartmentModel) { charDepartmentSeries.set(depAttendanceModel.getWeekNumber(), depAttendanceModel.getAttendancePercentage().doubleValue() * 100); } barChartModel.addSeries(charDepartmentSeries); } } catch (Exception ex) { LOGGER.error(ex, ex); } }
From source file:com.jjlharrison.jollyday.impl.JapaneseHolidayManager.java
License:Apache License
/** * {@inheritDoc}// w ww. j av a 2s. c o m * * Implements the rule which requests if two holidays have one non holiday * between each other than this day is also a holiday. */ @Override public Set<Holiday> getHolidays(int year, final String... args) { Set<Holiday> holidays = super.getHolidays(year, args); Set<Holiday> additionalHolidays = new HashSet<Holiday>(); for (Holiday d : holidays) { LocalDate twoDaysLater = d.getDate().plusDays(2); if (calendarUtil.contains(holidays, twoDaysLater)) { LocalDate bridgingDate = twoDaysLater.minusDays(1); additionalHolidays.add(new Holiday(bridgingDate, BRIDGING_HOLIDAY_PROPERTIES_KEY, LocalizedHolidayType.OFFICIAL_HOLIDAY)); } } holidays.addAll(additionalHolidays); return holidays; }
From source file:com.jjlharrison.jollyday.parser.impl.ChristianHolidayParser.java
License:Apache License
/** * {@inheritDoc}// ww w . j av a2 s. c om * * Parses all christian holidays relative to eastern. */ public void parse(int year, Set<Holiday> holidays, final Holidays config) { for (ChristianHoliday ch : config.getChristianHoliday()) { if (!isValid(ch, year)) { continue; } LocalDate easterSunday = getEasterSunday(year, ch.getChronology()); switch (ch.getType()) { case EASTER: break; case CLEAN_MONDAY: case SHROVE_MONDAY: easterSunday = easterSunday.minusDays(48); break; case MARDI_GRAS: case CARNIVAL: easterSunday = easterSunday.minusDays(47); break; case ASH_WEDNESDAY: easterSunday = easterSunday.minusDays(46); break; case MAUNDY_THURSDAY: easterSunday = easterSunday.minusDays(3); break; case GOOD_FRIDAY: easterSunday = easterSunday.minusDays(2); break; case EASTER_SATURDAY: easterSunday = easterSunday.minusDays(1); break; case EASTER_MONDAY: easterSunday = easterSunday.plusDays(1); break; case EASTER_TUESDAY: easterSunday = easterSunday.plusDays(2); break; case GENERAL_PRAYER_DAY: easterSunday = easterSunday.plusDays(26); break; case ASCENSION_DAY: easterSunday = easterSunday.plusDays(39); break; case PENTECOST: case WHIT_SUNDAY: easterSunday = easterSunday.plusDays(49); break; case WHIT_MONDAY: case PENTECOST_MONDAY: easterSunday = easterSunday.plusDays(50); break; case CORPUS_CHRISTI: easterSunday = easterSunday.plusDays(60); break; case SACRED_HEART: easterSunday = easterSunday.plusDays(68); break; default: throw new IllegalArgumentException("Unknown christian holiday type " + ch.getType()); } String propertiesKey = "christian." + ch.getType().name(); addChrstianHoliday(easterSunday, propertiesKey, ch.getLocalizedType(), holidays); } }