Package model

Examples of model.Lva


*/
public class LvaAppointmentServiceDecorator extends AbstractAppointmentServiceDecorator<Lva> {

    @Override
    public void removeAppointment(Lva appointment, User responsibleUser) throws AppointmentNotFoundException, NotAllowedException {
        Lva real = getRealAppointment(appointment);
        saveAppointment(real.delete(), responsibleUser);
    }
View Full Code Here


        saveAppointment(real.delete(), responsibleUser);
    }

    @Override
    public void unregister(User user, Lva appointment) throws UnregisterPeriodOverException, NotRegisteredException, AppointmentNotFoundException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted()) {
            throw new AppointmentNotFoundException();
        }

        delegate.unregister(user, appointment);
    }
View Full Code Here

        delegate.unregister(user, appointment);
    }

    @Override
    public void saveAppointment(Lva appointment, User responsibleUser) throws NotAllowedException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted() && !real.getLecturer().equals(responsibleUser) && responsibleUser != User.ADMIN) {
            throw new NotAllowedException();
        }

        delegate.saveAppointment(appointment, responsibleUser);
    }
View Full Code Here

        delegate.saveAppointment(appointment, responsibleUser);
    }

    @Override
    public void rescheduleAppointment(Lva appointment, User responsibleUser) throws AppointmentNotFoundException, NotAllowedException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted() && !real.getLecturer().equals(responsibleUser) && responsibleUser != User.ADMIN) {
            throw new AppointmentNotFoundException();
        }

        delegate.rescheduleAppointment(appointment, responsibleUser);
    }
View Full Code Here

        delegate.rescheduleAppointment(appointment, responsibleUser);
    }

    @Override
    public void register(User user, Lva appointment, User responsibleUser) throws RegisterPeriodOverException, AlreadyRegisteredException, MaximumMemberCountExceededException, RequirementsNotFullfilledException, AppointmentNotFoundException, NotAllowedException {
        Lva real = getRealAppointment(appointment);

        if (real == null || real.isDeleted()) {
            throw new AppointmentNotFoundException();
        }

        if (!(user instanceof Student)) {
            throw new IllegalArgumentException("Only students can register to a Lva!");
        }

        if (real.getRequirement() != null && responsibleUser != User.ADMIN) {
            @SuppressWarnings("unchecked")
            Map<Student, Map<Rateable, List<Rating>>> ratings = PersistenceContext.getInstance().getPersistentMap("ratings");
            checkRequirement(real.getRequirement(), getAppointments(User.ADMIN), ratings.get((Student) user));
        }

        delegate.register(user, appointment, responsibleUser);
    }
View Full Code Here

        delegate.register(user, appointment, responsibleUser);
    }

    @Override
    public List<User> getRegisteredUsers(Lva appointment, User requester) throws AppointmentNotFoundException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted() && !real.getLecturer().equals(requester) && requester != User.ADMIN) {
            throw new AppointmentNotFoundException();
        }

        return delegate.getRegisteredUsers(appointment, requester);
    }
View Full Code Here

        return delegate.getRegisteredUsers(appointment, requester);
    }

    @Override
    public int getRegisteredUserCount(Lva appointment, User requester) throws AppointmentNotFoundException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted() && !real.getLecturer().equals(requester) && requester != User.ADMIN) {
            throw new AppointmentNotFoundException();
        }

        return delegate.getRegisteredUserCount(appointment, requester);
    }
View Full Code Here

    public List<Lva> getAppointments(User user) {
        List<Lva> lvas = new ArrayList<Lva>(delegate.getAppointments(user));
        Iterator<Lva> iter = lvas.iterator();

        while (iter.hasNext()) {
            Lva lva = iter.next();

            if (lva.isDeleted() && !lva.getLecturer().equals(user) && user != User.ADMIN) {
                iter.remove();
            }
        }

        return lvas;
View Full Code Here

        return lvas;
    }

    @Override
    public void cancelAppointment(Lva appointment, User responsibleUser) throws AppointmentNotFoundException, NotAllowedException {
        Lva real = getRealAppointment(appointment);

        if (real != null && real.isDeleted() && !real.getLecturer().equals(responsibleUser) && responsibleUser != User.ADMIN) {
            throw new AppointmentNotFoundException();
        }

        delegate.cancelAppointment(appointment, responsibleUser);
    }
View Full Code Here

        assertTrue(lvaService.getAppointments().contains(lva6));
        System.out.println("Successfully set the restored LVA: " + lva6);
    }

    public void testGetMaximumMemberCount() throws Exception {
        Lva l1 = new Lva(50, "Example", tomorrow, tomorrow, today, tomorrow, tomorrow, lect1, 1, "STEOP", "STEG", null, 1, new ArrayList<Exam>(), new ArrayList<PracticeGroup>(), new ArrayList<Interview>(), new ArrayList<User>());
       
        lvaService.saveAppointment(l1, lect1);
        lvaService.register(student1, l1, student1);
       
        try{
View Full Code Here

TOP

Related Classes of model.Lva

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.