Example usage for org.joda.time Interval Interval

List of usage examples for org.joda.time Interval Interval

Introduction

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

Prototype

public Interval(Object interval, Chronology chronology) 

Source Link

Document

Constructs a time interval by converting or copying from another object, overriding the chronology.

Usage

From source file:net.sourceforge.fenixedu.dataTransferObject.teacherCredits.TeacherCreditsPeriodBean.java

License:Open Source License

private Interval getUnitCreditsInterval() {
    return new Interval(getUnitCreditsBeginDate(), getUnitCreditsEndDate());
}

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

License:Open Source License

public Interval getWeeklyWorkLoadInterval() {
    final DateTime beginningOfSemester = new DateTime(getBegginingOfLessonPeriod());
    final DateTime firstMonday = beginningOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateTime endOfSemester = new DateTime(getEndOfExamsPeriod());
    final DateTime nextLastMonday = endOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1).plusWeeks(1);
    return new Interval(firstMonday, nextLastMonday);
}

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

License:Open Source License

public Interval getCurrentWeek() {
    final DateMidnight beginningOfSemester = new DateMidnight(getBegginingOfLessonPeriod());
    final DateMidnight firstMonday = beginningOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final int currentWeek = calculateCurrentWeekOffset();
    final DateMidnight start = firstMonday.plusWeeks(currentWeek);
    return new Interval(start, start.plusWeeks(1));
}

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

License:Open Source License

public Interval getPreviousWeek() {
    final DateMidnight thisMonday = new DateMidnight().withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateMidnight previousMonday = thisMonday.minusWeeks(1);
    return new Interval(previousMonday, thisMonday);
}

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

License:Open Source License

public int calculateCurrentWeekOffset() {
    final DateMidnight beginningOfLessonPeriod = new DateMidnight(getBegginingOfLessonPeriod());
    final DateMidnight firstMonday = beginningOfLessonPeriod.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateMidnight thisMonday = new DateMidnight().withField(DateTimeFieldType.dayOfWeek(), 1);

    final Interval interval = new Interval(firstMonday, thisMonday);

    return interval.toPeriod(PeriodType.weeks()).getWeeks();
}

From source file:net.sourceforge.fenixedu.domain.credits.util.AnnualTeachingCreditsByPeriodBean.java

License:Open Source License

public List<PersonContractSituation> getServiceExemptions() {
    Interval executionYearInterval = new Interval(
            executionPeriod.getBeginDateYearMonthDay().toDateTimeAtMidnight(),
            executionPeriod.getEndDateYearMonthDay().plusDays(1).toDateTimeAtMidnight());
    return new ArrayList<PersonContractSituation>(
            teacher.getValidTeacherServiceExemptions(executionYearInterval));
}

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

License:Open Source License

public List<Teacher> getAllTeachers(YearMonthDay begin, YearMonthDay end) {
    Unit departmentUnit = getDepartmentUnit();
    List<Teacher> list = (departmentUnit != null) ? departmentUnit.getAllTeachers(begin, end)
            : new ArrayList<Teacher>(0);
    for (ExternalTeacherAuthorization teacherAuthorization : this.getTeacherAuthorizationsAuthorizedSet()) {
        if (teacherAuthorization.getActive()
                && teacherAuthorization.getExecutionSemester().getAcademicInterval()
                        .overlaps(new Interval(begin.toDateMidnight(), end.toDateMidnight()))
                && !list.contains(teacherAuthorization.getTeacher())) {
            list.add(teacherAuthorization.getTeacher());
        }//ww  w .j  ava  2  s .c  o  m
    }
    return list;
}

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

License:Open Source License

public Interval getInterval() {
    return new Interval(getStartDateDateTime(), getEndDateDateTime());
}

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

License:Open Source License

public Interval getInterval() {
    final ExecutionSemester executionSemester = getExecutionPeriod();
    final DateTime beginningOfSemester = new DateTime(executionSemester.getBeginDateYearMonthDay());
    final DateTime firstMonday = beginningOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateTime endOfSemester = new DateTime(executionSemester.getEndDateYearMonthDay());
    final DateTime nextLastMonday = endOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1).plusWeeks(1);
    return new Interval(firstMonday, nextLastMonday);
}

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

License:Open Source License

public Interval getCurrentWeek() {
    final DateMidnight thisMonday = getThisMonday();
    return thisMonday == null ? null : new Interval(thisMonday, thisMonday.plusWeeks(1));
}