Example usage for org.joda.time DateTime toYearMonthDay

List of usage examples for org.joda.time DateTime toYearMonthDay

Introduction

In this page you can find the example usage for org.joda.time DateTime toYearMonthDay.

Prototype

@Deprecated
public YearMonthDay toYearMonthDay() 

Source Link

Document

Converts this object to a YearMonthDay using the same millis and chronology.

Usage

From source file:net.sourceforge.fenixedu.domain.accessControl.UnitGroup.java

License:Open Source License

private void collect(Set<User> users, Unit unit, DateTime when) {
    Collection<? extends Accountability> accs;
    if (relationType != null) {
        accs = unit.getChildAccountabilities(relationType);
    } else {//from  w  w  w .j a v  a 2  s  . com
        accs = unit.getChildsSet();
    }
    for (Accountability accountability : accs) {
        if (accountability.isActive(when.toYearMonthDay())) {
            if (relationFunctionType != null) {
                if (accountability.getAccountabilityType() instanceof Function) {
                    Function function = (Function) accountability.getAccountabilityType();
                    if (!function.getFunctionType().equals(relationFunctionType)) {
                        continue;
                    }
                } else {
                    continue;
                }
            }
            Party party = accountability.getChildParty();
            if (party instanceof Person) {
                User user = ((Person) party).getUser();
                if (user != null) {
                    users.add(user);
                }
            }
        }
    }
    if (includeSubUnits) {
        for (Unit subUnit : unit.getSubUnits()) {
            collect(users, subUnit, when);
        }
    }
}

From source file:net.sourceforge.fenixedu.domain.accessControl.UnitGroup.java

License:Open Source License

@Override
public boolean isMember(User user, DateTime when) {
    if (user == null) {
        return false;
    }// www  . j a v  a  2  s  .c  o m
    for (Accountability accountability : user.getPerson().getParentAccountabilities(relationType)) {
        if (accountability.isActive(when.toYearMonthDay())) {
            if (includeSubUnits && isAncestor(unit, accountability.getParentParty(), relationType, when)) {
                return true;
            } else if (accountability.getParentParty().equals(unit)) {
                return true;
            }
        }
    }
    return false;
}

From source file:net.sourceforge.fenixedu.domain.accounting.postingRules.AdministrativeOfficeFeePR.java

License:Open Source License

@Override
protected boolean hasPenalty(Event event, DateTime when) {
    if (event.hasAnyPenaltyExemptionsFor(AdministrativeOfficeFeeAndInsurancePenaltyExemption.class)) {
        return false;
    }//from   w  ww.  jav  a  2s  .  c  om

    final AdministrativeOfficeFeeAndInsuranceEvent administrativeOfficeFeeAndInsuranceEvent = (AdministrativeOfficeFeeAndInsuranceEvent) event;

    final YearMonthDay paymentEndDate = administrativeOfficeFeeAndInsuranceEvent.getPaymentEndDate() != null
            ? administrativeOfficeFeeAndInsuranceEvent.getPaymentEndDate()
            : getWhenToApplyFixedAmountPenalty();

    final Money amountPayedUntilEndDate = calculateAmountPayedUntilEndDate(
            administrativeOfficeFeeAndInsuranceEvent, paymentEndDate);

    if (!when.toYearMonthDay().isAfter(paymentEndDate)) {
        return false;
    }

    return amountPayedUntilEndDate.lessThan(getFixedAmount());

}

From source file:net.sourceforge.fenixedu.domain.accounting.postingRules.FixedAmountWithPenaltyFromDatePR.java

License:Open Source License

@Override
protected boolean hasPenalty(Event event, DateTime when) {
    return when.toYearMonthDay().isAfter(getWhenToApplyFixedAmountPenalty());
}

From source file:net.sourceforge.fenixedu.domain.ExecutionSemester.java

License:Open Source License

public boolean containsDay(final DateTime dateTime) {
    return containsDay(dateTime.toYearMonthDay());
}

From source file:net.sourceforge.fenixedu.domain.ExecutionSemester.java

License:Open Source License

public static ExecutionSemester readByDateTime(final DateTime dateTime) {
    final YearMonthDay yearMonthDay = dateTime.toYearMonthDay();
    return readByYearMonthDay(yearMonthDay);
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setStartOfProposalPeriodDateTime(final DateTime dateTime) {
    setStartOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setStartOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setEndOfProposalPeriodDateTime(final DateTime dateTime) {
    setEndOfProposalPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setEndOfProposalPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setStartOfCandidacyPeriodDateTime(final DateTime dateTime) {
    setStartOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setStartOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}

From source file:net.sourceforge.fenixedu.domain.finalDegreeWork.Scheduleing.java

License:Open Source License

public void setEndOfCandidacyPeriodDateTime(final DateTime dateTime) {
    setEndOfCandidacyPeriodDateYearMonthDay(dateTime.toYearMonthDay());
    setEndOfCandidacyPeriodTimeHourMinuteSecond(new HourMinuteSecond(dateTime.getHourOfDay(),
            dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()));
}