Examples of EventComment


Examples of in.partake.model.dto.EventComment

        String eventId = new UUID(pkNumber, ("comment" + pkSalt).hashCode()).toString();
        String userId  = new UUID(objNumber, "user".hashCode()).toString();
        String comment = "";
        boolean isHTML = false;
        DateTime createdAt = new DateTime(objNumber);
        return new EventComment(uuid.toString(), eventId, userId, comment, isHTML, createdAt);
    }
View Full Code Here

Examples of in.partake.model.dto.EventComment

    @Override
    public List<EventComment> createSamples() {
        List<EventComment> list = new ArrayList<EventComment>();

        DateTime now = new DateTime(0);
        list.add(new EventComment("id", "eventId", "userId", "comment", false, now));
        list.add(new EventComment("id1", "eventId1", "userId", "comment", false, now));
        list.add(new EventComment("id", "eventId1", "userId", "comment", false, now));
        list.add(new EventComment("id", "eventId", "userId1", "comment", false, now));
        list.add(new EventComment("id", "eventId", "userId", "comment1", false, now));
        list.add(new EventComment("id", "eventId", "userId", "comment", true, now));
        list.add(new EventComment("id", "eventId", "userId", "comment", false, new DateTime(now.getTime() + 1)));

        return list;
    }
View Full Code Here

Examples of in.partake.model.dto.EventComment

        IEventCommentAccess dao = daos.getCommentAccess();
        dao.truncate(con);

        DateTime now = TimeUtil.getCurrentDateTime();

        dao.put(con, new EventComment(OWNER_COMMENT_ID, DEFAULT_EVENT_ID, EVENT_OWNER_ID, "comment", false, now));
        dao.put(con, new EventComment(EDITOR_COMMENT_ID, DEFAULT_EVENT_ID, EVENT_EDITOR_ID, "comment", false, now));
        dao.put(con, new EventComment(COMMENTOR_COMMENT_ID, DEFAULT_EVENT_ID, EVENT_COMMENTOR_ID, "comment", false, now));
        dao.put(con, new EventComment(UNRELATED_USER_COMMENT_ID, DEFAULT_EVENT_ID, EVENT_UNRELATED_USER_ID, "comment", false, now));
    }
View Full Code Here

Examples of in.partake.model.dto.EventComment

                String[][] ids = new String[10][10];

                for (int i = 0; i < 10; ++i) {
                    for (int j = 0; j < 10; ++j) {
                        ids[i][j] = UUID.randomUUID().toString();
                        EventComment original = new EventComment(ids[i][j], prefix + "eventId" + i, "userId", "comment content", false, TimeUtil.getCurrentDateTime());
                        daos.getCommentAccess().put(con, original);
                        TimeUtil.waitForTick();
                    }
                }

                for (int i = 0; i < 10; ++i) {
                    DataIterator<EventComment> it = daos.getCommentAccess().getCommentsByEvent(con, prefix + "eventId" + i);
                    try {
                        List<String> strs = new ArrayList<String>();
                        while (it.hasNext()) {
                            EventComment comment = it.next();
                            String id = comment.getId();
                            if (id == null) { continue; }
                            strs.add(id);
                        }
                        Assert.assertEquals(10, strs.size());
View Full Code Here

Examples of in.partake.model.dto.EventComment

                String[] ids = new String[10];
                // create
                for (int i = 0; i < 10; ++i) {
                    ids[i] = UUID.randomUUID().toString();
                    EventComment original = new EventComment(ids[i], prefix + "eventId", "userId", "comment content", false, TimeUtil.getCurrentDateTime());
                    daos.getCommentAccess().put(con, original);
                }

                // update
                {
                    DataIterator<EventComment> it = daos.getCommentAccess().getCommentsByEvent(con, prefix + "eventId");
                    try {
                        while (it.hasNext()) {
                            EventComment comment = it.next();

                            EventComment updated = new EventComment(comment);
                            updated.setComment("New comment!");

                            it.update(updated);
                        }
                    } finally {
                        it.close();
                    }
                }
                // get them
                {
                    DataIterator<EventComment> it = daos.getCommentAccess().getCommentsByEvent(con, prefix + "eventId");
                    try {
                        while (it.hasNext()) {
                            EventComment comment = it.next();
                            Assert.assertEquals("New comment!", comment.getComment());
                        }
                    } finally {
                        it.close();
                    }
                }
View Full Code Here

Examples of in.partake.model.dto.EventComment

        this.commentId = commentId;
    }

    @Override
    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

Examples of in.partake.model.dto.EventComment

        if (StringUtils.isBlank(comment))
            return renderInvalid(UserErrorCode.MISSING_COMMENT);
        if (comment.length() > MAX_COMMENT_LENGTH)
            return renderInvalid(UserErrorCode.INVALID_COMMENT_TOOLONG);

        EventComment embryo = new EventComment(null, eventId, user.getId(), comment, true, TimeUtil.getCurrentDateTime());
        new PostCommentTransaction(embryo).execute();

        return renderOK();
    }
View Full Code Here

Examples of in.partake.model.dto.EventComment

    // ----------------------------------------------------------------------
    // Comments

    public static EventCommentEx getCommentEx(PartakeConnection con, IPartakeDAOs daos, String commentId) throws DAOException {
        EventComment comment = daos.getCommentAccess().find(con, commentId);
        if (comment == null) { return null; }
        UserEx user = UserDAOFacade.getUserEx(con, daos, comment.getUserId());
        if (user == null) { return null; }
        return new EventCommentEx(comment, user);
    }
View Full Code Here

Examples of in.partake.model.dto.EventComment

        DataIterator<EventComment> iterator = daos.getCommentAccess().getCommentsByEvent(con, eventId);
        try {
            if (iterator == null) { return result; }

            while (iterator.hasNext()) {
                EventComment comment = iterator.next();
                if (comment == null) { continue; }
                String commentId = comment.getId();
                if (commentId == null) { continue; }
                EventCommentEx commentEx = getCommentEx(con, daos, commentId);
                if (commentEx == null) { continue; }
                result.add(commentEx);
            }
View Full Code Here

Examples of in.partake.model.dto.EventComment

import in.partake.model.dao.postgres9.Postgres9StatementAndResultSet;
import in.partake.model.dto.EventComment;

class EntityCommentMapper extends Postgres9EntityDataMapper<EventComment> {
    public EventComment map(ObjectNode obj) {
        return new EventComment(obj).freeze();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.