Package org.libreplan.business.calendars.entities

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


        return getFromDB(exceptionType.getId());
    }

    private CalendarExceptionType getFromDB(Long id) {
        try {
            CalendarExceptionType result = calendarExceptionTypeDAO.find(id);
            return result;
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


            fail("It should not throw an exception");
        }
    }

    private void addChristmasAsExceptionDay(BaseCalendar calendar) {
        CalendarExceptionType type = calendarExceptionTypeDAO.list(
                CalendarExceptionType.class).get(0);
        CalendarException christmasDay = CalendarException.create(
                BaseCalendarTest.CHRISTMAS_DAY_LOCAL_DATE,
                EffortDuration.zero(), type);
        calendar.addExceptionDay(christmasDay);
View Full Code Here

        return asString(baseCalendarModel.getWorkableTime());
    }

    public void createException() {
        Combobox exceptionTypes = (Combobox) window.getFellow("exceptionTypes");
        CalendarExceptionType type = (CalendarExceptionType) exceptionTypes
                .getSelectedItem().getValue();
        if (type == null) {
            throw new WrongValueException(exceptionTypes,
                    _("Please, select type of exception"));
        } else {
View Full Code Here

        return !isOwnExceptionDay();
    }

    public void updateException() {
        Combobox exceptionTypes = (Combobox) window.getFellow("exceptionTypes");
        CalendarExceptionType type = (CalendarExceptionType) exceptionTypes
                .getSelectedItem().getValue();

        Datebox dateboxStartDate = (Datebox) window
                .getFellow("exceptionStartDate");
        Date startDate = dateboxStartDate.getValue();
View Full Code Here

    }

    private void fillExceptionTypesComboAndMarkSelectedItem(
            Combobox exceptionTypes) {
        exceptionTypes.getChildren().clear();
        CalendarExceptionType type = baseCalendarModel
                .getCalendarExceptionType();

        Comboitem defaultItem = new Comboitem("NO_EXCEPTION");
        exceptionTypes.appendChild(defaultItem);
        if (type == null) {
            exceptionTypes.setSelectedItem(defaultItem);
        }

        for (CalendarExceptionType calendarExceptionType : baseCalendarModel
                .getCalendarExceptionTypes()) {
            Comboitem item = new Comboitem(calendarExceptionType.getName());
            item.setValue(calendarExceptionType);
            exceptionTypes.appendChild(item);
            if ((type != null)
                    && (type.getName().equals(calendarExceptionType.getName()))) {
                exceptionTypes.setSelectedItem(item);
            }
        }
    }
View Full Code Here

    }

    private void reloadTypeDatesAndDuration() {
        LocalDate selectedDay = baseCalendarModel.getSelectedDay();

        CalendarExceptionType type = baseCalendarModel
                .getCalendarExceptionType(new LocalDate(selectedDay));
        Combobox exceptionTypes = (Combobox) window.getFellow("exceptionTypes");
        @SuppressWarnings("unchecked")
        List<Comboitem> items = exceptionTypes.getItems();
        for (Comboitem item : items) {
            CalendarExceptionType value = (CalendarExceptionType) item
                    .getValue();
            if ((value == null) && (type == null)) {
                exceptionTypes.setSelectedItem(item);
                break;
            }
            if ((value != null) && (type != null)
                    && (value.getName().equals(type.getName()))) {
                exceptionTypes.setSelectedItem(item);
                break;
            }
        }
View Full Code Here

            return colorsMap;
        }

        for (LocalDate date = minDate; date.compareTo(maxDate) <= 0; date = date
                .plusDays(1)) {
            CalendarExceptionType calendarExceptionType = calendar
                    .getExceptionType(date);

            if (calendarExceptionType != null) {
                if (calendar.getOwnExceptionDay(date) != null) {
                    addDayToColor(colorsMap, calendarExceptionType.getColor()
                            .getColorOwnException(), date.getDayOfMonth());
                } else {
                    addDayToColor(colorsMap, calendarExceptionType.getColor()
                            .getColorDerivedException(), date.getDayOfMonth());
                }
            } else {
                if (calendar.getCapacityOn(PartialDay.wholeDay(date)).isZero()) {
                    addDayToColor(colorsMap, BACKGROUND_COLOR_ZERO_HOURS_DAY,
View Full Code Here

        LocalDate date = null;
        if (calendarExceptionDTO.date != null) {
            date = DateConverter.toLocalDate(calendarExceptionDTO.date);
        }

        CalendarExceptionType type = findCalendarExceptionType(calendarExceptionDTO.calendarExceptionTypeCode);

        return CalendarException.create(calendarExceptionDTO.code, date,
                EffortDuration.hours(calendarExceptionDTO.hours), type);
    }
View Full Code Here

        LocalDate date = null;
        if (calendarExceptionDTO.date != null) {
            date = DateConverter.toLocalDate(calendarExceptionDTO.date);
        }

        CalendarExceptionType type = findCalendarExceptionType(calendarExceptionDTO.calendarExceptionTypeCode);

        exception.updateUnvalidated(date, calendarExceptionDTO.hours, type);
    }
View Full Code Here

TOP

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

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.