Package org.libreplan.business.calendars.entities

Examples of org.libreplan.business.calendars.entities.CalendarException


                CalendarExceptionTypeColor.DEFAULT, true);
        return result;
    }

    public static void addChristmasAsExceptionDay(BaseCalendar calendar) {
        CalendarException christmasDay = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE, EffortDuration.zero(),
                createCalendarExceptionType());

        calendar.addExceptionDay(christmasDay);
    }
View Full Code Here


    @Test
    public void testCapacityOnDerivedBasicCalendarWithException() {
        BaseCalendar calendar = createBasicCalendar().newDerivedCalendar();

        CalendarException day = CalendarException.create(WEDNESDAY_LOCAL_DATE,
                hours(4), createCalendarExceptionType());
        calendar.addExceptionDay(day);

        EffortDuration mondayHours = calendar
                .getCapacityOn(wholeDay(MONDAY_LOCAL_DATE));
View Full Code Here

    @Test
    public void testCapacityOnDerivedChristmasCalendarRedefiningExceptionDay() {
        BaseCalendar calendar = createChristmasCalendar().newDerivedCalendar();

        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE, hours(4),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        EffortDuration hours = calendar
View Full Code Here

    @Test(expected = IllegalArgumentException.class)
    public void testAddTwoExceptionDaysInTheSameDate() {
        BaseCalendar calendar = createBasicCalendar();

        CalendarException day = CalendarException.create(MONDAY_LOCAL_DATE,
                hours(8), createCalendarExceptionType());
        calendar.addExceptionDay(day);

        CalendarException day2 = CalendarException.create(MONDAY_LOCAL_DATE,
                hours(4), createCalendarExceptionType());
        calendar.addExceptionDay(day2);
    }
View Full Code Here

    }

    @Test
    public void testCapacityOnNewVersionFromChristmasCalendar() {
        BaseCalendar calendar = createChristmasCalendar();
        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE.plusYears(1), EffortDuration.zero(),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        calendar.newVersion(CHRISTMAS_DAY_LOCAL_DATE.plusDays(1));
View Full Code Here

    public void testAddExceptionToNewVersionCalendar() {
        BaseCalendar calendar = createBasicCalendar();
        calendar.newVersion(CHRISTMAS_DAY_LOCAL_DATE
                .plusDays(1));

        CalendarException day = CalendarException.create(
                CHRISTMAS_DAY_LOCAL_DATE, EffortDuration.zero(),
                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        assertThat(calendar.getExceptions().size(), equalTo(1));
View Full Code Here

    @Test
    public void testAllowCreateExceptionsInThePast() {
        BaseCalendar calendar = createBasicCalendar();

        LocalDate pastMonth = (new LocalDate()).minusMonths(1);
        CalendarException exceptionDay = CalendarException.create(pastMonth,
                zero(),
                createCalendarExceptionType());

        calendar.addExceptionDay(exceptionDay);
    }
View Full Code Here

    @Test
    public void testAllowRemoveExceptionsInThePast() {
        BaseCalendar calendar = createBasicCalendar();

        LocalDate pastMonth = (new LocalDate()).minusMonths(1);
        CalendarException exceptionDay = CalendarException.create(pastMonth,
                zero(), createCalendarExceptionType());

        calendar.addExceptionDay(exceptionDay);
        calendar.removeExceptionDay(pastMonth);
    }
View Full Code Here

    public void testCreateExceptionDayWithDate() {
        LocalDate date = new LocalDate();
        CalendarExceptionType type = BaseCalendarTest
                .createCalendarExceptionType();

        CalendarException day = CalendarException.create(date,
                EffortDuration.hours(8), type);

        assertThat(day.getDate(), equalTo(new LocalDate(date)));
        assertThat(day.getDuration(), equalTo(EffortDuration.hours(8)));
        assertThat(day.getType(), equalTo(type));
    }
View Full Code Here

        if (calendarExceptionType == null) {
            return;
        }
        ResourceCalendar resourceCalendar = (ResourceCalendar) worker
                .getCalendarOrDefault();
        CalendarException calendarExceptionDay = resourceCalendar
                .getExceptionDay(date);
        Capacity capacity = Capacity.create(effortDuration);
        if (calendarExceptionDay != null) {
            resourceCalendar.removeExceptionDay(calendarExceptionDay.getDate());
        }
        baseCalendarModel.initEdit(resourceCalendar);
        baseCalendarModel.updateException(calendarExceptionType, date, date,
                capacity);
        baseCalendarModel.confirmSave();
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.CalendarException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.