Package service.exception

Examples of service.exception.NotAllowedException


        }

        // check if the rater is allowed to rate the student for the specified
        // subject if not throw a NotAllowedException
        if (User.ADMIN != rater && !subject.getRaters().contains(rater)) {
            throw new NotAllowedException(rater + " is not allowed to rate ");
        }

        // check if for the given subject exists at least one rating
        // if not create a new empty list
        if (l == null) {
View Full Code Here


        l.add(new DefaulRating(subject, rater, student, grade));
    }

    public Map<Rateable, List<Rating>> getRatings(User requester, Student student) throws NotAllowedException {
        if (!requester.equals(student) && requester != User.ADMIN) {
            throw new NotAllowedException(requester + " is not allowed to retrieve the ratings for " + student);
        }

        Map<Rateable, List<Rating>> userRatings = ratings.get(student);

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

        return new HashMap<Rateable, List<Rating>>(userRatings);
    }

    public List<Rating> getRatings(User requester, Rateable subject, Student student) throws NotAllowedException {
        if (!requester.equals(student) && !subject.getRaters().contains(requester) && requester != User.ADMIN) {
            throw new NotAllowedException(requester + " is not allowed to retrieve the ratings for " + student);
        }

        Map<Rateable, List<Rating>> userRatings = ratings.get(student);
        List<Rating> subjectRatings = null;
View Full Code Here

            scores.put(scoredUser, userScore);
        }
        //check if the scorer is allowed to score the user
        if (User.ADMIN != scorer && !subject.getScorers().contains(scorer)) {
            //if not throw an exception
            throw new NotAllowedException(scorer + " can't score for this subject!");
        }

        //get the score for the specified subject
        List<Score> subjectScores = userScore.get(subject);
        //check if the score for the subject is not empty
View Full Code Here

     *                             to score a student.
     */
    public Map<Scoreable, List<Score>> getScores(User requester, Student student) throws NotAllowedException {
        //check for the permission of the requester, so that not anyone can retrieve the scores for any student
        if (!requester.equals(student) && requester != User.ADMIN) {
            throw new NotAllowedException(requester + " is not allowed to retrieve the scores for " + student);
        }

        Map<Scoreable, List<Score>> userScore = scores.get(student);
        //for an empty userScore create a new Empty (Hash)Map
        if (userScore == null) {
View Full Code Here

     *                             to score a student.
     */
    public List<Score> getScores(User requester, Scoreable subject, Student student) throws NotAllowedException {
        //check for the permission of the requester, so that not anyone can retrieve the scores for any subject/student
        if (!requester.equals(student) && !subject.getScorers().contains(requester) && requester != User.ADMIN) {
            throw new NotAllowedException(requester + " is not allowed to retrieve the scores for " + student);
        }

        Map<Scoreable, List<Score>> userScore = scores.get(student);
        List<Score> score = null;

View Full Code Here

                if (userScores != null && !userScores.isEmpty()) {
                    List<Score> subjectScores = userScores.get(appointment);
                   
                    if (subjectScores != null && subjectScores.size() + 1 > appointment.getMaxTries()) {
                        throw new NotAllowedException();
                    }
                }
            }
        }
View Full Code Here

    @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

TOP

Related Classes of service.exception.NotAllowedException

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.