Package in.partake.base

Examples of in.partake.base.PartakeException


    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        EventTicket ticket = daos.getEventTicketAccess().find(con, ticketId);
        if (ticket == null)
            throw new PartakeException(UserErrorCode.INVALID_TICKET_ID);

        Event event = daos.getEventAccess().find(con, ticket.getEventId());
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_TICKET_ID);

        if (!EventEditParticipantsPermission.check(event, user))
            throw new PartakeException(UserErrorCode.FORBIDDEN_EVENT_ATTENDANT_EDIT);

        updateAttendanceStatus(con, daos);
        return null;
    }
View Full Code Here


        // We have already checked the event exists, so when no enrollment is found, we throw an "invalid user id"
        // exception here.
        UserTicket enrollment = enrollmentAccess.findByTicketIdAndUserId(con, ticketId, userId);
        if (enrollment == null)
            throw new PartakeException(UserErrorCode.INVALID_USER_ID);

        UserTicket newEnrollment = new UserTicket(enrollment);
        newEnrollment.setAttendanceStatus(status);
        enrollmentAccess.put(con, newEnrollment);
    }
View Full Code Here

                        return 1;
                }
            });
            this.eventsRetrieved = this.eventsRetrieved.subList(Util.ensureRange(offset, 0, eventsRetrieved.size()), Util.ensureRange(offset + limit, 0, eventsRetrieved.size()));
        } else {
            throw new PartakeException(UserErrorCode.INVALID_ARGUMENT);
        }
    }
View Full Code Here

    @Override
    protected EventEx doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        EventEx event = EventDAOFacade.getEventEx(con, daos, eventId);
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_EVENT_ID);

        if (!StringUtils.isBlank(event.getPasscode())) {
            // owner および manager は見ることが出来る。
            if (user != null && PrivateEventShowPermission.check(event, user)) {
                // OK. You have the right to show this event.
            } else if (StringUtils.equals(event.getPasscode(), passcode)) {
                // OK. The same passcode.
            } else {
                // public でなければ、passcode を入れなければ見ることが出来ない
                throw new PartakeException(UserErrorCode.FORBIDDEN_EVENT_SHOW);
            }
        }

        return event;
    }
View Full Code Here

                ObjectMapper mapper = new ObjectMapper();
                map = mapper.readValue(jsonStr, ObjectNode.class);
            }
            return Util.parseEnqueteAnswers(map);
        } catch (JsonParseException e) {
            throw new PartakeException(UserErrorCode.INVALID_ENQUETE_ANSWERS);
        } catch (JsonMappingException e) {
            throw new PartakeException(UserErrorCode.INVALID_ENQUETE_ANSWERS);
        } catch (IOException e) {
            // I can not find Exception which suits in this situation,
            // so I use RuntimeException. 2012/Dec/16 Kengo TODA
            throw new RuntimeException(e);
        }
View Full Code Here

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        event = daos.getEventAccess().find(con, eventId);
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_EVENT_ID);
        if (!EventEditPermission.check(event, user))
            throw new PartakeException(UserErrorCode.FORBIDDEN_EVENT_EDIT);

        modifyTickets(con, daos, event.isDraft());
        return null;
    }
View Full Code Here

            for (int i = 0; i < originalTickets.size(); ++i) {
                if (!originalTickets.get(i).getId().equals(ticket.getId()))
                    continue;
                if (processed[i])
                    throw new PartakeException(UserErrorCode.INVALID_TICKET_DUPLICATE_ID);

                // Found the original ticket.
                processed[i] = true;
                originalTicket = originalTickets.get(i);
                break;
            }

            if (originalTicket == null) {
                // If new ticket has id, it's strange. Otherwise, add a new ticket id.
                if (ticket.getId() != null)
                    throw new PartakeException(UserErrorCode.INVALID_PARAMETERS);
                ticket.setId(daos.getEventTicketAccess().getFreshId(con));
            }
        }

        // If the event has already been published, all ticket should be preserved.
        // However, it's OK to remove the ticket that no participants.
        if (!forDraft) {
            for (int i = 0; i < processed.length; ++i) {
                UUID eventTicketId = originalTickets.get(i).getId();
                if (!processed[i] && daos.getEnrollmentAccess().countByTicketId(con, eventTicketId) > 0)
                    throw new PartakeException(UserErrorCode.INVALID_TICKET_REMOVAL_ENROLLED);
            }
        }

        // OK. let's save the tickets.
        dao.removeByEventId(con, eventId);
View Full Code Here

    // TODO: We should share a lot of code with ChangeEnrollmentCommentAPI.
    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        EventTicket ticket = daos.getEventTicketAccess().find(con, ticketId);
        if (ticket == null)
            throw new PartakeException(UserErrorCode.INVALID_TICKET_ID);

        Event event = daos.getEventAccess().find(con, ticket.getEventId());
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_EVENT_ID);

        // もし、締め切りを過ぎている場合、変更が出来なくなる。
        if (!ticket.acceptsApplication(event, TimeUtil.getCurrentDateTime()))
            throw new PartakeException(UserErrorCode.INVALID_ENROLL_TIMEOVER);

        // もし、予約締切を過ぎている場合、reservation にはできない。
        if (ticket.isReservationTimeOver(event) && ParticipationStatus.RESERVED.equals(status))
            throw new PartakeException(UserErrorCode.INVALID_APPLICATION_RESERVATION_TIMEOVER);

        EnrollmentDAOFacade.enrollImpl(con, daos, user, ticketId, event, status, comment, enqueteAnswers, false, ticket.isReservationTimeOver(event));
        tweetEnrollment(con, daos, user, event, status);
        return null;
    }
View Full Code Here

    @Override
    protected Result doExecute() throws DAOException, PartakeException {
        UserEx user = ensureLogin();
        ensureValidSessionToken();
        if (user.isBanned()) {
            throw new PartakeException(UserErrorCode.BANNED_USER);
        }

        Event embryo = new Event();
        embryo.setOwnerId(user.getId());
        embryo.setDraft(optBooleanParameter("draft", true));
View Full Code Here

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        EventComment comment = daos.getCommentAccess().find(con, commentId);
        if (comment == null)
            throw new PartakeException(UserErrorCode.INVALID_COMMENT_ID);

        Event event = daos.getEventAccess().find(con, comment.getEventId());
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_COMMENT_ID);

        if (!RemoveCommentPermission.check(comment, event, user))
            throw new PartakeException(UserErrorCode.COMMENT_REMOVAL_FORBIDDEN);

        daos.getCommentAccess().remove(con, commentId);
        return null;
    }
View Full Code Here

TOP

Related Classes of in.partake.base.PartakeException

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.