org.joda.time.Partial Java Examples

The following examples show how to use org.joda.time.Partial. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestISODateTimeFormat_Fields.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testForFields_calBased_YMD_duplicates() {
    DateTimeFieldType[] fields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
    };
    DateTimeFieldType[] dupFields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
            DateTimeFieldType.monthOfYear(),
    };
    int[] values = new int[] {2005, 6, 25};
    List types = new ArrayList(Arrays.asList(dupFields));
    DateTimeFormatter f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(0, types.size());
    
    types = Arrays.asList(dupFields);
    f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(4, types.size());
}
 
Example #2
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ActionForward prepareCreateAcademicCalendar(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();
    Partial begin;
    Partial end;
    if (currentExecutionYear != null) {
        begin = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getBeginDateYearMonthDay());
        end = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getEndDateYearMonthDay());
    } else {
        begin = CalendarEntryBean.getPartialFromYearMonthDay(new YearMonthDay());
        end = CalendarEntryBean.getPartialFromYearMonthDay(new YearMonthDay().plusMonths(3));
    }

    CalendarEntryBean bean = CalendarEntryBean.createAcademicCalendarBean(begin, end);
    request.setAttribute("parentEntryBean", bean);

    return mapping.findForward("prepareCreateCalendarEntry");
}
 
Example #3
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ActionForward prepareViewAcademicCalendar(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    AcademicCalendarEntry academicCalendar = getAcademicCalendarEntryFromParameter(request);
    ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();

    Partial begin;
    Partial end;
    if (currentExecutionYear != null) {
        begin = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getBeginDateYearMonthDay());
        end = CalendarEntryBean.getPartialFromYearMonthDay(currentExecutionYear.getEndDateYearMonthDay());
    } else {
        begin = CalendarEntryBean.getPartialFromYearMonthDay(new YearMonthDay().minusMonths(12));
        end = CalendarEntryBean.getPartialFromYearMonthDay(new YearMonthDay().plusMonths(12));
    }

    CalendarEntryBean bean =
            CalendarEntryBean.createCalendarEntryBeanToCreateEntry((AcademicCalendarRootEntry) academicCalendar,
                    academicCalendar, begin, end);

    return generateGanttDiagram(mapping, request, bean);
}
 
Example #4
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: SummariesManagementBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public SummariesManagementBean(LocalizedString title, LocalizedString summaryText, Integer studentsNumber,
        SummaryType summaryType, Professorship professorship, String teacherName, Teacher teacher, Shift shift,
        Lesson lesson, YearMonthDay summaryDate, Space summaryRoom, Partial summaryTime, Summary summary,
        Professorship professorshipLogged, ShiftType lessonType, Boolean taught, Boolean onlineLesson) {

    setTitle(title);
    setSummaryText(summaryText);
    setSummaryType(summaryType);
    setShift(shift);
    setLesson(lesson);
    setProfessorship(professorship);
    setTeacher(teacher);
    setTeacherName(teacherName);
    setSummary(summary);
    setSummaryDate(summaryDate);
    setSummaryRoom(summaryRoom);
    setSummaryTime(summaryTime);
    setStudentsNumber(studentsNumber);
    setExecutionCourse(shift.getExecutionCourse());
    setProfessorshipLogged(professorshipLogged);
    setLessonType(lessonType);
    setTaught(taught);
    setOnlineLesson(onlineLesson);
}
 
Example #6
Source File: ExportPhdIndividualProgramProcessesInHtml.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void drawQualification(final Page page, final Qualification qualification) throws IOException {
    page.tableStart("tstyle2 thwhite thnowrap thlight thleft thtop ulnomargin ");
    if (qualification != null) {
        final QualificationType type = qualification.getType();
        page.rowStart().header("Type:").column(type == null ? "-" : type.getLocalizedName()).rowEnd();
        final String degree = qualification.getDegree();
        page.rowStart().header("Scientific Field:").column(degree == null ? "-" : degree).rowEnd();
        final String school = qualification.getSchool();
        page.rowStart().header("Institution:").column(school == null ? "-" : school).rowEnd();
        final String mark = qualification.getMark();
        page.rowStart().header("Grade:").column(mark == null ? "-" : mark).rowEnd();
        final Partial attendedBegin = qualification.getAttendedBegin();
        page.rowStart().header("Attended from:").column(attendedBegin == null ? "-" : attendedBegin.toString("MM/yyyy"))
                .rowEnd();
        final Partial attendedEnd = qualification.getAttendedEnd();
        page.rowStart().header("Attended to:").column(attendedEnd == null ? "-" : attendedEnd.toString("MM/yyyy")).rowEnd();
    }
    page.tableEnd();
}
 
Example #7
Source File: CalendarEntryBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static CalendarEntryBean createCalendarEntryBeanToEditEntry(AcademicCalendarRootEntry rootEntry,
        AcademicCalendarEntry entry, Partial begin, Partial end) {

    CalendarEntryBean bean = new CalendarEntryBean();

    bean.setRootEntry(rootEntry);
    bean.setEntry(entry);
    bean.setBeginDateToDisplay(begin);
    bean.setEndDateToDisplay(end);

    bean.setTemplateEntry(entry.getTemplateEntry());
    bean.setType(entry.getClass());
    bean.setTitle(entry.getTitle());
    bean.setDescription(entry.getDescription());
    bean.setBegin(entry.getBegin());
    bean.setEnd(entry.getEnd());

    return bean;
}
 
Example #8
Source File: YearsPartialProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {

    List<Partial> result = new ArrayList<Partial>();
    ExecutionYear firstExecutionYear = ExecutionYear.readFirstExecutionYear();

    if (firstExecutionYear != null) {
        ExecutionYear currentExecutionYear = ExecutionYear.readCurrentExecutionYear();
        int firstYear = firstExecutionYear.getBeginDateYearMonthDay().getYear();
        int lastYear = currentExecutionYear.getEndDateYearMonthDay().getYear();
        while (firstYear <= lastYear) {
            result.add(new Partial(DateTimeFieldType.year(), firstYear));
            firstYear++;
        }
    }

    return result;
}
 
Example #9
Source File: TestISODateTimeFormat_Fields.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testForFields_calBased_YMD_unmodifiable() {
    DateTimeFieldType[] fields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
    };
    int[] values = new int[] {2005, 6, 25};
    List types = Collections.unmodifiableList(new ArrayList(Arrays.asList(fields)));
    DateTimeFormatter f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(3, types.size());
    
    types = Arrays.asList(fields);
    f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(3, types.size());
}
 
Example #10
Source File: Summary.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void checkSpecialParameters(Boolean isExtraLesson, Professorship professorship, String teacherName, Teacher teacher,
        Lesson lesson, Partial hour, ShiftType type) {

    if (professorship == null && StringUtils.isEmpty(teacherName) && teacher == null) {
        throw new DomainException("error.summary.no.teacher");
    }
    if (isExtraLesson) {
        if (hour == null) {
            throw new DomainException("error.summary.no.hour");
        }
    } else {
        if (lesson == null) {
            throw new DomainException("error.summary.no.lesson");
        }
        if (type == null) {
            throw new DomainException("error.summary.no.shifType");
        }
    }
}
 
Example #11
Source File: ViewEventSpaceOccupationsBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ViewEventSpaceOccupationsBean(YearMonthDay day, Space allocatableSpace) {

        setAllocatableSpace(allocatableSpace);

        if (day != null) {
            setYear(new Partial(DateTimeFieldType.year(), day.getYear()));
            setMonth(new Partial(DateTimeFieldType.monthOfYear(), day.getMonthOfYear()));

            YearMonthDay monday = day.toDateTimeAtMidnight().withDayOfWeek(MONDAY_IN_JODA_TIME).toYearMonthDay();
            if ((monday.getMonthOfYear() < day.getMonthOfYear()) || (monday.getYear() < day.getYear())) {
                monday = monday.plusDays(Lesson.NUMBER_OF_DAYS_IN_WEEK);
            }

            setDay(monday);
        }
    }
 
Example #12
Source File: TestISODateTimeFormat_Fields.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testForFields_calBased_YMD_duplicates() {
    DateTimeFieldType[] fields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
    };
    DateTimeFieldType[] dupFields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
            DateTimeFieldType.monthOfYear(),
    };
    int[] values = new int[] {2005, 6, 25};
    List types = new ArrayList(Arrays.asList(dupFields));
    DateTimeFormatter f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(0, types.size());
    
    types = Arrays.asList(dupFields);
    f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(4, types.size());
}
 
Example #13
Source File: TestISODateTimeFormat_Fields.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public void testForFields_calBased_YMD_unmodifiable() {
    DateTimeFieldType[] fields = new DateTimeFieldType[] {
            DateTimeFieldType.year(),
            DateTimeFieldType.monthOfYear(),
            DateTimeFieldType.dayOfMonth(),
    };
    int[] values = new int[] {2005, 6, 25};
    List types = Collections.unmodifiableList(new ArrayList(Arrays.asList(fields)));
    DateTimeFormatter f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(3, types.size());
    
    types = Arrays.asList(fields);
    f = ISODateTimeFormat.forFields(types, true, true);
    assertEquals("2005-06-25", f.print(new Partial(fields, values)));
    assertEquals(3, types.size());
}
 
Example #14
Source File: MonthsPartialProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    List<Partial> result = new ArrayList<Partial>();
    for (int i = 1; i <= 12; i++) {
        result.add(new Partial(DateTimeFieldType.monthOfYear(), i));
    }
    return result;
}
 
Example #15
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward viewAcademicCalendarEntry(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    AcademicCalendarEntry entry = getAcademicCalendarEntryFromParameter(request);
    AcademicCalendarRootEntry rootEntry = getAcademicCalendarRootEntryFromParameter(request);

    Partial beginPartial = getBeginFromParameter(request);
    Partial endPartial = getEndFromParameter(request);

    CalendarEntryBean bean =
            CalendarEntryBean.createCalendarEntryBeanToCreateEntry(rootEntry, entry, beginPartial, endPartial);

    return generateGanttDiagram(mapping, request, bean);
}
 
Example #16
Source File: MonthMondayDaysProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {

    List<YearMonthDay> result = new ArrayList<YearMonthDay>();
    ViewEventSpaceOccupationsBean bean = (ViewEventSpaceOccupationsBean) source;
    Partial year = bean.getYear();
    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;
}
 
Example #17
Source File: SummariesManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward prepareEditSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {

    Professorship teacherLogged = ((Professorship) request.getAttribute("loggedTeacherProfessorship"));
    DynaActionForm dynaActionForm = (DynaActionForm) form;
    Summary summary = getSummaryFromParameter(request);

    SummaryType summaryType;
    if (summary.isExtraSummary()) {
        summaryType = SummaryType.EXTRA_SUMMARY;
        request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
    } else {
        summaryType = SummaryType.NORMAL_SUMMARY;
    }

    DateTimeFieldType[] dateTimeFieldTypes = { DateTimeFieldType.hourOfDay(), DateTimeFieldType.minuteOfHour() };
    HourMinuteSecond time = summary.getSummaryHourHourMinuteSecond();
    int[] timeArray = { time.getHour(), time.getMinuteOfHour() };
    Partial timePartial = new Partial(dateTimeFieldTypes, timeArray);

    SummariesManagementBean bean =
            new SummariesManagementBean(summary.getTitle(), summary.getSummaryText(), summary.getStudentsNumber(),
                    summaryType, summary.getProfessorship(), summary.getTeacherName(), summary.getTeacher(),
                    summary.getShift(), summary.getLesson(), summary.getSummaryDateYearMonthDay(), summary.getRoom(),
                    timePartial, summary, teacherLogged, summary.getSummaryType(), summary.getTaught(), summary.getOnlineLesson());

    return goToSummaryManagementPageAgain(mapping, request, dynaActionForm, bean);
}
 
Example #18
Source File: ManageHolidaysDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Holiday execute() {
    Partial date = new Partial();
    if (getYear() != null) {
        date = date.with(DateTimeFieldType.year(), getYear());
    }
    if (getMonthOfYear() != null) {
        date = date.with(DateTimeFieldType.monthOfYear(), getMonthOfYear());
    }
    if (getDayOfMonth() != null) {
        date = date.with(DateTimeFieldType.dayOfMonth(), getDayOfMonth());
    }
    return new Holiday(date, getLocality());
}
 
Example #19
Source File: TestISODateTimeFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testFormat_time_partial() {
    Partial dt = new Partial(
            new DateTimeFieldType[] {DateTimeFieldType.hourOfDay(), DateTimeFieldType.minuteOfHour(),
                    DateTimeFieldType.secondOfMinute(), DateTimeFieldType.millisOfSecond()},
            new int[] {10, 20, 30, 40});
    assertEquals("10:20:30.040", ISODateTimeFormat.time().print(dt));
}
 
Example #20
Source File: CalendarEntryBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static CalendarEntryBean createCalendarEntryBeanToCreateEntry(AcademicCalendarRootEntry rootEntry,
        AcademicCalendarEntry parentEntry, Partial begin, Partial end) {

    CalendarEntryBean bean = new CalendarEntryBean();
    bean.setRootEntry(rootEntry);
    bean.setEntry(parentEntry);
    bean.setBeginDateToDisplay(begin);
    bean.setEndDateToDisplay(end);
    return bean;
}
 
Example #21
Source File: ReadablePartialRelay.java    From jfixture with MIT License 5 votes vote down vote up
@Override
public Object create(Object request, SpecimenContext context) {
    if (!request.equals(ReadablePartial.class))
        return new NoSpecimen();

    return context.resolve(Partial.class);
}
 
Example #22
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward prepareCreateEntry(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    AcademicCalendarEntry parentEntry = getAcademicCalendarEntryFromParameter(request);
    AcademicCalendarRootEntry rootEntry = getAcademicCalendarRootEntryFromParameter(request);

    Partial beginPartial = getBeginFromParameter(request);
    Partial endPartial = getEndFromParameter(request);

    request.setAttribute("parentEntryBean",
            CalendarEntryBean.createCalendarEntryBeanToCreateEntry(rootEntry, parentEntry, beginPartial, endPartial));

    return mapping.findForward("prepareCreateCalendarEntry");
}
 
Example #23
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward prepareEditEntry(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    AcademicCalendarEntry entry = getAcademicCalendarEntryFromParameter(request);
    AcademicCalendarRootEntry rootEntry = getAcademicCalendarRootEntryFromParameter(request);

    Partial beginPartial = getBeginFromParameter(request);
    Partial endPartial = getEndFromParameter(request);

    request.setAttribute("entryBean",
            CalendarEntryBean.createCalendarEntryBeanToEditEntry(rootEntry, entry, beginPartial, endPartial));

    return mapping.findForward("prepareCreateCalendarEntry");
}
 
Example #24
Source File: AcademicCalendarsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward deleteEntry(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    AcademicCalendarEntry entry = getAcademicCalendarEntryFromParameter(request);
    AcademicCalendarRootEntry rootEntry = getAcademicCalendarRootEntryFromParameter(request);

    AcademicCalendarRootEntry entryRootEntry = entry.getRootEntry();
    AcademicCalendarEntry entryParentEntry = entry.getParentEntry();

    boolean deletedRootEntry = entry.isRoot();

    Partial beginPartial = getBeginFromParameter(request);
    Partial endPartial = getEndFromParameter(request);

    try {
        DeleteAcademicCalendarEntry.run(entry, rootEntry);

    } catch (DomainException domainException) {
        addActionMessage(request, domainException.getMessage());
        return generateGanttDiagram(mapping, request,
                CalendarEntryBean.createCalendarEntryBeanToCreateEntry(rootEntry, entry, beginPartial, endPartial));
    }

    if (deletedRootEntry) {
        return prepareChooseCalendar(mapping, actionForm, request, response);

    } else if (entryParentEntry != null) {
        return generateGanttDiagram(mapping, request,
                CalendarEntryBean.createCalendarEntryBeanToCreateEntry(rootEntry, entryParentEntry, beginPartial, endPartial));

    } else {
        return generateGanttDiagram(mapping, request,
                CalendarEntryBean.createCalendarEntryBeanToCreateEntry(rootEntry, entryRootEntry, beginPartial, endPartial));
    }
}
 
Example #25
Source File: Summary.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Summary(LocalizedString title, LocalizedString summaryText, Integer studentsNumber, Boolean isExtraLesson,
        Professorship professorship, String teacherName, Teacher teacher, Shift shift, Lesson lesson, YearMonthDay date,
        Space room, Partial hour, ShiftType type, Boolean taught, Boolean onlineLesson) {

    super();
    setRootDomainObject(Bennu.getInstance());
    fillSummaryWithInfo(title, summaryText, studentsNumber, isExtraLesson, professorship, teacherName, teacher, shift,
            lesson, date, room, hour, type, taught, onlineLesson);

    ContentManagementLog.createLog(shift.getExecutionCourse(), Bundle.MESSAGING, "log.executionCourse.content.summary.added",
            title.getContent(), shift.getPresentationName(), shift.getExecutionCourse().getNome(), shift.getExecutionCourse()
                    .getDegreePresentationString());
}
 
Example #26
Source File: Summary.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void edit(LocalizedString title, LocalizedString summaryText, Integer studentsNumber, Boolean isExtraLesson,
        Professorship professorship, String teacherName, Teacher teacher, Shift shift, Lesson lesson, YearMonthDay date,
        Space room, Partial hour, ShiftType type, Boolean taught, Boolean onlineLesson) {

    fillSummaryWithInfo(title, summaryText, studentsNumber, isExtraLesson, professorship, teacherName, teacher, shift,
            lesson, date, room, hour, type, taught, onlineLesson);

    ContentManagementLog.createLog(shift.getExecutionCourse(), Bundle.MESSAGING,
            "log.executionCourse.content.summary.edited", title.getContent(), shift.getPresentationName(), shift
                    .getExecutionCourse().getNome(), shift.getExecutionCourse().getDegreePresentationString());

    Signal.emit(EDIT_SIGNAL, new DomainObjectEvent<Summary>(this));
}
 
Example #27
Source File: Summary.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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, Boolean onlineLesson) {

    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);
    setOnlineLesson(onlineLesson);

    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");
        }
    }
}
 
Example #28
Source File: PhdGratuityPaymentPeriod.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public PhdGratuityPaymentPeriod(int dayStart, int monthStart, int dayEnd, int monthEnd, int dayLastPayment,
        int monthLastPayment) {
    super();
    init(new Partial().with(DateTimeFieldType.monthOfYear(), monthStart).with(DateTimeFieldType.dayOfYear(), dayStart),
            new Partial().with(DateTimeFieldType.monthOfYear(), monthEnd).with(DateTimeFieldType.dayOfYear(), dayEnd),
            new Partial().with(DateTimeFieldType.monthOfYear(), monthLastPayment).with(DateTimeFieldType.dayOfYear(),
                    dayLastPayment));
}
 
Example #29
Source File: Qualification.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void edit(Person person, Country country, String branch, YearMonthDay dateYearMonthDay, String degree,
        String degreeRecognition, YearMonthDay equivalenceDateYearMonthDay, String equivalenceSchool, String mark,
        String school, String specializationArea, String title, QualificationType type, String year, String designation,
        Partial attendedBegin, Partial attendedEnd) {
    Person personLogin = AccessControl.getPerson();
    if (personLogin != null) {
        setModifiedBy(personLogin);
    }
    setBranch(branch);
    setDateYearMonthDay(dateYearMonthDay);
    setDegree(degree);
    setDegreeRecognition(degreeRecognition);
    setEquivalenceDateYearMonthDay(equivalenceDateYearMonthDay);
    setEquivalenceSchool(equivalenceSchool);
    setLastModificationDateDateTime(new DateTime());
    setMark(mark);
    setSchool(school);
    setSpecializationArea(specializationArea);
    setTitle(title);
    setType(type);
    setYear(year);
    setDesignation(designation);
    setAttendedBegin(attendedBegin);
    setAttendedEnd(attendedEnd);
    setPerson(person);
    setCountry(country);

}
 
Example #30
Source File: ExecutionYear.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ExecutionYear findByPartial(final Partial partial) {
    final Integer year = Integer.valueOf(partial.get(DateTimeFieldType.year()));
    final Set<ExecutionYear> executionYears = updateIfNeeded(year);
    if (executionYears != null) {
        for (final ExecutionYear executionYear : executionYears) {
            if (executionYear.getBeginDateYearMonthDay().getYear() == year) {
                return executionYear;
            }
        }
    }
    return null;
}