Example usage for org.joda.time Partial get

List of usage examples for org.joda.time Partial get

Introduction

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

Prototype

public int get(DateTimeFieldType type) 

Source Link

Document

Get the value of one of the fields of a datetime.

Usage

From source file:net.sourceforge.fenixedu.dataTransferObject.manager.academicCalendarManagement.CalendarEntryBean.java

License:Open Source License

private static YearMonthDay getDateFromPartial(Partial partial) {
    return new YearMonthDay(partial.get(DateTimeFieldType.year()), partial.get(DateTimeFieldType.monthOfYear()),
            1);/*www.  j  a  va 2  s.c  om*/
}

From source file:net.sourceforge.fenixedu.dataTransferObject.phd.YearMonth.java

License:Open Source License

public YearMonth(Partial date) {
    super();// w  w w  .  j a v  a 2  s .c o m
    setYear(date.get(DateTimeFieldType.year()));
    setMonth(Month.values()[(date.get(DateTimeFieldType.monthOfYear()) - 1)]);
}

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

License:Open Source License

private void fillSummaryWithInfo(MultiLanguageString title, MultiLanguageString summaryText,
        Integer studentsNumber, Boolean isExtraLesson, Professorship professorship, String teacherName,
        Teacher teacher, Shift shift, Lesson lesson, YearMonthDay day, Space room, Partial hour, ShiftType type,
        Boolean taught) {//  ww w .  j av  a  2  s.c  o m

    setShift(shift);
    setSummaryDateYearMonthDay(day);
    setExecutionCourse(shift.getExecutionCourse());
    setTitle(title);
    setSummaryText(summaryText);
    setIsExtraLesson(isExtraLesson);

    checkSpecialParameters(isExtraLesson, professorship, teacherName, teacher, lesson, hour, type);
    checkIfInternalTeacherHasProfessorhipInExecutionCourse(teacher, shift.getExecutionCourse());
    checkIfSummaryDateIsValid(day, shift.getExecutionPeriod(), lesson, isExtraLesson);

    setStudentsNumber(studentsNumber);
    setProfessorship(professorship);
    setTeacherName(teacherName);
    setTeacher(teacher);
    setLastModifiedDateDateTime(new DateTime());
    setSummaryType(type);
    setTaught(taught);

    if (isExtraLesson) {
        super.setLessonInstance(null);
        setRoom(room);
        HourMinuteSecond hourMinuteSecond = new HourMinuteSecond(hour.get(DateTimeFieldType.hourOfDay()),
                hour.get(DateTimeFieldType.minuteOfHour()), 0);
        setSummaryHourHourMinuteSecond(hourMinuteSecond);
    } else {
        setRoom(lesson.getSala());
        setSummaryHourHourMinuteSecond(lesson.getBeginHourMinuteSecond());
        lessonInstanceManagement(lesson, day, lesson.getSala());
        if (getLessonInstance() == null) {
            throw new DomainException("error.Summary.empty.LessonInstances");
        }
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.pedagogicalCouncil.BeanInitializer.java

License:Open Source License

/**
 * Method for different parameters/*from  ww  w  .  j  a  v a  2s  . com*/
 * 
 * @param studentsByEntryYearBean
 * @param teacher
 * @param executionDegree
 * @param personStudent
 * @param endDate
 */
public static void initializeBean(StudentsByEntryYearBean studentsByEntryYearBean, Teacher teacher,
        ExecutionDegree executionDegree, Person personStudent, Partial endDate) {
    // TODO Auto-generated method stub
    String[] persons = { personStudent.getExternalId().toString() };
    studentsByEntryYearBean.receiveStudentsToCreateTutorshipList(persons, executionDegree);
    studentsByEntryYearBean.setTeacher(teacher);
    int month = endDate.get(DateTimeFieldType.monthOfYear());
    int year = endDate.get(DateTimeFieldType.year());
    studentsByEntryYearBean.setTutorshipEndMonth(Month.fromInt(month));
    studentsByEntryYearBean.setTutorshipEndYear(year);
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.coordinator.tutor.MonthYearsProviderTutorshipManagement.java

License:Open Source License

@Override
public Object provide(Object source, Object currentValue) {

    List<String> result = new ArrayList<String>();

    ChangeTutorshipBean tutorshipBean = (ChangeTutorshipBean) source;

    Partial startMonthYear = tutorshipBean.getTutorship().getStartDate();
    startMonthYear = startMonthYear.plus(Period.years(2));

    Partial endMonthYear = startMonthYear.plus(Period.years(Tutorship.TUTORSHIP_MAX_PERIOD));

    while (startMonthYear.compareTo(endMonthYear) < 0) {
        String line = tutorshipBean.generateMonthYearOption(startMonthYear.get(DateTimeFieldType.monthOfYear()),
                startMonthYear.get(DateTimeFieldType.year()));
        result.add(line);/* www.  ja  v  a2  s  .com*/

        startMonthYear = startMonthYear.plus(Period.months(1));
    }

    return result;
}

From source file:net.sourceforge.fenixedu.presentationTier.renderers.providers.spaceManager.MonthMondayDaysProvider.java

License:Open Source License

@Override
public Object provide(Object source, Object currentValue) {

    List<YearMonthDay> result = new ArrayList<YearMonthDay>();
    ViewEventSpaceOccupationsBean bean = (ViewEventSpaceOccupationsBean) source;
    Partial year = bean.getYear();//ww  w  .  ja  v a 2s  . com
    Partial month = bean.getMonth();

    if (month != null && year != null) {

        int monthNumber = month.get(DateTimeFieldType.monthOfYear());
        int yearNumber = year.get(DateTimeFieldType.year());

        YearMonthDay firstDayOfMonth = new YearMonthDay(yearNumber, monthNumber, 1);
        YearMonthDay monday = firstDayOfMonth.toDateTimeAtMidnight().withDayOfWeek(MONDAY_IN_JODA_TIME)
                .toYearMonthDay();

        if ((monday.getMonthOfYear() < monthNumber) || (monday.getYear() < yearNumber)) {
            monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK);
        }

        while (monday.getMonthOfYear() == monthNumber) {
            result.add(monday);
            monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK);
        }
    }

    return result;
}

From source file:org.fenixedu.academic.domain.Summary.java

License:Open Source License

private void fillSummaryWithInfo(LocalizedString title, LocalizedString summaryText, Integer studentsNumber,
        Boolean isExtraLesson, Professorship professorship, String teacherName, Teacher teacher, Shift shift,
        Lesson lesson, YearMonthDay day, Space room, Partial hour, ShiftType type, Boolean taught) {

    setShift(shift);//ww  w.j ava 2  s .  c om
    setSummaryDateYearMonthDay(day);
    setExecutionCourse(shift.getExecutionCourse());
    setTitle(title);
    setSummaryText(summaryText);
    setIsExtraLesson(isExtraLesson);

    checkSpecialParameters(isExtraLesson, professorship, teacherName, teacher, lesson, hour, type);
    checkIfInternalTeacherHasProfessorhipInExecutionCourse(teacher, shift.getExecutionCourse());
    checkIfSummaryDateIsValid(day, shift.getExecutionPeriod(), lesson, isExtraLesson);

    setStudentsNumber(studentsNumber);
    setProfessorship(professorship);
    setTeacherName(teacherName);
    setTeacher(teacher);
    setLastModifiedDateDateTime(new DateTime());
    setSummaryType(type);
    setTaught(taught);

    if (isExtraLesson) {
        super.setLessonInstance(null);
        setRoom(room);
        HourMinuteSecond hourMinuteSecond = new HourMinuteSecond(hour.get(DateTimeFieldType.hourOfDay()),
                hour.get(DateTimeFieldType.minuteOfHour()), 0);
        setSummaryHourHourMinuteSecond(hourMinuteSecond);
    } else {
        setRoom(lesson.getSala());
        setSummaryHourHourMinuteSecond(lesson.getBeginHourMinuteSecond());
        lessonInstanceManagement(lesson, day, lesson.getSala());
        if (getLessonInstance() == null) {
            throw new DomainException("error.Summary.empty.LessonInstances");
        }
    }
}