Package org.eurekastreams.server.search.modelview

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


     */
    @Test
    public void testFilterComments()
    {
        final ActivityDTO activity = context.mock(ActivityDTO.class);
        final CommentDTO firstComment = context.mock(CommentDTO.class, "firstComment");
        final CommentDTO lastComment = context.mock(CommentDTO.class, "lastComment");
       
        PersonModelView user = new PersonModelView();

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


        activity.setBaseObjectType(BaseObjectType.BOOKMARK);
        activity.setBaseObject(baseObject);

        final List<Long> commentIds = Arrays.asList(1L, 2L);

        CommentDTO comment1 = new CommentDTO();
        comment1.setBody("something something");

        CommentDTO comment2 = new CommentDTO();
        comment2.setBody("another comment");

        final List<CommentDTO> comments = Arrays.asList(comment1, comment2);

        CONTEXT.checking(new Expectations()
        {
            {
                oneOf(commentIdsByActivityIdDAO).execute(activity.getId());
                will(returnValue(commentIds));

                oneOf(commentsByIdDAO).execute(with(any(List.class)));
                will(returnValue(comments));
            }
        });

        assertEquals(description + " " + comment1.getBody() + " " + comment2.getBody() + constantKeywordComponent, sut
                .objectToString(activity).trim());
    }
View Full Code Here

        final ActivityDTO a1 = context.mock(ActivityDTO.class, "a1");
        final ActivityDTO a2 = context.mock(ActivityDTO.class, "a2");
        final ActivityDTO a3 = context.mock(ActivityDTO.class, "a3");
        final ActivityDTO a4 = context.mock(ActivityDTO.class, "a4");

        final CommentDTO c1 = context.mock(CommentDTO.class, "c1");
        final CommentDTO c2 = context.mock(CommentDTO.class, "c2");
        final CommentDTO c3 = context.mock(CommentDTO.class, "c3");
        final CommentDTO c4 = context.mock(CommentDTO.class, "c4");

        final PersonModelView p1 = context.mock(PersonModelView.class, "p1");
        final PersonModelView p3 = context.mock(PersonModelView.class, "p3");
        final PersonModelView p5 = context.mock(PersonModelView.class, "p5");
View Full Code Here

     * Test the translator.
     */
    @Test
    public void testTranslateActivityNotFound()
    {
        final CommentDTO comment = new CommentDTO();
        comment.setActivityId(ACTIVITY_ID);

        context.checking(new Expectations()
        {
            {
                oneOf(activityDAO).execute(ACTIVITY_ID);
View Full Code Here

     * Test.
     */
    @Test
    public void test()
    {
        final CommentDTO comment = mockery.mock(CommentDTO.class);
        mockery.checking(new Expectations()
        {
            {
                allowing(comment).getActivityId();
                will(returnValue(8L));
View Full Code Here

            {
                fullCollapse = false;
                if (!inactive)
                {
                    unActivate();
                    CommentDTO comment = new CommentDTO();
                    comment.setBody(commentBox.getText());
                    comment.setActivityId(messageId);
                    Session.getInstance().getActionProcessor()
                            .makeRequest("postActivityCommentAction", comment, new AsyncCallback<CommentDTO>()
                            {
                                /* implement the async call back methods */
                                public void onFailure(final Throwable caught)
View Full Code Here

        final String piece3 = "...as multiple comments.";

        PostSplitActivityCommentsExecution sut = new PostSplitActivityCommentsExecution(textSplitter, executor,
                postCommentAction);

        final CommentDTO params = mockery.mock(CommentDTO.class, "params");

        final TaskHandlerActionContext<PrincipalActionContext> context = TestContextCreator
                .createTaskHandlerContextWithPrincipal(params, "user", 8L);

        final Sequence seq = mockery.sequence("calls");
View Full Code Here

            final PersonModelView person)
    {
        // Activity ID -> Comment to activity
        if (tokenData.containsKey(TokenContentFormatter.META_KEY_ACTIVITY))
        {
            CommentDTO comment = new CommentDTO();
            comment.setBody(content);
            comment.setActivityId(tokenData.get(TokenContentFormatter.META_KEY_ACTIVITY));

            return new UserActionRequest("postSplitActivityCommentsAction", null, comment);
        }
        // ID of person -> Post to personal stream
        else if (tokenData.containsKey(TokenContentFormatter.META_KEY_PERSON_STREAM))
View Full Code Here

     * @throws ValidationException
     *             on validation error.
     */
    public void validate(final ActionContext inActionContext) throws ValidationException
    {
        CommentDTO request = (CommentDTO) inActionContext.getParams();

        if (request == null)
        {
            throw new ValidationException("A comment must be provided.");
        }

        if (StringUtils.isBlank(request.getBody()))
        {
            throw new ValidationException("Comment must contain body content.");
        }
    }
View Full Code Here

    {
        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

TOP

Related Classes of org.eurekastreams.server.search.modelview.CommentDTO

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.