Examples of CommentDTO


Examples of org.eurekastreams.server.search.modelview.CommentDTO

        assertEquals(5L, activityDTO.getFirstComment().getId());
        assertEquals(7, activityDTO.getLastComment().getId());

        // Create the insertRequest and insert the comment via sut.
        InsertActivityCommentRequest insertRequest = new InsertActivityCommentRequest(smithersId, activityId, is1000);
        CommentDTO result = sut.execute(insertRequest);

        // Grab entity id for later use
        long newCommentId = result.getId();

        // flush and clear entityManager before query the DB.
        getEntityManager().flush();
        getEntityManager().clear();

        // Query comment from DB to assert that record was inserted in.
        Comment comment = (Comment) getEntityManager().createQuery("FROM Comment where id = :commentId").setParameter(
                "commentId", newCommentId).getSingleResult();

        // verify correct values were inserted into DB.
        assertNotNull(comment);
        assertEquals(smithersId, comment.getAuthor().getId());
        assertEquals(activityId, comment.getTarget().getId());
        assertEquals(is1000, comment.getBody());

        // Get the activity DTO and assert is was updated correctly by sut.
        activityDTO = activityMapper.execute(activityIds).get(0);
        assertEquals(activityId, activityDTO.getId());
        assertEquals(4, activityDTO.getCommentCount());
        assertEquals(5L, activityDTO.getFirstComment().getId());
        assertEquals(newCommentId, activityDTO.getLastComment().getId());

        // Insert another comment to make sure first/last comment works.
        insertRequest.setContent("another comment");
        result = sut.execute(insertRequest);

        // Get the activity DTO and assert is was updated correctly.
        activityDTO = activityMapper.execute(activityIds).get(0);
        assertEquals(5L, activityDTO.getFirstComment().getId());
        assertEquals(result.getId(), activityDTO.getLastComment().getId());
    }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.CommentDTO

        // loop old-school style so no dependency on list iterator order.
        int numRequested = requestedIds.size();
        for (int x = 0; x < numRequested; x++)
        {
            CommentDTO temp = commentDTOMap.get(requestedIds.get(x));
            if (temp != null)
            {
                orderedResults.add(temp);
            }
        }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.CommentDTO

     *
     */
    @Override
    public CommentDTO execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext)
    {
        CommentDTO inRequest = (CommentDTO) inActionContext.getActionContext().getParams();

        long personId = inActionContext.getActionContext().getPrincipal().getId();
        long activityId = inRequest.getActivityId();
        CommentDTO results = insertCommentDAO.execute(new InsertActivityCommentRequest(personId, activityId, inRequest
                .getBody()));

        getNotificationUserRequests(personId, activityId, results.getId(), inActionContext.getUserActionRequests());

        return results;
    }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.CommentDTO

     * @return a new CommentDTO object.
     */
    @Override
    public CommentDTO buildModelView()
    {
        return new CommentDTO();
    }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.CommentDTO

     */
    @Override
    public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext)
    {
        // use a CommentDTO as input so this action can use the same authorizer as postActivityCommentAction
        CommentDTO inputComment = (CommentDTO) inActionContext.getActionContext().getParams();
        String inputText = inputComment.getBody();

        for (String piece : textSplitter.split(inputText))
        {
            CommentDTO thisComment = new CommentDTO();
            thisComment.setBody(piece);
            thisComment.setActivityId(inputComment.getActivityId());
            executor.execute(postCommentAction, inActionContext, thisComment);
        }
        return null;
    }
View Full Code Here

Examples of org.eurekastreams.server.search.modelview.CommentDTO

                new PostActivityRequest(activityToPost));

        // post the comments
        for (String piece : pieces.subList(1, pieces.size()))
        {
            CommentDTO thisComment = new CommentDTO();
            thisComment.setBody(piece);
            thisComment.setActivityId(postedActivity.getId());
            executor.execute(postCommentAction, inActionContext, thisComment);
        }

        return postedActivity.getId();
    }
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.