Package org.libreplan.business.calendars.entities

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


    private void givenUnitializedCalendar() {
        calendarFixture = BaseCalendar.create();
    }

    public static CalendarExceptionType createCalendarExceptionType() {
        CalendarExceptionType result = CalendarExceptionType.create("TEST",
                CalendarExceptionTypeColor.DEFAULT, true);
        return result;
    }
View Full Code Here


                createCalendarExceptionType());
        calendar.addExceptionDay(day);

        calendar.newVersion(CHRISTMAS_DAY_LOCAL_DATE.plusDays(1));

        CalendarExceptionType type = createCalendarExceptionType();
        calendar.updateExceptionDay(CHRISTMAS_DAY_LOCAL_DATE.plusYears(1),
                Capacity.create(hours(8)).withAllowedExtraEffort(
                        type.getCapacity().getAllowedExtraEffort()), type);

        assertThat(calendar.getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE
                .plusYears(1))), equalTo(hours(8)));

        assertThat(calendar.getCapacityOn(wholeDay(CHRISTMAS_DAY_LOCAL_DATE)),
View Full Code Here

public class CalendarExceptionTest {

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

        CalendarException day = CalendarException.create(date,
                EffortDuration.hours(8), type);
View Full Code Here

    public CalendarExceptionType findUniqueByName(String name) throws InstanceNotFoundException {
        if (StringUtils.isBlank(name)) {
            throw new InstanceNotFoundException(null, CalendarExceptionType.class.getName());
        }

        CalendarExceptionType calendarExceptionType = (CalendarExceptionType) getSession().createCriteria(
                CalendarExceptionType.class).add(
                Restrictions.eq("name", name.trim()).ignoreCase())
                .uniqueResult();

        if (calendarExceptionType == null) {
View Full Code Here

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

        CalendarExceptionType calendarExceptionType;

        if(calendarExceptionDTO.working){

            calendarExceptionType = calendarExceptionTypeDAO.findUniqueByName("WORKING_DAY");
View Full Code Here

     * @param effortDuration
     *            the exceptions effortDurtaion
     */
    private void updateCalendarExceptionPerWorker(Worker worker,
            LocalDate date, String exceptionName, EffortDuration effortDuration) {
        CalendarExceptionType calendarExceptionType = getCalendarExceptionType(exceptionName);
        if (calendarExceptionType == null) {
            return;
        }
        ResourceCalendar resourceCalendar = (ResourceCalendar) worker
                .getCalendarOrDefault();
View Full Code Here

    @Autowired
    private SessionFactory sessionFactory;

    private CalendarExceptionType givenCalendarExceptionTypeStored() {
        CalendarExceptionType calendarExceptionType = CalendarExceptionType
                .create("name", CalendarExceptionTypeColor.DEFAULT, false);

        calendarExceptionTypeDAO.save(calendarExceptionType);
        calendarExceptionTypeDAO.flush();
        sessionFactory.getCurrentSession().evict(calendarExceptionType);
        calendarExceptionType.dontPoseAsTransientObjectAnymore();

        return calendarExceptionType;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void exportExceptionTypes2() {
        CalendarExceptionType calendarExceptionType = givenCalendarExceptionTypeStored();

        CalendarExceptionTypeListDTO list = calendarExceptionTypeService
                .getCalendarExceptionType();
        assertThat(list.calendarExceptionTypes.size(), equalTo(1));

        CalendarExceptionTypeDTO calendarExceptionTypeDTO = list.calendarExceptionTypes
                .get(0);
        assertThat(calendarExceptionTypeDTO.code, equalTo(calendarExceptionType
                .getCode()));
        assertThat(calendarExceptionTypeDTO.name, equalTo(calendarExceptionType
                .getName()));
        assertThat(
                CalendarExceptionTypeColorConverter
                        .toEntity(calendarExceptionTypeDTO.color),
                equalTo(calendarExceptionType.getColor()));
        assertThat(calendarExceptionTypeDTO.overAssignable,
                equalTo(calendarExceptionType.isOverAssignableWithoutLimit()));
    }
View Full Code Here

        addedExceptionType = transactionService
                .runOnTransaction(new IOnTransaction<CalendarExceptionType>() {

                    @Override
                    public CalendarExceptionType execute() {
                        CalendarExceptionType result;
                        result = CalendarExceptionType.create("name",
                                CalendarExceptionTypeColor.DEFAULT, false);
                        result.setCode("TypeCode_A");
                        calendarExceptionTypeDAO.save(result);
                        return result;
                    }
                });
        addedExceptionType.dontPoseAsTransientObjectAnymore();
View Full Code Here

        super.doAfterCompose(comp);
        initializeEditWindowComponents();
    }

    private void initializeCapacityPicker() {
        final CalendarExceptionType exceptionType = getExceptionDayType();
        CapacityPicker.workWith(overAssignable, standardEffort, extraEffort,
                new Getter<Capacity>() {

                    @Override
                    public Capacity get() {
                        return exceptionType.getCapacity();
                    }
                }, new Setter<Capacity>() {

                    @Override
                    public void set(Capacity value) {
                        exceptionType.setCapacity(value);
                    }
                });
    }
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.