Package in.partake.model.dto

Examples of in.partake.model.dto.Event


    }

    @Test
    public void testToBuildUserNotificationMessageBodyForCancelledReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.BECAME_TO_BE_CANCELLED);
View Full Code Here


    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);
View Full Code Here

        }

        ModifyTicketTransaction transaction = new ModifyTicketTransaction(user, eventId, tickets);
        transaction.execute();

        Event event = transaction.getEvent();
        IEventSearchService searchService = PartakeApp.getEventSearchService();
        if (!event.isSearchable())
            searchService.remove(eventId);
        else if (searchService.hasIndexed(eventId))
            searchService.update(event, tickets);
        else
            searchService.create(event, tickets);
View Full Code Here

    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()))
View Full Code Here

        ensureValidSessionToken();
        if (user.isBanned()) {
            throw new PartakeException(UserErrorCode.BANNED_USER);
        }

        Event embryo = new Event();
        embryo.setOwnerId(user.getId());
        embryo.setDraft(optBooleanParameter("draft", true));
        embryo.setCreatedAt(TimeUtil.getCurrentDateTime());

        // Title
        String title = getParameter("title");
        if (StringUtils.isBlank(title) || title.length() > 100)
            return renderInvalid(UserErrorCode.INVALID_PARAMETERS, Collections.singletonMap("title", "タイトルは 100 文字以下で必ず入力してください。"));
        embryo.setTitle(title);

        // beginDate
        {
            DateTime beginDate = getDateTimeParameter("beginDate");
            if (beginDate == null)
                return renderInvalid(UserErrorCode.INVALID_PARAMETERS, Collections.singletonMap("beginDate", "開始日時は必ず入力して下さい。"));

            Calendar beginCalendar = TimeUtil.calendar(beginDate.toDate());
            if (beginCalendar.get(Calendar.YEAR) < 2000 || 2100 < beginCalendar.get(Calendar.YEAR))
                return renderInvalid(UserErrorCode.INVALID_PARAMETERS, Collections.singletonMap("beginDate", "開始日時の範囲が不正です。"));

            embryo.setBeginDate(beginDate);
        }

        // endDate
        {
            DateTime endDate = getDateTimeParameter("endDate");
            if (endDate != null) {
                Calendar endCalendar = TimeUtil.calendar(endDate.toDate());
                if (endCalendar.get(Calendar.YEAR) < 2000 || 2100 < endCalendar.get(Calendar.YEAR))
                    return renderInvalid(UserErrorCode.INVALID_PARAMETERS, Collections.singletonMap("endDate", "終了日時の範囲が不正です。"));

                if (!embryo.getBeginDate().isBefore(endDate))
                    return renderInvalid(UserErrorCode.INVALID_PARAMETERS, Collections.singletonMap("endDate", "終了日時が開始日時より前になっています。"));
            }

            embryo.setEndDate(endDate);
        }

        String eventId = new CreateTransaction(embryo).execute();
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("eventId", eventId);
View Full Code Here

    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);
View Full Code Here

        this.limit = limit;
    }

    @Override
    protected List<EventTicketNotification> doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        Event event = daos.getEventAccess().find(con, eventId);

        if (!EventNotificationListPermission.check(event, user))
            throw new PartakeException(UserErrorCode.FORBIDDEN_SHOW_NOTIFICATION);

        return daos.getEventNotificationAccess().findByEventId(con, eventId, offset, limit);
View Full Code Here

        this.commentEmbryo = embryo;
    }

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        Event event = daos.getEventAccess().find(con, commentEmbryo.getEventId());
        if (event == null)
            throw new PartakeException(UserErrorCode.INVALID_EVENT_ID);

        commentEmbryo.setId(daos.getCommentAccess().getFreshId(con));
        daos.getCommentAccess().put(con, commentEmbryo);
View Full Code Here

        this.options = options;
    }

    @Override
    protected Void doExecute(PartakeConnection con, IPartakeDAOs daos) throws DAOException, PartakeException {
        Event 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);

        List<EnqueteQuestion> enquetes = new ArrayList<EnqueteQuestion>();
        try {
            for (int i = 0; i < questions.length; ++i) {
                List<String> optionValues = new ArrayList<String>();
                ArrayNode array;
                    array = new ObjectMapper().readValue(options[i], ArrayNode.class);
                for (int j = 0; j < array.size(); ++j)
                    optionValues.add(array.get(j).asText());
   
                UUID enqueteId = Util.isUUID(ids[i]) ? UUID.fromString(ids[i]) : UUID.randomUUID();
                EnqueteQuestion question = new EnqueteQuestion(
                        enqueteId, questions[i], EnqueteAnswerType.safeValueOf(types[i]), optionValues);
                enquetes.add(question);
            }
        } catch (JsonParseException e) {
            throw new IllegalArgumentException(e);
        } catch (JsonMappingException e) {
            throw new IllegalArgumentException(e);
        } 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);
        }

        Event copied = new Event(event);
        copied.setEnquetes(enquetes);
        daos.getEventAccess().put(con, copied);

        return null;
    }
View Full Code Here

        UserEx user = ensureLogin();
        String eventId = getValidEventIdParameter();
        ensureValidSessionToken();

        PublishTransaction transaction = new PublishTransaction(user, eventId);
        Event event = transaction.execute();
        List<EventTicket> tickets = transaction.getTickets();

        IEventSearchService searchService = PartakeApp.getEventSearchService();
        if (!event.isSearchable())
            searchService.remove(event.getId());
        else
            searchService.create(event, tickets);

        return renderOK();
    }
View Full Code Here

TOP

Related Classes of in.partake.model.dto.Event

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.