Example usage for org.joda.time LocalDate plusDays

List of usage examples for org.joda.time LocalDate plusDays

Introduction

In this page you can find the example usage for org.joda.time LocalDate plusDays.

Prototype

public LocalDate plusDays(int days) 

Source Link

Document

Returns a copy of this date plus the specified number of days.

Usage

From source file:org.killbill.billing.invoice.proRations.inAdvance.GenericProRationTestBase.java

License:Apache License

@Test(groups = "fast")
public void testSinglePlan_CrossingYearBoundary() throws InvalidDateSequenceException {
    final LocalDate startDate = invoiceUtil.buildDate(2011, 12, 15);
    final LocalDate oneCycleLater = startDate.plus(getBillingPeriod().getPeriod());

    // test just before the billing cycle day
    testCalculateNumberOfBillingCycles(startDate, oneCycleLater.plusDays(-1), 15, ONE);

    // test on the billing cycle day
    testCalculateNumberOfBillingCycles(startDate, oneCycleLater, 15, TWO);

    // test just after the billing cycle day
    testCalculateNumberOfBillingCycles(startDate, oneCycleLater.plusDays(1), 15, TWO);
}

From source file:org.killbill.billing.invoice.proRations.inAdvance.GenericProRationTestBase.java

License:Apache License

@Test(groups = "fast")
public void testSinglePlan_MovingForwardThroughTime() throws InvalidDateSequenceException {
    final LocalDate startDate = invoiceUtil.buildDate(2011, 1, 31);
    BigDecimal expectedValue = ONE;

    for (int i = 1; i <= 12; i++) {
        LocalDate oneCycleLater = startDate;
        for (int j = 0; j < i; j++) {
            oneCycleLater = oneCycleLater.plus(getBillingPeriod().getPeriod());
        }/*www. jav  a 2  s  .  c o m*/
        // test just before the billing cycle day
        testCalculateNumberOfBillingCycles(startDate, oneCycleLater.plusDays(-1), 31, expectedValue);

        expectedValue = expectedValue.add(ONE);

        // test on the billing cycle day
        testCalculateNumberOfBillingCycles(startDate, oneCycleLater, 31, expectedValue);

        // test just after the billing cycle day
        testCalculateNumberOfBillingCycles(startDate, oneCycleLater.plusDays(1), 31, expectedValue);
    }
}

From source file:org.killbill.billing.plugin.analytics.reports.ReportsUserApi.java

License:Apache License

private void normalizeAndSortXValues(final Map<String, Map<String, List<XY>>> dataForReports,
        @Nullable final LocalDate startDate, @Nullable final LocalDate endDate) {
    LocalDate minDate = null;//from w  w w  .  jav  a  2s  .c o m
    if (startDate != null) {
        minDate = startDate;
    }

    LocalDate maxDate = null;
    if (endDate != null) {
        maxDate = endDate;
    }

    // If no min and/or max was specified, infer them from the data
    if (minDate == null || maxDate == null) {
        for (final Map<String, List<XY>> dataForReport : dataForReports.values()) {
            for (final List<XY> dataForPivot : dataForReport.values()) {
                for (final XY xy : dataForPivot) {
                    if (minDate == null || xy.getxDate().isBefore(minDate)) {
                        minDate = xy.getxDate();
                    }
                    if (maxDate == null || xy.getxDate().isAfter(maxDate)) {
                        maxDate = xy.getxDate();
                    }
                }
            }
        }
    }

    if (minDate == null || maxDate == null) {
        throw new IllegalStateException(String.format(
                "minDate and maxDate shouldn't be null! minDate=%s, maxDate=%s, dataForReports=%s", minDate,
                maxDate, dataForReports));
    }

    // Add 0 for missing days
    LocalDate curDate = minDate;
    while (!curDate.isAfter(maxDate)) {
        for (final Map<String, List<XY>> dataForReport : dataForReports.values()) {
            for (final List<XY> dataForPivot : dataForReport.values()) {
                addMissingValueForDateIfNeeded(curDate, dataForPivot);
            }
        }
        curDate = curDate.plusDays(1);
    }

    // Sort the data for the dashboard
    for (final String reportName : dataForReports.keySet()) {
        for (final String pivotName : dataForReports.get(reportName).keySet()) {
            Collections.sort(dataForReports.get(reportName).get(pivotName), new Comparator<XY>() {
                @Override
                public int compare(final XY o1, final XY o2) {
                    return o1.getxDate().compareTo(o2.getxDate());
                }
            });
        }
    }
}

From source file:org.kitodo.production.forms.CalendarForm.java

License:Open Source License

/**
 * The method copyBlockClick() creates and adds a copy of the currently
 * showing block./*from   www  .  j a v  a 2  s . c  o m*/
 */
public void copyBlockClick() {
    Block copy = blockShowing.clone(course);
    LocalDate lastAppearance = course.getLastAppearance();
    if (Objects.nonNull(lastAppearance)) {
        LocalDate firstAppearance = lastAppearance.plusDays(1);
        copy.setFirstAppearance(firstAppearance);
        copy.setLastAppearance(firstAppearance);
        course.add(copy);
        blockShowing = copy;
        navigate();
    }
}

From source file:org.kuali.kpme.core.util.TKUtils.java

License:Educational Community License

public static long getDaysBetween(LocalDate startDate, LocalDate endDate) {
    long daysBetween = 0;

    LocalDate currentDate = startDate;
    while (currentDate.isBefore(endDate)) {
        daysBetween++;//from  www .j  a v  a  2 s .c  om
        currentDate = currentDate.plusDays(1);
    }

    return daysBetween;
}

From source file:org.kuali.kpme.tklm.common.CalendarValidationUtil.java

License:Educational Community License

/**
 * Validate the earn code exists on every day within the date rage. This method is moving to CalendarValidationUtil
 * @param earnCode/*from  w ww. j a va  2 s  .c  o  m*/
 * @param startDateString
 * @param endDateString
 *
 * @return A list of error strings.
 */
public static List<String> validateEarnCode(String earnCode, String startDateString, String endDateString) {
    List<String> errors = new ArrayList<String>();

    LocalDate tempDate = TKUtils.formatDateTimeStringNoTimezone(startDateString).toLocalDate();
    LocalDate localEnd = TKUtils.formatDateTimeStringNoTimezone(endDateString).toLocalDate();
    // tempDate and localEnd could be the same day
    while (!localEnd.isBefore(tempDate)) {
        if (!ValidationUtils.validateEarnCode(earnCode, tempDate)) {
            errors.add("Earn Code " + earnCode + " is not available for " + tempDate);
            break;
        }
        tempDate = tempDate.plusDays(1);
    }

    return errors;
}

From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualCategoryMaxBalanceServiceImpl.java

License:Educational Community License

@Override
public Map<String, Set<LeaveBlock>> getMaxBalanceViolations(CalendarEntry entry, String principalId) {

    Map<String, Set<LeaveBlock>> maxBalanceViolations = new HashMap<String, Set<LeaveBlock>>();

    Map<String, Set<LeaveBlock>> eligibilities = new HashMap<String, Set<LeaveBlock>>();

    eligibilities.put(HrConstants.MAX_BAL_ACTION_FREQ.LEAVE_APPROVE, new HashSet<LeaveBlock>());
    eligibilities.put(HrConstants.MAX_BAL_ACTION_FREQ.YEAR_END, new HashSet<LeaveBlock>());
    eligibilities.put(HrConstants.MAX_BAL_ACTION_FREQ.ON_DEMAND, new HashSet<LeaveBlock>());

    Interval thisEntryInterval = new Interval(entry.getBeginPeriodDate().getTime(),
            entry.getEndPeriodDate().getTime());

    LocalDate asOfDate = LocalDate.now();

    if (!thisEntryInterval.contains(asOfDate.toDate().getTime()))
        asOfDate = entry.getEndPeriodFullDateTime().minusDays(1).toLocalDate();

    PrincipalHRAttributes pha = HrServiceLocator.getPrincipalHRAttributeService()
            .getPrincipalCalendar(principalId, asOfDate);

    if (pha == null)
        return eligibilities;

    Calendar cal = pha.getLeaveCalObj();

    if (cal == null)
        return eligibilities;

    List<CalendarEntry> leaveCalEntries = HrServiceLocator.getCalendarEntryService()
            .getCalendarEntriesEndingBetweenBeginAndEndDate(cal.getHrCalendarId(),
                    entry.getBeginPeriodFullDateTime(), entry.getEndPeriodFullDateTime());
    CalendarEntry yearEndLeaveEntry = null;
    CalendarEntry leaveLeaveEntry = null;
    if (!leaveCalEntries.isEmpty()) {
        for (CalendarEntry leaveEntry : leaveCalEntries) {
            if (StringUtils.equals(cal.getCalendarName(), leaveEntry.getCalendarName())) {
                if (leaveEntry.getEndPeriodDate().compareTo(entry.getBeginPeriodDate()) > 0)
                    leaveLeaveEntry = leaveEntry;
            }/* w ww.  ja  va2s .  c om*/
        }
    }

    Interval leavePeriodInterval = null;
    Interval yearEndPeriodInterval = null;
    if (leaveLeaveEntry != null) {
        leavePeriodInterval = new Interval(entry.getBeginPeriodDate().getTime(),
                leaveLeaveEntry.getEndPeriodDate().getTime());
        if (HrServiceLocator.getLeavePlanService().isLastCalendarPeriodOfLeavePlan(leaveLeaveEntry,
                pha.getLeavePlan(), asOfDate))
            yearEndPeriodInterval = leavePeriodInterval;
    }

    List<AccrualCategory> accrualCategories = HrServiceLocator.getAccrualCategoryService()
            .getActiveAccrualCategoriesForLeavePlan(pha.getLeavePlan(), asOfDate);

    if (!accrualCategories.isEmpty()) {

        List<LeaveBlock> leaveBlocks = new ArrayList<LeaveBlock>();
        Map<String, BigDecimal> accruedBalance = new HashMap<String, BigDecimal>();

        for (AccrualCategory accrualCategory : accrualCategories) {
            leaveBlocks.addAll(LmServiceLocator.getLeaveBlockService().getLeaveBlocksWithAccrualCategory(
                    principalId, pha.getServiceLocalDate(), asOfDate.plusDays(1),
                    accrualCategory.getAccrualCategory()));
            accruedBalance.put(accrualCategory.getLmAccrualCategoryId(), BigDecimal.ZERO);
            /*   Un-comment to consider service interval end-point changes. i.e. when defining a new action frequency - "ON_SERVICE_MILESTONE"
                        List<AccrualCategoryRule> accrualRules = HrServiceLocator.getAccrualCategoryRuleService().getActiveAccrualCategoryRules(accrualCategory.getLmAccrualCategoryId());
                        for(AccrualCategoryRule rule : accrualRules) {
                           String serviceUnits = rule.getServiceUnitOfTime();
                           LocalDate rollOverDate = null;
                           //TODO: Accrual Category Rules' start and end field allow only whole integer values. This should be reflected in storage.
                           if(StringUtils.equals(serviceUnits, "M")) {
                              rollOverDate = pha.getServiceLocalDate().plusMonths(rule.getEnd().intValue());
                           }
                           else if(StringUtils.equals(serviceUnits, "Y")) {
                              rollOverDate = pha.getServiceLocalDate().plusYears(rule.getEnd().intValue());
                           }
                           if(ObjectUtils.isNotNull(rollOverDate)) {
                              if(thisEntryInterval.contains(rollOverDate.minusDays(1).toDate().getTime())) {
             //Add a max balance allocation leave block.
             LeaveBlock allocation = new LeaveBlock();
             allocation.setAccrualCategory(accrualCategory.getAccrualCategory());
             allocation.setLeaveLocalDate(rollOverDate.minusDays(1));
             allocation.setLeaveAmount(BigDecimal.ZERO);
             allocation.setPrincipalId(principalId);
             leaveBlocks.add(allocation);
                              }
                           }
                        }
            */

            //Add a max balance allocation leave block.
            LeaveBlock allocation = new LeaveBlock();
            allocation.setAccrualCategory(accrualCategory.getAccrualCategory());

            if (thisEntryInterval.contains(LocalDate.now().toDate().getTime()))
                allocation.setLeaveLocalDate(LocalDate.now());
            else
                allocation.setLeaveLocalDate(entry.getEndPeriodFullDateTime().toLocalDate().minusDays(1));

            allocation.setLeaveAmount(BigDecimal.ZERO);
            allocation.setPrincipalId(principalId);
            allocation.setLeaveBlockType("allocation");
            leaveBlocks.add(allocation);

            if (ObjectUtils.isNotNull(leaveLeaveEntry)) {
                //if entry belongs to a time calendar, check the balances at the end date for the calendar year that ends
                //within entry's interval.
                //if entry belongs to a leave calendar, this empty block will simply duplicate and override
                //the block created above.
                allocation = new LeaveBlock();
                allocation.setAccrualCategory(accrualCategory.getAccrualCategory());
                allocation.setLeaveLocalDate(
                        leaveLeaveEntry.getEndPeriodFullDateTime().toLocalDate().minusDays(1));
                allocation.setLeaveAmount(BigDecimal.ZERO);
                allocation.setPrincipalId(principalId);
                allocation.setLeaveBlockType("allocation");
                leaveBlocks.add(allocation);
            }

            if (!leaveBlocks.isEmpty()) {
                Collections.sort(leaveBlocks, new Comparator() {

                    @Override
                    public int compare(Object o1, Object o2) {
                        LeaveBlock l1 = (LeaveBlock) o1;
                        LeaveBlock l2 = (LeaveBlock) o2;
                        return l1.getLeaveDate().compareTo(l2.getLeaveDate());
                    }

                });
            }
        }

        for (LeaveBlock lb : leaveBlocks) {
            if (StringUtils.equals(lb.getRequestStatus(), HrConstants.REQUEST_STATUS.DISAPPROVED)
                    || StringUtils.equals(lb.getRequestStatus(), HrConstants.REQUEST_STATUS.DEFERRED))
                continue;
            AccrualCategory accrualCategory = HrServiceLocator.getAccrualCategoryService()
                    .getAccrualCategory(lb.getAccrualCategory(), lb.getLeaveLocalDate());
            BigDecimal tally = accruedBalance.get(accrualCategory.getLmAccrualCategoryId());
            tally = tally.add(lb.getLeaveAmount());

            AccrualCategoryRule asOfLeaveDateRule = HrServiceLocator.getAccrualCategoryRuleService()
                    .getAccrualCategoryRuleForDate(accrualCategory, lb.getLeaveLocalDate(),
                            pha.getServiceLocalDate());

            //Employee overrides...
            if (ObjectUtils.isNotNull(asOfLeaveDateRule)) {
                if (StringUtils.equals(asOfLeaveDateRule.getMaxBalFlag(), "Y")) {
                    if (StringUtils.isNotBlank(asOfLeaveDateRule.getActionAtMaxBalance())) {
                        if (ObjectUtils.isNotNull(asOfLeaveDateRule.getMaxBalanceActionFrequency())) {

                            if (maxBalanceViolations.get(asOfLeaveDateRule.getLmAccrualCategoryId()) == null)
                                maxBalanceViolations.put(asOfLeaveDateRule.getLmAccrualCategoryId(),
                                        new HashSet<LeaveBlock>());

                            BigDecimal maxBalance = asOfLeaveDateRule.getMaxBalance();

                            BigDecimal fte = HrServiceLocator.getJobService()
                                    .getFteSumForAllActiveLeaveEligibleJobs(principalId, LocalDate.now());
                            BigDecimal adjustedMaxBalance = maxBalance.multiply(fte);

                            BigDecimal maxAnnualCarryOver = null;
                            if (ObjectUtils.isNotNull(asOfLeaveDateRule.getMaxCarryOver()))
                                maxAnnualCarryOver = new BigDecimal(asOfLeaveDateRule.getMaxCarryOver());

                            BigDecimal adjustedMaxAnnualCarryOver = null;
                            if (ObjectUtils.isNotNull(maxAnnualCarryOver)) {
                                adjustedMaxAnnualCarryOver = maxAnnualCarryOver.multiply(fte);
                            }

                            List<EmployeeOverride> overrides = LmServiceLocator.getEmployeeOverrideService()
                                    .getEmployeeOverrides(principalId, lb.getLeaveLocalDate());
                            for (EmployeeOverride override : overrides) {
                                if (StringUtils.equals(override.getAccrualCategory(),
                                        lb.getAccrualCategory())) {
                                    //Do not pro-rate override values for FTE.
                                    if (StringUtils.equals(override.getOverrideType(), "MB"))
                                        adjustedMaxBalance = new BigDecimal(override.getOverrideValue());
                                    if (StringUtils.equals(override.getOverrideType(), "MAC"))
                                        adjustedMaxAnnualCarryOver = new BigDecimal(
                                                override.getOverrideValue());
                                }
                            }

                            boolean yearEndCandidate = false;
                            if (StringUtils.equals(asOfLeaveDateRule.getMaxBalanceActionFrequency(),
                                    HrConstants.MAX_BAL_ACTION_FREQ.YEAR_END)
                                    && adjustedMaxAnnualCarryOver != null) {
                                yearEndCandidate = true;
                            }
                            //callers must determine if the violation exists on the calendar prior to the leave plan's calendar year end date.
                            if (tally.compareTo(adjustedMaxBalance) > 0
                                    || (yearEndCandidate && tally.compareTo(adjustedMaxAnnualCarryOver) > 0)) {
                                if (maxBalanceViolations.get(asOfLeaveDateRule.getLmAccrualCategoryId())
                                        .isEmpty()) {
                                    maxBalanceViolations.get(asOfLeaveDateRule.getLmAccrualCategoryId())
                                            .add(lb);
                                } else {
                                    Set<LeaveBlock> eligibleLeaveBlocks = maxBalanceViolations
                                            .get(asOfLeaveDateRule.getLmAccrualCategoryId());
                                    CalendarBlockContract previousInfraction = retreivePreviousInfraction(
                                            eligibleLeaveBlocks, lb, leavePeriodInterval, yearEndPeriodInterval,
                                            thisEntryInterval, asOfLeaveDateRule);

                                    if (previousInfraction != null)
                                        eligibleLeaveBlocks.remove(previousInfraction);
                                    /* Replace the leave block with the most recent infraction that occurred so long as the infraction takes place
                                     * before the end of the [underlying] leave period. This includes accrual categories that undergo a rule change
                                     * as the result of the employee crossing a service milestone.
                                     * Doing so will correctly trigger the action on timesheets that stagger a leave
                                     * period end date, since the block would exist on a leave period whose end date is not contained within
                                     * the time period. For on-demand frequencies, we want to replace the block with the latest no matter what.
                                     * Doing so will ensure that the latest rule is used to initiate the action.
                                     * 
                                     */
                                    eligibleLeaveBlocks.add(lb);
                                    maxBalanceViolations.put(asOfLeaveDateRule.getLmAccrualCategoryId(),
                                            eligibleLeaveBlocks);
                                }
                            } else // the leave amount (usage), as of lb's leave date, is under the balance limit.
                            if (!maxBalanceViolations.get(asOfLeaveDateRule.getLmAccrualCategoryId())
                                    .isEmpty()) {
                                //if there was a previous infraction, it must be removed so long as the leave date of lb lies within
                                //the same period as the previous infraction.
                                Set<LeaveBlock> eligibleLeaveBlocks = maxBalanceViolations
                                        .get(asOfLeaveDateRule.getLmAccrualCategoryId());
                                CalendarBlockContract previousInfraction = retreivePreviousInfraction(
                                        eligibleLeaveBlocks, lb, leavePeriodInterval, yearEndPeriodInterval,
                                        thisEntryInterval, asOfLeaveDateRule);
                                if (previousInfraction != null) {
                                    eligibleLeaveBlocks.remove(previousInfraction);
                                    maxBalanceViolations.put(asOfLeaveDateRule.getLmAccrualCategoryId(),
                                            eligibleLeaveBlocks);
                                }
                            }
                        }
                    }
                }
            }
            accruedBalance.put(accrualCategory.getLmAccrualCategoryId(), tally);
        }
    }

    for (Entry<String, Set<LeaveBlock>> entries : maxBalanceViolations.entrySet()) {
        for (LeaveBlock lb : entries.getValue()) {
            AccrualCategoryRule aRule = HrServiceLocator.getAccrualCategoryRuleService()
                    .getAccrualCategoryRule(lb.getAccrualCategoryRuleId());
            eligibilities.get(aRule.getMaxBalanceActionFrequency()).add(lb);
        }
    }

    return eligibilities;
}

From source file:org.kuali.kpme.tklm.time.timesummary.service.TimeSummaryServiceImpl.java

License:Educational Community License

private List<LeaveSummaryRow> getMaxedLeaveRows(CalendarEntry calendarEntry, String principalId)
        throws Exception {
    List<LeaveSummaryRow> maxedLeaveRows = new ArrayList<LeaveSummaryRow>();

    if (LmServiceLocator.getLeaveApprovalService().isActiveAssignmentFoundOnJobFlsaStatus(principalId,
            HrConstants.FLSA_STATUS_NON_EXEMPT, true)) {

        Map<String, Set<LeaveBlock>> eligibilities = LmServiceLocator.getAccrualCategoryMaxBalanceService()
                .getMaxBalanceViolations(calendarEntry, principalId);
        Set<LeaveBlock> onDemandTransfers = eligibilities.get(HrConstants.MAX_BAL_ACTION_FREQ.ON_DEMAND);

        Interval calendarEntryInterval = new Interval(calendarEntry.getBeginPeriodDate().getTime(),
                calendarEntry.getEndPeriodDate().getTime());

        //use the current date if on the current calendar? yes -> no warning given until accrual is reached. If accrual occurs on last day of period or last day of service interval
        //change, no warning given to the employee of balance limits being exceeded except on or after that day.

        if (!onDemandTransfers.isEmpty()) {
            for (LeaveBlock lb : onDemandTransfers) {
                LocalDate leaveDate = lb.getLeaveLocalDate();
                LeaveSummary summary = LmServiceLocator.getLeaveSummaryService()
                        .getLeaveSummaryAsOfDate(principalId, leaveDate.plusDays(1));
                LeaveSummaryRow row = summary.getLeaveSummaryRowForAccrualCtgy(lb.getAccrualCategory());
                if (row != null) {
                    //AccrualCategory accrualCategory = HrServiceLocator.getAccrualCategoryService().getAccrualCategory(row.getAccrualCategoryId());
                    //AccrualCategoryRule currentRule = HrServiceLocator.getAccrualCategoryRuleService().getAccrualCategoryRuleForDate(accrualCategory, asOfDate, pha.getServiceDate());
                    if (calendarEntryInterval.contains(leaveDate.toDate().getTime())) {
                        //do not allow the on-demand max balance action if the rule the action occurs under is no longer in effect,
                        //or if the infraction did not occur within this interval. ( if it occurred during the previous interval, 
                        //the employee will have the option to take action in that interval up to & including the end date of that interval. )
                        row.setInfractingLeaveBlockId(lb.getAccrualCategoryRuleId());
                        AccrualCategoryRule aRule = HrServiceLocator.getAccrualCategoryRuleService()
                                .getAccrualCategoryRule(lb.getAccrualCategoryRuleId());

                        if (StringUtils.equals(aRule.getActionAtMaxBalance(),
                                HrConstants.ACTION_AT_MAX_BALANCE.TRANSFER))
                            row.setTransferable(true);
                        else if (StringUtils.equals(aRule.getActionAtMaxBalance(),
                                HrConstants.ACTION_AT_MAX_BALANCE.PAYOUT))
                            row.setPayoutable(true);

                        boolean exists = false;
                        for (LeaveSummaryRow maxedRow : maxedLeaveRows) {
                            if (StringUtils.equals(maxedRow.getAccrualCategoryId(), row.getAccrualCategoryId()))
                                exists = true;
                        }/*w w  w .  j av a  2  s.c o m*/
                        if (!exists)
                            maxedLeaveRows.add(row);
                    }
                }
            }
        }
    }
    return maxedLeaveRows;
}

From source file:org.libreplan.business.calendars.entities.CalendarAvailability.java

License:Open Source License

public boolean isActiveBetween(LocalDate filterStartDate, LocalDate filterEndDate) {
    if (filterStartDate == null && filterEndDate == null) {
        return true;
    }/*from w  w  w.  ja v  a2  s .c o  m*/

    if (filterStartDate == null) {
        if (endDate == null) {
            return startDate.compareTo(filterEndDate) <= 0;
        }

        return startDate.compareTo(filterEndDate) <= 0 || endDate.compareTo(filterEndDate) <= 0;
    }

    if (filterEndDate == null) {
        return endDate == null || startDate.compareTo(filterStartDate) >= 0
                || endDate.compareTo(filterStartDate) >= 0;
    }

    if (endDate == null) {
        return startDate.compareTo(filterStartDate) <= 0 || startDate.compareTo(filterEndDate) <= 0;
    }

    Interval filterPeriod = new Interval(filterStartDate.toDateTimeAtStartOfDay(),
            filterEndDate.plusDays(1).toDateTimeAtStartOfDay());

    Interval activationPeriod = new Interval(startDate.toDateTimeAtStartOfDay(),
            endDate.plusDays(1).toDateTimeAtStartOfDay());

    return filterPeriod.overlaps(activationPeriod);
}

From source file:org.libreplan.business.planner.chart.ContiguousDaysLine.java

License:Open Source License

public void transformInSitu(IValueTransformer<T, T> transformer) {
    LocalDate current = startInclusive;
    ListIterator<T> listIterator = values.listIterator();
    while (listIterator.hasNext()) {
        T previousValue = listIterator.next();
        listIterator.set(transformer.transform(current, previousValue));
        current = current.plusDays(1);
    }/*from   w w w .  j a  v  a  2  s  . c  o  m*/
}