Package com.saasovation.collaboration.domain.model.forum

Examples of com.saasovation.collaboration.domain.model.forum.Discussion


    public void testAllPostsDataOfDiscussion() throws Exception {

        Forum forum = this.forumAggregate();
        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);

        Post[] posts = this.postAggregates(discussion);

        for (Post post : posts) {
            DomainRegistry.postRepository().save(post);
        }

        Collection<PostData> postsData =
                postQueryService.allPostsDataOfDiscussion(
                        forum.tenant().id(),
                        discussion.discussionId().id());

        assertNotNull(postsData);
        assertFalse(postsData.isEmpty());
        assertEquals(posts.length, postsData.size());
    }
View Full Code Here


    public void testPostDataOfId() throws Exception {

        Forum forum = this.forumAggregate();
        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);
        DomainRegistry.discussionRepository().save(discussion);

        Post post = this.postAggregate(discussion);
        DomainRegistry.postRepository().save(post);
View Full Code Here

        EventStreamId eventId = new EventStreamId(aTenant.id(), aDiscussionId.id());

        EventStream eventStream = this.eventStore().eventStreamSince(eventId);

        Discussion Discussion = new Discussion(eventStream.events(), eventStream.version());

        return Discussion;
    }
View Full Code Here

                    "A forum description.",
                    null);

        DomainRegistry.forumRepository().save(forum);

        Discussion discussion = this.discussionAggregate(forum);

        DomainRegistry.discussionRepository().save(discussion);

        DiscussionCommandResult result = new DiscussionCommandResult() {
            @Override
            public void resultingDiscussionId(String aDiscussionId) {
                discussionId = aDiscussionId;
            }
            @Override
            public void resultingPostId(String aPostId) {
                postId = aPostId;
            }
            @Override
            public void resultingInReplyToPostId(String aReplyToPostId) {
                throw new UnsupportedOperationException("Should not be reached.");
            }
        };

        discussionApplicationService
            .postToDiscussion(
                    discussion.tenant().id(),
                    discussion.discussionId().id(),
                    "authorId1",
                    "Post Test",
                    "Post test text...",
                    result);

        postApplicationService
            .moderatePost(
                discussion.tenant().id(),
                forum.forumId().id(),
                postId,
                forum.moderator().identity(),
                "Post Moderated Subject Test",
                "Post moderated text test...");

        Post post =
                DomainRegistry
                    .postRepository()
                    .postOfId(
                            discussion.tenant(),
                            new PostId(postId));

        assertNotNull(discussionId);
        assertNotNull(post);
        assertEquals("Post Moderated Subject Test", post.subject());
View Full Code Here

                this.discussionQueryService()
                    .discussionIdOfExclusiveOwner(
                            aTenantId,
                            anExclusiveOwner);

        Discussion discussion = null;

        if (discussionId != null) {
            discussion = this.discussionRepository()
                             .discussionOfId(
                                     tenant,
                                     new DiscussionId(discussionId));
        }

        if (discussion == null) {
            Author author =
                    this.collaboratorService().authorFrom(tenant, anAuthorId);

            discussion =
                    forum.startDiscussionFor(
                            this.forumIdentityService(),
                            author,
                            aDiscussionSubject,
                            anExclusiveOwner);

            this.discussionRepository().save(discussion);
        }

        if (aResult != null) {
            aResult.resultingForumId(forum.forumId().id());
            aResult.resultingDiscussionId(discussion.discussionId().id());
        }
    }
View Full Code Here

        this.forumIdentityService = aForumIdentityService;
        this.postRepository = aPostRepository;
    }

    public void closeDiscussion(String aTenantId, String aDiscussionId) {
        Discussion discussion =
                this.discussionRepository()
                    .discussionOfId(new Tenant(aTenantId),
                            new DiscussionId(aDiscussionId));

        discussion.close();

        this.discussionRepository().save(discussion);
    }
View Full Code Here

            String anAuthorId,
            String aSubject,
            String aBodyText,
            DiscussionCommandResult aDiscussionCommandResult) {

        Discussion discussion =
                this.discussionRepository()
                    .discussionOfId(new Tenant(aTenantId),
                            new DiscussionId(aDiscussionId));

        Author author =
                this.collaboratorService().authorFrom(new Tenant(aTenantId), anAuthorId);

        Post post = discussion.post(this.forumIdentityService(), author, aSubject, aBodyText);

        this.postRepository().save(post);

        aDiscussionCommandResult.resultingDiscussionId(aDiscussionId);
        aDiscussionCommandResult.resultingPostId(post.postId().id());
View Full Code Here

            String anAuthorId,
            String aSubject,
            String aBodyText,
            DiscussionCommandResult aDiscussionCommandResult) {

        Discussion discussion =
                this.discussionRepository()
                    .discussionOfId(new Tenant(aTenantId),
                            new DiscussionId(aDiscussionId));

        Author author =
                this.collaboratorService().authorFrom(new Tenant(aTenantId), anAuthorId);

        Post post =
                discussion.post(
                        this.forumIdentityService(),
                        new PostId(aReplyToPostId),
                        author,
                        aSubject,
                        aBodyText);
View Full Code Here

        aDiscussionCommandResult.resultingPostId(post.postId().id());
        aDiscussionCommandResult.resultingInReplyToPostId(aReplyToPostId);
    }

    public void reopenDiscussion(String aTenantId, String aDiscussionId) {
        Discussion discussion =
                this.discussionRepository()
                    .discussionOfId(new Tenant(aTenantId),
                            new DiscussionId(aDiscussionId));

        discussion.reopen();

        this.discussionRepository().save(discussion);
    }
View Full Code Here

TOP

Related Classes of com.saasovation.collaboration.domain.model.forum.Discussion

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.