Package in.partake.model.dto

Examples of in.partake.model.dto.EventTicketNotification


public class EventTicketNotificationTestDataProvider extends TestDataProvider<EventTicketNotification> {
    @Override
    public EventTicketNotification create(long pkNumber, String pkSalt, int objNumber) {
        String id = new UUID(pkNumber, pkSalt.hashCode()).toString();
        return new EventTicketNotification(id, new UUID(0, 0), "eventId"new ArrayList<String>(), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(objNumber));
    }
View Full Code Here


    }

    @Override
    public List<EventTicketNotification> createSamples() {
        List<EventTicketNotification> array = new ArrayList<EventTicketNotification>();
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 0), "eventId", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 1).toString(), new UUID(1, 0), "eventId", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 1), "eventId", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 0), "eventId1", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 0), "eventId", Arrays.asList(new String[] { "1" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 0), "eventId", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_ENROLLED, new DateTime(0)));
        array.add(new EventTicketNotification(new UUID(0, 0).toString(), new UUID(1, 0), "eventId", Arrays.asList(new String[] { "" }), NotificationType.BECAME_TO_BE_CANCELLED, new DateTime(1)));
        return array;
    }
View Full Code Here

            userIds.add(participation.getUserId());
        }

        // TODO: ここから下のコードは、参加者のみにおくる場合と仮参加者のみに送る場合で共有するべき
        String eventNotificationId = daos.getEventNotificationAccess().getFreshId(con);
        EventTicketNotification notification = new EventTicketNotification(eventNotificationId, ticket.getId(), ticket.getEventId(), userIds, notificationType, TimeUtil.getCurrentDateTime());
        daos.getEventNotificationAccess().put(con, notification);

        DateTime invalidAfter = ticket.acceptsReservationTill(event);
        for (String userId : userIds) {
            String notificationId = daos.getUserNotificationAccess().getFreshId(con);
View Full Code Here

        //  1. 現在時刻が締め切り24時間前よりも後
        //  2. 次の条件のいずれか満たす
        //    2.1. まだメッセージが送られていない
        //    2.2. 前回送った時刻が締め切り24時間以上前で、かつ送った時刻より1時間以上経過している。
        {
            EventTicketNotification notification = daos.getEventNotificationAccess().findLastNotification(con, ticket.getId(), NotificationType.ONE_DAY_BEFORE_REMINDER_FOR_RESERVATION);
            DateTime lastSent = notification != null ? notification.getCreatedAt() : null;
            if (needsToSend(now, deadline.nDayBefore(1), lastSent))
                sendNotificationOnlyForReservedParticipants(con, daos, ticket, event, NotificationType.ONE_DAY_BEFORE_REMINDER_FOR_RESERVATION);
        }

        // 締め切り12時間前になっても RESERVED な人がいればメッセージを送付する。
        {
            EventTicketNotification notification = daos.getEventNotificationAccess().findLastNotification(con, ticket.getId(), NotificationType.HALF_DAY_BEFORE_REMINDER_FOR_RESERVATION);
            DateTime lastSent = notification != null ? notification.getCreatedAt() : null;
            if (needsToSend(now, deadline.nHourBefore(12), lastSent))
                sendNotificationOnlyForReservedParticipants(con, daos, ticket, event, NotificationType.HALF_DAY_BEFORE_REMINDER_FOR_RESERVATION);
        }

        // イベント1日前で、参加が確定している人にはメッセージを送付する。
        // 参加が確定していない人には、RESERVED なメッセージが送られている。
        {
            EventTicketNotification notification = daos.getEventNotificationAccess().findLastNotification(con, ticket.getId(), NotificationType.EVENT_ONEDAY_BEFORE_REMINDER);
            DateTime lastSent = notification != null ? notification.getCreatedAt() : null;
            if (needsToSend(now, beginDate.nDayBefore(1), lastSent))
                sendNotificationOnlyForParticipants(con, daos, ticket, event, NotificationType.EVENT_ONEDAY_BEFORE_REMINDER);
        }
    }
View Full Code Here

                continue;
            userIds.add(p.getUserId());
        }

        String eventNotificationId = daos.getEventNotificationAccess().getFreshId(con);
        EventTicketNotification notification = new EventTicketNotification(eventNotificationId, ticket.getId(), ticket.getEventId(), userIds, notificationType, TimeUtil.getCurrentDateTime());
        daos.getEventNotificationAccess().put(con, notification);

        DateTime invalidAfter = event.getBeginDate();
        for (String userId : userIds) {
            String notificationId = daos.getUserNotificationAccess().getFreshId(con);
View Full Code Here

                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 にのみ変更して対応
                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;
            }
        }

        if (!userIdsToBeCancelled.isEmpty()) {
            String notificationId = daos.getEventNotificationAccess().getFreshId(con);
            EventTicketNotification notification = new EventTicketNotification(notificationId, ticket.getId(), ticket.getEventId(), userIdsToBeEnrolled, NotificationType.BECAME_TO_BE_CANCELLED, TimeUtil.getCurrentDateTime());
            daos.getEventNotificationAccess().put(con, notification);

            for (String userId : userIdsToBeCancelled) {
                String userNotificationid = daos.getUserNotificationAccess().getFreshId(con);
                UserNotification userNotification = new UserNotification(userNotificationid, ticket.getId(), userId, NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.INQUEUE, TimeUtil.getCurrentDateTime(), null);
View Full Code Here

import org.codehaus.jackson.node.ObjectNode;

class EntityEventNotificationMapper extends Postgres9EntityDataMapper<EventTicketNotification> {
    public EventTicketNotification map(ObjectNode obj) {
        return new EventTicketNotification(obj).freeze();
    }
View Full Code Here

TOP

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

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.