org.joda.time.YearMonthDay#isAfter ( )源码实例Demo

下面列出了org.joda.time.YearMonthDay#isAfter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: fenixedu-academic   文件: ExecutionSemester.java
private void checkDatesIntersection(YearMonthDay begin, YearMonthDay end) {
    List<InfoExecutionPeriod> infoExecutionPeriods = ReadExecutionPeriods.run();
    if (infoExecutionPeriods != null && !infoExecutionPeriods.isEmpty()) {

        Collections.sort(infoExecutionPeriods, InfoExecutionPeriod.COMPARATOR_BY_YEAR_AND_SEMESTER);

        for (InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) {
            ExecutionSemester executionSemester = infoExecutionPeriod.getExecutionPeriod();
            YearMonthDay beginDate = executionSemester.getBeginDateYearMonthDay();
            YearMonthDay endDate = executionSemester.getEndDateYearMonthDay();
            if (begin.isAfter(endDate) || end.isBefore(beginDate) || executionSemester.equals(this)) {
                continue;
            } else {
                throw new DomainException("error.ExecutionPeriod.intersection.dates");
            }
        }
    }
}
 
public ActionForward viewAcademicCalendar(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    CalendarEntryBean bean = getRenderedObject("datesToDisplayID");

    YearMonthDay beginDate = bean.getBeginDateToDisplayInYearMonthDayFormat();
    YearMonthDay endDate = bean.getEndDateToDisplayInYearMonthDayFormat();

    if (beginDate.isAfter(endDate)) {
        addActionMessage(request, "error.begin.after.end");
        ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();
        Partial begin = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getBeginDateYearMonthDay());
        Partial end = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getEndDateYearMonthDay());
        bean = CalendarEntryBean.createCalendarEntryBeanToCreateEntry(bean.getRootEntry(), bean.getRootEntry(), begin, end);
        RenderUtils.invalidateViewState("datesToDisplayID");
        return generateGanttDiagram(mapping, request, bean);
    }

    return generateGanttDiagram(mapping, request, bean);
}
 
源代码3 项目: fenixedu-academic   文件: Thesis.java
@Override
public void setEnrolment(Enrolment enrolment) {
    final ExecutionDegree executionDegree = getExecutionDegree(enrolment);
    final YearMonthDay beginThesisCreationPeriod = executionDegree.getBeginThesisCreationPeriod();
    final YearMonthDay endThesisCreationPeriod = executionDegree.getEndThesisCreationPeriod();

    final YearMonthDay today = new YearMonthDay();
    if (beginThesisCreationPeriod == null || beginThesisCreationPeriod.isAfter(today)) {
        throw new DomainException("thesis.creation.not.allowed.because.out.of.period");
    }
    if (endThesisCreationPeriod != null && endThesisCreationPeriod.isBefore(today)) {
        throw new DomainException("thesis.creation.not.allowed.because.out.of.period");
    }

    CurricularCourse curricularCourse = enrolment.getCurricularCourse();
    if (!curricularCourse.isDissertation()) {
        throw new DomainException("thesis.enrolment.notDissertationEnrolment");
    }

    super.setEnrolment(enrolment);
}
 
源代码4 项目: fenixedu-academic   文件: CurriculumGroup.java
@Override
public YearMonthDay calculateConclusionDate() {
    final Collection<CurriculumModule> curriculumModules = new HashSet<CurriculumModule>(getCurriculumModulesSet());
    YearMonthDay result = null;
    for (final CurriculumModule curriculumModule : curriculumModules) {
        if (curriculumModule.isConcluded(getApprovedCurriculumLinesLastExecutionYear()).isValid()
                && curriculumModule.hasAnyApprovedCurriculumLines()) {
            final YearMonthDay curriculumModuleConclusionDate = curriculumModule.calculateConclusionDate();
            if (curriculumModuleConclusionDate != null && (result == null || curriculumModuleConclusionDate.isAfter(result))) {
                result = curriculumModuleConclusionDate;
            }
        }
    }

    return result;
}
 
源代码5 项目: fenixedu-academic   文件: Lesson.java
public boolean isTimeValidToInsertSummary(HourMinuteSecond timeToInsert, YearMonthDay summaryDate) {

        YearMonthDay currentDate = new YearMonthDay();
        if (timeToInsert == null || summaryDate == null || summaryDate.isAfter(currentDate)) {
            return false;
        }

        if (currentDate.isEqual(summaryDate)) {
            HourMinuteSecond lessonEndTime = null;
            LessonInstance lessonInstance = getLessonInstanceFor(summaryDate);
            lessonEndTime = lessonInstance != null ? lessonInstance.getEndTime() : getEndHourMinuteSecond();
            return !lessonEndTime.isAfter(timeToInsert);
        }

        return true;
    }
 
@Override
public List<Interval> getEventSpaceOccupationIntervals(YearMonthDay startDateToSearch, YearMonthDay endDateToSearch) {

    List<Interval> result = new ArrayList<Interval>();
    Collection<WrittenEvaluation> writtenEvaluations = getWrittenEvaluationsSet();

    for (WrittenEvaluation writtenEvaluation : writtenEvaluations) {
        YearMonthDay writtenEvaluationDay = writtenEvaluation.getDayDateYearMonthDay();
        if (startDateToSearch == null
                || (!writtenEvaluationDay.isBefore(startDateToSearch) && !writtenEvaluationDay.isAfter(endDateToSearch))) {

            result.add(createNewInterval(writtenEvaluationDay, writtenEvaluationDay,
                    writtenEvaluation.getBeginningDateHourMinuteSecond(), writtenEvaluation.getEndDateHourMinuteSecond()));
        }
    }
    return result;
}
 
private static void getLessonInstanceOccupations(List<InfoObject> infoShowOccupations, YearMonthDay weekStartYearMonthDay,
        YearMonthDay weekEndYearMonthDay, Collection<LessonInstance> lessonInstances) {

    if (lessonInstances != null) {
        for (LessonInstance lessonInstance : lessonInstances) {
            final YearMonthDay lessonInstanceDay = lessonInstance.getDay();
            if (!lessonInstanceDay.isBefore(weekStartYearMonthDay) && !lessonInstanceDay.isAfter(weekEndYearMonthDay)) {
                InfoLessonInstance infoLessonInstance = new InfoLessonInstance(lessonInstance);
                infoShowOccupations.add(infoLessonInstance);
            }
        }
    }
}
 
private static void checkEnteredConclusionDate(final RegistrationConclusionBean conclusionBean) {
    final YearMonthDay startDate = conclusionBean.getRegistration().getStartDate();

    if (startDate.isAfter(conclusionBean.getEnteredConclusionDate())) {
        throw new DomainException("error.RegistrationConclusionProcess.start.date.is.after.entered.date");
    }

}
 
源代码9 项目: fenixedu-academic   文件: OccupationPeriod.java
@Deprecated
public OccupationPeriod(YearMonthDay startDate, YearMonthDay endDate) {
    this();
    if (startDate == null || endDate == null || startDate.isAfter(endDate)) {
        throw new DomainException("error.occupationPeriod.invalid.dates");
    }
    this.setPeriodInterval(IntervalTools.getInterval(startDate, endDate));
}
 
源代码10 项目: fenixedu-academic   文件: Registration.java
final public StudentCurricularPlan getStudentCurricularPlan(final YearMonthDay date) {
    StudentCurricularPlan result = null;
    for (final StudentCurricularPlan studentCurricularPlan : getStudentCurricularPlansSet()) {
        final YearMonthDay startDate = studentCurricularPlan.getStartDateYearMonthDay();
        if (!startDate.isAfter(date) && (result == null || startDate.isAfter(result.getStartDateYearMonthDay()))) {
            result = studentCurricularPlan;
        }
    }
    return result;
}
 
源代码11 项目: fenixedu-academic   文件: Lesson.java
public Lesson(DiaSemana diaSemana, Calendar inicio, Calendar fim, Shift shift, FrequencyType frequency,
        ExecutionSemester executionSemester, YearMonthDay beginDate, YearMonthDay endDate, Space room) {

    super();

    OccupationPeriod period = null;
    if (shift != null) {
        final ExecutionCourse executionCourse = shift.getExecutionCourse();
        GenericPair<YearMonthDay, YearMonthDay> maxLessonsPeriod = executionCourse.getMaxLessonsPeriod();
        if (beginDate == null || beginDate.isBefore(maxLessonsPeriod.getLeft())) {
            throw new DomainException("error.Lesson.invalid.begin.date");
        }
        if (endDate == null || endDate.isAfter(maxLessonsPeriod.getRight())) {
            throw new DomainException("error.invalid.new.date");
        }
        period = OccupationPeriod.createOccupationPeriodForLesson(executionCourse, beginDate, endDate);
    }

    setRootDomainObject(Bennu.getInstance());
    setDiaSemana(diaSemana);
    setInicio(inicio);
    setFim(fim);
    setShift(shift);
    setFrequency(frequency);
    setPeriod(period);

    checkShiftLoad(shift);

    if (room != null) {
        new LessonSpaceOccupation(room, this);
    }
}
 
源代码12 项目: fenixedu-academic   文件: Lesson.java
public void refreshPeriodAndInstancesInSummaryCreation(YearMonthDay newBeginDate) {
    if (!wasFinished() && newBeginDate != null && newBeginDate.isAfter(getPeriod().getStartYearMonthDay())) {
        SortedSet<YearMonthDay> instanceDates =
                getAllLessonInstancesDatesToCreate(getLessonStartDay(), newBeginDate.minusDays(1), true);
        YearMonthDay newEndDate = getPeriod().getLastOccupationPeriodOfNestedPeriods().getEndYearMonthDay();
        if (!newBeginDate.isAfter(newEndDate)) {
            refreshPeriod(newBeginDate, getPeriod().getLastOccupationPeriodOfNestedPeriods().getEndYearMonthDay());
        } else {
            OccupationPeriod period = getPeriod();
            removeLessonSpaceOccupationAndPeriod();
            period.delete();
        }
        createAllLessonInstances(instanceDates);
    }
}
 
源代码13 项目: fenixedu-academic   文件: Lesson.java
private YearMonthDay getValidEndDate(YearMonthDay endDate) {
    YearMonthDay lessonEnd =
            endDate.toDateTimeAtMidnight().withDayOfWeek(getDiaSemana().getDiaSemanaInDayOfWeekJodaFormat()).toYearMonthDay();
    if (lessonEnd.isAfter(endDate)) {
        lessonEnd = lessonEnd.minusDays(NUMBER_OF_DAYS_IN_WEEK);
    }
    return lessonEnd;
}
 
源代码14 项目: fenixedu-academic   文件: Lesson.java
public SortedSet<YearMonthDay> getAllLessonDatesUntil(YearMonthDay day) {
    SortedSet<YearMonthDay> result = new TreeSet<YearMonthDay>();
    if (day != null) {
        result.addAll(getAllLessonInstanceDatesUntil(day));
        if (!wasFinished()) {
            YearMonthDay startDateToSearch = getLessonStartDay();
            YearMonthDay lessonEndDay = getLessonEndDay();
            YearMonthDay endDateToSearch = (lessonEndDay.isAfter(day)) ? day : lessonEndDay;
            result.addAll(getAllValidLessonDatesWithoutInstancesDates(startDateToSearch, endDateToSearch));
        }
    }
    return result;
}
 
源代码15 项目: fenixedu-academic   文件: Lesson.java
public SortedSet<YearMonthDay> getAllLessonInstanceDatesUntil(YearMonthDay day) {
    SortedSet<YearMonthDay> result = new TreeSet<YearMonthDay>();
    if (day != null) {
        for (LessonInstance instance : getLessonInstancesSet()) {
            YearMonthDay instanceDay = instance.getDay();
            if (!instanceDay.isAfter(day)) {
                result.add(instanceDay);
            }
        }
    }
    return result;
}
 
源代码16 项目: fenixedu-academic   文件: Lesson.java
private SortedSet<YearMonthDay> getAllValidLessonDatesWithoutInstancesDates(YearMonthDay startDateToSearch,
        YearMonthDay endDateToSearch) {

    SortedSet<YearMonthDay> result = new TreeSet<YearMonthDay>();
    startDateToSearch = startDateToSearch != null ? getValidBeginDate(startDateToSearch) : null;

    if (!wasFinished() && startDateToSearch != null && endDateToSearch != null && !startDateToSearch.isAfter(endDateToSearch)) {
        Space lessonCampus = getLessonCampus();
        final int dayIncrement =
                getFrequency() == FrequencyType.BIWEEKLY ? FrequencyType.WEEKLY.getNumberOfDays() : getFrequency()
                        .getNumberOfDays();
        boolean shouldAdd = true;
        while (true) {
            if (isDayValid(startDateToSearch, lessonCampus)) {
                if (getFrequency() != FrequencyType.BIWEEKLY || shouldAdd) {
                    if (!isHoliday(startDateToSearch, lessonCampus)) {
                        result.add(startDateToSearch);
                    }
                }
                shouldAdd = !shouldAdd;
            }
            startDateToSearch = startDateToSearch.plusDays(dayIncrement);
            if (startDateToSearch.isAfter(endDateToSearch)) {
                break;
            }
        }
    }
    return result;
}
 
源代码17 项目: fenixedu-academic   文件: EventSpaceOccupation.java
public static List<Interval> generateEventSpaceOccupationIntervals(YearMonthDay begin, final YearMonthDay end,
        final HourMinuteSecond beginTime, final HourMinuteSecond endTime, final FrequencyType frequency,
        final DiaSemana diaSemana, final Boolean dailyFrequencyMarkSaturday, final Boolean dailyFrequencyMarkSunday,
        final YearMonthDay startDateToSearch, final YearMonthDay endDateToSearch) {

    List<Interval> result = new ArrayList<Interval>();
    begin = getBeginDateInSpecificWeekDay(diaSemana, begin);

    if (frequency == null) {
        if (!begin.isAfter(end)
                && (startDateToSearch == null || (!end.isBefore(startDateToSearch) && !begin.isAfter(endDateToSearch)))) {
            result.add(createNewInterval(begin, end, beginTime, endTime));
            return result;
        }
    } else {
        int numberOfDaysToSum = frequency.getNumberOfDays();
        while (true) {
            if (begin.isAfter(end)) {
                break;
            }
            if (startDateToSearch == null || (!begin.isBefore(startDateToSearch) && !begin.isAfter(endDateToSearch))) {

                Interval interval = createNewInterval(begin, begin, beginTime, endTime);

                if (!frequency.equals(FrequencyType.DAILY)
                        || ((dailyFrequencyMarkSaturday || interval.getStart().getDayOfWeek() != SATURDAY_IN_JODA_TIME) && (dailyFrequencyMarkSunday || interval
                                .getStart().getDayOfWeek() != SUNDAY_IN_JODA_TIME))) {

                    result.add(interval);
                }
            }
            begin = begin.plusDays(numberOfDaysToSum);
        }
    }
    return result;
}
 
源代码18 项目: fenixedu-academic   文件: GratuityTransaction.java
public boolean isInsidePeriod(final YearMonthDay start, final YearMonthDay end) {
    final YearMonthDay date = getTransactionDateDateTime().toYearMonthDay();
    return !date.isBefore(start) && !date.isAfter(end);
}
 
源代码19 项目: fenixedu-academic   文件: Lesson.java
private void refreshPeriod(YearMonthDay newBeginDate, YearMonthDay newEndDate) {

        if (newBeginDate != null && newEndDate != null && !newBeginDate.isAfter(newEndDate)) {

            boolean newPeriod = false;
            OccupationPeriod currentPeriod = getPeriod();
            OccupationPeriod oldFirstPeriod = currentPeriod;

            if (currentPeriod == null || currentPeriod.getNextPeriod() == null) {
                setPeriod(new OccupationPeriod(newBeginDate, newEndDate));
                newPeriod = true;

            } else {

                while (currentPeriod != null) {

                    if (currentPeriod.getStartYearMonthDay().isAfter(newEndDate)) {
                        newPeriod = false;
                        break;
                    }

                    if (!currentPeriod.getEndYearMonthDay().isBefore(newBeginDate)) {

                        if (!currentPeriod.getStartYearMonthDay().isAfter(newBeginDate)) {
                            setPeriod(getNewNestedPeriods(currentPeriod, newBeginDate, newEndDate));

                        } else {
                            if (currentPeriod.equals(oldFirstPeriod)) {
                                setPeriod(getNewNestedPeriods(currentPeriod, newBeginDate, newEndDate));
                            } else {
                                setPeriod(getNewNestedPeriods(currentPeriod, currentPeriod.getStartYearMonthDay(), newEndDate));
                            }
                        }

                        newPeriod = true;
                        break;
                    }
                    currentPeriod = currentPeriod.getNextPeriod();
                }
            }

            if (!newPeriod) {
                removeLessonSpaceOccupationAndPeriod();
            }

            if (oldFirstPeriod != null) {
                oldFirstPeriod.delete();
            }
        }
    }
 
源代码20 项目: fenixedu-academic   文件: Unit.java
@jvstm.cps.ConsistencyPredicate
protected boolean checkDateInterval() {
    final YearMonthDay start = getBeginDateYearMonthDay();
    final YearMonthDay end = getEndDateYearMonthDay();
    return start != null && (end == null || !start.isAfter(end));
}