Examples of CommentDTO


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

    {
        final long commentId = (Long) inActionContext.getParams();
        String currentUserAccountId = inActionContext.getPrincipal().getAccountId();

        // grab the comment in take action on.
        final CommentDTO comment = getCommentById(commentId);

        // Use CommentDeletePropertyStrategy to set Deletable flag on
        // comment appropriately.
        commentDeletableSetter.execute(currentUserAccountId, getParentActivity(comment, currentUserAccountId),
                new ArrayList<CommentDTO>()
                {
                    {
                        add(comment);
                    }
                });

        // If unable to delete, throw access exception.
        if (!comment.isDeletable())
        {
            // if you get to this point, "No soup for you!".
            throw new AuthorizationException("Current user does not have permissions to modify comment id: "
                    + commentId);
        }
View Full Code Here

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

    @Override
    protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson)
    {
        boolean isUpdated = false;

        CommentDTO firstComment = inActivityDTO.getFirstComment();
        CommentDTO lastComment = inActivityDTO.getLastComment();

        // check the first comment embedded in the activity dto
        if (isAuthoredByPerson(firstComment, inPerson))
        {
            for (UpdateCommentDTOFromPerson updater : commentUpdaters)
View Full Code Here

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

    public void testExecuteWithNewDisplayName()
    {
        final String oldDisplayName = "sdlfjsdfkdfjsdf";
        final String newDisplayName = "dksdkdkdkdk";

        final CommentDTO comment = context.mock(CommentDTO.class);
        final Person person = context.mock(Person.class);

        context.checking(new Expectations()
        {
            {
View Full Code Here

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

    public void testExecuteWithSameDisplayName()
    {
        final String oldDisplayName = "sdlfjsdfkdfjsdf";
        final String newDisplayName = oldDisplayName;

        final CommentDTO comment = context.mock(CommentDTO.class);
        final Person person = context.mock(Person.class);

        context.checking(new Expectations()
        {
            {
View Full Code Here

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

    public void testExecuteWithNewAvatarId()
    {
        final String oldAvatarId = "sdlfjsdfkdfjsdf";
        final String newAvatarId = "dksdkdkdkdk";

        final CommentDTO comment = context.mock(CommentDTO.class);
        final Person person = context.mock(Person.class);

        context.checking(new Expectations()
        {
            {
View Full Code Here

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

    public void testExecuteWithSameAvatarId()
    {
        final String oldAvatarId = "sdlfjsdfkdfjsdf";
        final String newAvatarId = oldAvatarId;

        final CommentDTO comment = context.mock(CommentDTO.class);
        final Person person = context.mock(Person.class);

        context.checking(new Expectations()
        {
            {
View Full Code Here

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

     */
    @Override
    public Boolean execute(final Long inCommentId)
    {
        // get comment to delete (need this to get activity that comment is associated with).
        CommentDTO comment = getCommentById(inCommentId);

        // short circuit here if comment to delete is not present.
        if (comment == null)
        {
            return true;
        }

        long activityId = comment.getActivityId();

        // delete comment from DB.
        getEntityManager().createQuery("DELETE FROM Comment WHERE id = :commentId").setParameter("commentId",
                inCommentId).executeUpdate();

View Full Code Here

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

                activity,
                inRequest.getContent().trim());
       
        getEntityManager().persist(comment);
       
        CommentDTO commentDTO = new CommentDTO();
        commentDTO.setActivityId(inRequest.getActivityId());
        commentDTO.setAuthorId(inRequest.getUserId());
        commentDTO.setId(comment.getId());
        commentDTO.setTimeSent(comment.getTimeSent());
        commentDTO.setBody(inRequest.getContent());
       
        //fully popluate and cache the commentDTO
        commentDTOPopulator.execute(commentDTO, getCache());
       
        //if present update activityDTO in cache.
        String activityDTOKey = CacheKeys.ACTIVITY_BY_ID + inRequest.getActivityId();
        ActivityDTO activityDTO = (ActivityDTO) getCache().get(activityDTOKey);
        if (activityDTO != null)
        {
            if (activityDTO.getCommentCount() == 0)
            {
                activityDTO.setFirstComment(commentDTO);
            }
            else
            {
                activityDTO.setLastComment(commentDTO);
            }
            activityDTO.setCommentCount(activityDTO.getCommentCount() + 1);
            getCache().set(activityDTOKey, activityDTO);
        }
       
        //if present, update commentId list for activity in cache.
        String commentIdListKey = CacheKeys.COMMENT_IDS_BY_ACTIVITY_ID + inRequest.getActivityId();
        List<Long> commentIds = getCache().getList(commentIdListKey);
        if (commentIds != null)
        {
            commentIds.add(commentDTO.getId());
            getCache().setList(commentIdListKey, commentIds)
        }
       
        commentDTO.setDeletable(true);

        Search.getFullTextSession((Session) getEntityManager().getDelegate()).index(activity);
       
        return commentDTO;
    }
View Full Code Here

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

            activity.getBaseObjectProperties().put("originalActivityId", String.valueOf(originalActivity.getId()));
        }
        activity.setBaseObjectType(originalActivity.getBaseObjectType());
        if (commentBody != null && commentBody.length() > 0)
        {
            CommentDTO sharedActivityComment = new CommentDTO();
            sharedActivityComment.setBody(commentBody);
            List<CommentDTO> comments = new ArrayList<CommentDTO>();
            comments.add(sharedActivityComment);
            activity.setFirstComment(sharedActivityComment);
            activity.setComments(comments);
            activity.setCommentCount(comments.size());
View Full Code Here

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

                add(activityId);
            }
        }).get(0);

        cache.set(CacheKeys.ACTIVITY_BY_ID + activityId, activity);
        cache.set(CacheKeys.COMMENT_BY_ID + 1, new CommentDTO());
        cache.set(CacheKeys.COMMENT_BY_ID + 3, new CommentDTO());
    }
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.