Package in.partake.model.dto

Examples of in.partake.model.dto.EventMessage


public class EventMessageTestDataProvider extends TestDataProvider<EventMessage> {
    @Override
    public EventMessage create(long pkNumber, String pkSalt, int objNumber) {
        UUID uuid = new UUID(pkNumber, pkSalt.hashCode());
        EventMessage message = new EventMessage(uuid.toString(), "eventId", "senderId", "messageId", new DateTime(objNumber), null);
        return message;
    }
View Full Code Here


    }

    @Override
    public List<EventMessage> createSamples() {
        List<EventMessage> array = new ArrayList<EventMessage>();
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId", "senderId", "messageId", new DateTime(0), null));
        array.add(new EventMessage(new UUID(0, 1).toString(), "eventId", "senderId", "messageId", new DateTime(0), null));
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId1", "senderId", "messageId", new DateTime(0), null));
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId", "senderId1", "messageId", new DateTime(0), null));
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId", "senderId", "messageId1", new DateTime(0), null));
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId", "senderId", "messageId", new DateTime(1), null));
        array.add(new EventMessage(new UUID(0, 0).toString(), "eventId", "senderId", "messageId", new DateTime(0), new DateTime(1)));
        return array;
    }
View Full Code Here

        UUID messageId = daos.getMessageAccess().getFreshId(con);
        Message message = new Message(messageId, subject, body, TimeUtil.getCurrentDateTime(), null);
        daos.getMessageAccess().put(con, message);

        String eventMessageId = daos.getEventMessageAccess().getFreshId(con);
        EventMessage eventMessage = new EventMessage(eventMessageId, eventId, sender.getId(), messageId.toString(), TimeUtil.getCurrentDateTime(), null);
        daos.getEventMessageAccess().put(con, eventMessage);

        List<UserTicket> participations = daos.getEnrollmentAccess().findByEventId(con, eventId, 0, Integer.MAX_VALUE);
        for (UserTicket participation : participations) {
            if (!participation.getStatus().isEnrolled())
View Full Code Here

        // 5つ取ってきて、制約を満たしているかどうか確認する。
        List<EventMessage> eventMessages = daos.getEventMessageAccess().findByEventId(con, eventId, 0, 5);

        if (eventMessages.size() >= 3) {
            EventMessage eventMessage = eventMessages.get(2);
            if (eventMessage != null) {
                DateTime msgDate = eventMessage.getCreatedAt();
                DateTime thresholdDate = new DateTime(msgDate.getTime() + 1000 * 60 * 60); // one hour later after the message was sent.
                if (currentTime.isBefore(thresholdDate)) // NG
                    throw new PartakeException(UserErrorCode.INVALID_MESSAGE_TOOMUCH);
            }
        }

        if (eventMessages.size() >= 5) {
            EventMessage eventMessage = eventMessages.get(2);
            if (eventMessage != null) {
                DateTime msgDate = eventMessage.getCreatedAt();
                DateTime thresholdDate = new DateTime(msgDate.getTime() + 1000 * 60 * 60 * 24); // one hour later after the message was sent.
                if (currentTime.isBefore(thresholdDate)) // NG
                    throw new PartakeException(UserErrorCode.INVALID_MESSAGE_TOOMUCH);
            }
        }
View Full Code Here

import org.codehaus.jackson.node.ObjectNode;

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

TOP

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

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.