Package in.partake.model.dto

Examples of in.partake.model.dto.UserNotification


        daos.getTwitterMessageAccess().put(con, twitterMessage);
        it.remove();
    }

    private void sendUserNotification(PartakeConnection con, IPartakeDAOs daos, DataIterator<MessageEnvelope> it, MessageEnvelope envelope) throws DAOException {
        UserNotification notification = daos.getUserNotificationAccess().find(con, envelope.getUserNotificationId());
        if (notification == null) {
            failedSendingUserNotification(con, daos, it, envelope, notification);
            return;
        }

        UserEx sender = UserDAOFacade.getUserEx(con, daos, notification.getUserId());
        if (sender == null) {
            Logger.warn("sendTwitterMessage : sender is null.");
            failedSendingUserNotification(con, daos, it, envelope, notification);
            return;
        }

        UserTwitterLink twitterLinkage = sender.getTwitterLinkage();
        if (twitterLinkage == null || !twitterLinkage.isAuthorized()) {
            Logger.warn("sendTwitterMessage : envelope id " + envelope.getId() + " could not be sent : No access token");
            failedSendingUserNotification(con, daos, it, envelope, notification);
            return;
        }

        EventTicket ticket = daos.getEventTicketAccess().find(con, notification.getTicketId());
        if (ticket == null) {
            failedSendingUserNotification(con, daos, it, envelope, notification);
            return;
        }
View Full Code Here


            return null;
        }
    }

    private void succeededSendingUserNotification(PartakeConnection con, IPartakeDAOs daos, DataIterator<MessageEnvelope> it, MessageEnvelope envelope, UserNotification notification) throws DAOException {
        UserNotification userNotification = new UserNotification(notification);
        userNotification.setDelivery(MessageDelivery.SUCCESS);
        userNotification.setModifiedAt(TimeUtil.getCurrentDateTime());

        daos.getUserNotificationAccess().put(con, userNotification);
        it.remove();
    }
View Full Code Here

        daos.getUserNotificationAccess().put(con, userNotification);
        it.remove();
    }

    private void failedSendingUserNotification(PartakeConnection con, IPartakeDAOs daos, DataIterator<MessageEnvelope> it, MessageEnvelope envelope, UserNotification notification) throws DAOException {
        UserNotification userNotification = new UserNotification(notification);
        userNotification.setDelivery(MessageDelivery.FAIL);
        userNotification.setModifiedAt(TimeUtil.getCurrentDateTime());

        daos.getUserNotificationAccess().put(con, userNotification);
        it.remove();
    }
View Full Code Here

        daos.getEventNotificationAccess().put(con, notification);

        DateTime invalidAfter = ticket.acceptsReservationTill(event);
        for (String userId : userIds) {
            String notificationId = daos.getUserNotificationAccess().getFreshId(con);
            UserNotification userNotification = new UserNotification(notificationId, ticket.getId(), userId, notificationType, MessageDelivery.INQUEUE, TimeUtil.getCurrentDateTime(), null);
            daos.getUserNotificationAccess().put(con, userNotification);

            String envelopeId = daos.getMessageEnvelopeAccess().getFreshId(con);
            MessageEnvelope envelope = MessageEnvelope.createForUserNotification(envelopeId, notificationId, invalidAfter);
            daos.getMessageEnvelopeAccess().put(con, envelope);
View Full Code Here

        daos.getEventNotificationAccess().put(con, notification);

        DateTime invalidAfter = event.getBeginDate();
        for (String userId : userIds) {
            String notificationId = daos.getUserNotificationAccess().getFreshId(con);
            UserNotification userNotification = new UserNotification(notificationId, ticket.getId(), userId, notificationType, MessageDelivery.INQUEUE, TimeUtil.getCurrentDateTime(), null);
            daos.getUserNotificationAccess().put(con, userNotification);

            String envelopeId = daos.getMessageEnvelopeAccess().getFreshId(con);
            MessageEnvelope envelope = MessageEnvelope.createForUserNotification(envelopeId, notificationId, invalidAfter);
            daos.getMessageEnvelopeAccess().put(con, envelope);
View Full Code Here

            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);
                daos.getUserNotificationAccess().put(con, userNotification);

                String envelopeId = daos.getMessageEnvelopeAccess().getFreshId(con);
                MessageEnvelope envelope = MessageEnvelope.createForUserNotification(envelopeId, userNotificationid, null);
                daos.getMessageEnvelopeAccess().put(con, envelope);
View Full Code Here

import org.codehaus.jackson.node.ObjectNode;

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

TOP

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

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.