Package org.libreplan.business.calendars.entities

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


        LocalDate startDate = null;
        if (workingWeek.startDate != null) {
            expiringDate = LocalDate.fromDateFields(workingWeek.startDate);
        }

        CalendarData calendarData = CalendarData.create();

        calendarData.setExpiringDate(expiringDate);

        if (parent != null) {

            calendarData.setParent(parent);

        }

        calendarData.setCodeAutogenerated(true);

        Map<Integer, Capacity> capacitiesPerDays = getCapacitiesPerDays(
                workingWeek.hoursPerDays, parent);
        try {
            calendarData.updateCapacitiesPerDay(capacitiesPerDays);
        } catch (IllegalArgumentException e) {
            throw new ValidationException(e.getMessage());
        }

        return calendarData;
View Full Code Here


        BaseCalendar baseCalendar = baseCalendarDAO
                .findByCode(codeBaseCalendar);
        assertTrue(baseCalendar.getExceptions().isEmpty());
        assertTrue(baseCalendar.getCalendarDataVersions().size() == 2);

        CalendarData data = baseCalendar.getCalendarDataByCode("codeData");
        assertEquals(Capacity.create(EffortDuration.hours(4))
                .overAssignableWithoutLimit(),
                data.getCapacityOn(CalendarData.Days.FRIDAY));
        assertEquals(Capacity.create(EffortDuration.hours(4))
                .overAssignableWithoutLimit(true),
                data.getCapacityOn(CalendarData.Days.TUESDAY));
    }
View Full Code Here

    public class HistoryVersionsRenderer implements ListitemRenderer {

        @Override
        public void render(Listitem item, Object data) {
            CalendarData calendarData = (CalendarData) data;
            item.setValue(calendarData);

            if (isDerived()) {
                appendParentCombobox(item, calendarData);
            } else {
View Full Code Here

            listCell.appendChild(comboParents);
            listItem.appendChild(listCell);
        }

        private void markAsSelected(Listitem item, CalendarData calendarData) {
            CalendarData selected = baseCalendarModel.getCalendarData();
            if ((selected != null) && (calendarData.equals(selected))) {
                item.setSelected(true);
            }
        }
View Full Code Here

        private void addEventListener(Listitem item) {
            item.addEventListener(Events.ON_CLICK, new EventListener() {
                @Override
                public void onEvent(Event event) {
                    Listitem item = (Listitem) event.getTarget();
                    CalendarData calendarData = (CalendarData) item.getValue();

                    LocalDate dateValidFrom = baseCalendarModel
                            .getValidFrom(calendarData);
                    LocalDate expiringDate = calendarData.getExpiringDate();

                    if (dateValidFrom != null) {
                        goToDate(dateValidFrom.toDateTimeAtStartOfDay()
                                .toDate());
                    } else if (expiringDate != null) {
View Full Code Here

                    .toLocalDate(calendarDataDTO.expiringDate);
        }

        BaseCalendar parent = findBaseCalendarParent(calendarDataDTO.parentCalendar);

        CalendarData calendarData = CalendarData.createUnvalidated(
                calendarDataDTO.code, expiringDate, parent);

        Map<Integer, Capacity> capacitiesPerDays = getCapacitiesPerDays(calendarDataDTO.hoursPerDays);
        try {
            calendarData.updateCapacitiesPerDay(capacitiesPerDays);
        } catch (IllegalArgumentException e) {
            throw new ValidationException(e.getMessage());
        }

        return calendarData;
View Full Code Here

                            "missing code in a calendar data version");
                }

                // find by code
                try {
                    CalendarData version = baseCalendar
                            .getCalendarDataByCode(calendarDataDTO.code);
                    update(version, calendarDataDTO);
                } catch (InstanceNotFoundException e) {
                    try {
                        baseCalendar.addNewVersion(toEntity(calendarDataDTO));
View Full Code Here

    @Override
    public BaseCalendar getCurrentParent() {
        if (getBaseCalendar() == null) {
            return null;
        }
        CalendarData version = getCurrentVersion();
        return version != null ? version.getParent() : null;
    }
View Full Code Here

        return version != null ? version.getParent() : null;
    }

    @Override
    public Date getCurrentExpiringDate() {
        CalendarData calendarData = getCurrentVersion();
        if (calendarData != null) {
            LocalDate startDate = calendarData.getExpiringDate();
            return startDate != null ? startDate.minusDays(1)
                    .toDateTimeAtStartOfDay()
                    .toDate() : null;
        }
        return null;
View Full Code Here

        return null;
    }

    @Override
    public Date getCurrentStartDate() {
        CalendarData calendarData = getCurrentVersion();
        if (calendarData != null) {
            LocalDate startDate = getValidFrom(calendarData);
            return startDate != null ? startDate.toDateTimeAtStartOfDay()
                    .toDate() : null;
        }
View Full Code Here

TOP

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

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.