Package in.partake.model

Examples of in.partake.model.EventTicketHolderList


    /**
     * event の参加順位(何番目に参加したか)を返します。
     */
    public static int getOrderOfEnrolledEvent(PartakeConnection con, IPartakeDAOs daos, EventTicket ticket, Event event, String userId) throws DAOException {
        List<UserTicketEx> enrollments = getEnrollmentExs(con, daos, ticket, event);
        EventTicketHolderList list = ticket.calculateParticipationList(event, enrollments);

        int result = 0;
        for (UserTicket e : list.getEnrolledParticipations()) {
            ++result;
            if (userId.equals(e.getUserId())) { return result; }
        }
        for (UserTicket e : list.getSpareParticipations()) {
            ++result;
            if (userId.equals(e.getUserId())) { return result; }
        }

        return -1;
View Full Code Here


     * @param message
     * @throws DAOException
     */
    private void sendNotificationOnlyForParticipants(PartakeConnection con, IPartakeDAOs daos, EventTicket ticket, EventEx event, NotificationType notificationType) throws DAOException {
        List<UserTicketEx> participations = EnrollmentDAOFacade.getEnrollmentExs(con, daos, ticket, event);
        EventTicketHolderList list = ticket.calculateParticipationList(event, participations);

        List<String> userIds = new ArrayList<String>();
        for (UserTicketEx p : list.getEnrolledParticipations()) {
            if (!ParticipationStatus.ENROLLED.equals(p.getStatus()))
                continue;
            userIds.add(p.getUserId());
        }

View Full Code Here

        }
    }

    private void sendChangeNotificationImpl(PartakeConnection con, IPartakeDAOs daos, EventTicket ticket, String eventId, EventEx event) throws DAOException {
        List<UserTicketEx> participations = EnrollmentDAOFacade.getEnrollmentExs(con, daos, ticket, event);
        EventTicketHolderList list = ticket.calculateParticipationList(event, participations);

        // TODO: ここのソース汚い。同一化できる。とくに、あとの2つは一緒。
        List<String> userIdsToBeEnrolled = new ArrayList<String>();
        for (UserTicket p : list.getEnrolledParticipations()) {
            // -- 参加者向

            ModificationStatus status = p.getModificationStatus();
            if (status == null) { continue; }

            switch (status) {
            case CHANGED: { // 自分自身の力で変化させていた場合は status を enrolled にのみ変更して対応
                updateLastStatus(con, daos, eventId, p, ModificationStatus.ENROLLED);
                break;
            }
            case NOT_ENROLLED: {
                userIdsToBeEnrolled.add(p.getUserId());
                updateLastStatus(con, daos, eventId, p, ModificationStatus.ENROLLED);
                break;
            }
            case ENROLLED:
                break;
            }
        }
        if (!userIdsToBeEnrolled.isEmpty()) {
            String eventNotificationId = daos.getEventNotificationAccess().getFreshId(con);
            EventTicketNotification notification = new EventTicketNotification(eventNotificationId, ticket.getId(), ticket.getEventId(), userIdsToBeEnrolled, NotificationType.BECAME_TO_BE_ENROLLED, TimeUtil.getCurrentDateTime());
            daos.getEventNotificationAccess().put(con, notification);

            for (String userId : userIdsToBeEnrolled) {
                String userNotificationid = daos.getUserNotificationAccess().getFreshId(con);
                UserNotification userNotification = new UserNotification(userNotificationid, ticket.getId(), userId, NotificationType.BECAME_TO_BE_ENROLLED, MessageDelivery.INQUEUE, TimeUtil.getCurrentDateTime(), null);
                daos.getUserNotificationAccess().put(con, userNotification);

                String envelopeId = daos.getMessageEnvelopeAccess().getFreshId(con);
                MessageEnvelope envelope = MessageEnvelope.createForUserNotification(envelopeId, userNotificationid, null);
                daos.getMessageEnvelopeAccess().put(con, envelope);
            }
        }

        List<String> userIdsToBeCancelled = new ArrayList<String>();
        for (UserTicket p : list.getSpareParticipations()) {
            ModificationStatus status = p.getModificationStatus();
            if (status == null) { continue; }

            switch (status) {
            case CHANGED: // 自分自身の力で変化させていた場合は status を not_enrolled にのみ変更して対応
                updateLastStatus(con, daos, eventId, p, ModificationStatus.NOT_ENROLLED);
                break;
            case NOT_ENROLLED:
                break;
            case ENROLLED:
                updateLastStatus(con, daos, eventId, p, ModificationStatus.NOT_ENROLLED);
                userIdsToBeCancelled.add(p.getUserId());
                break;
            }
        }

        for (UserTicket p : list.getCancelledParticipations()) {
            ModificationStatus status = p.getModificationStatus();
            if (status == null) { continue; }

            switch (status) {
            case CHANGED: // 自分自身の力で変化させていた場合は status を not_enrolled にのみ変更して対応
View Full Code Here

        tickets = daos.getEventTicketAccess().findEventTicketsByEventId(con, eventId);
        for (int i = 0; i < tickets.size(); ++i) {
            EventTicket ticket = tickets.get(i);
            List<UserTicketEx> participations = EnrollmentDAOFacade.getEnrollmentExs(con, daos, ticket, event);
            EventTicketHolderList list = ticket.calculateParticipationList(event, participations);
            ticketAndHolders.add(new Pair<EventTicket, EventTicketHolderList>(ticket, list));

            for (UserTicketEx participation : list.getEnrolledParticipations()) {
                if (!userTicketInfoMap.containsKey(participation.getUserId())) {
                    userTicketInfoMap.put(participation.getUserId(), Arrays.asList(new String[tickets.size()]));
                }
                userTicketInfoMap.get(participation.getUserId()).set(i, participation.getStatus().toHumanReadableString(false));
            }
            for (UserTicketEx participation : list.getSpareParticipations()) {
                if (!userTicketInfoMap.containsKey(participation.getUserId()))
                    userTicketInfoMap.put(participation.getUserId(), Arrays.asList(new String[tickets.size()]));
                userTicketInfoMap.get(participation.getUserId()).set(i, participation.getStatus().toHumanReadableString(true));
            }
            for (UserTicketEx participation : list.getCancelledParticipations()) {
                if (!userTicketInfoMap.containsKey(participation.getUserId()))
                    userTicketInfoMap.put(participation.getUserId(), Arrays.asList(new String[tickets.size()]));
                userTicketInfoMap.get(participation.getUserId()).set(i, participation.getStatus().toHumanReadableString(false));
            }
        }
View Full Code Here

        CSVWriter writer = new CSVWriter(new OutputStreamWriter(baos, Charset.forName("UTF-8")));

        writeHeader(writer, event);
        for (int i = 0; i < ticketAndHolders.size(); ++i) {
            EventTicket ticket = ticketAndHolders.get(i).getFirst();
            EventTicketHolderList list = ticketAndHolders.get(i).getSecond();
            writeTicket(writer, event, ticket, list, i, userTicketInfoMap);
        }

        writer.flush();
        writer.close();
View Full Code Here

                cancelledParticipations.add(participation);
                break;
            }
        }

        return new EventTicketHolderList(enrolledParticipations, spareParticipations, cancelledParticipations, reservedEnrolled, reservedSpare);
    }
View Full Code Here

TOP

Related Classes of in.partake.model.EventTicketHolderList

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.