Package org.qi4j.samples.forum.data.entity

Examples of org.qi4j.samples.forum.data.entity.Post


        @Structure
        Module module;

        public Post reply( String message, PostView viewPost )
        {
            Post post = module.currentUnitOfWork().newEntity( Post.class );
            post.message().set( message );
            post.createdBy().set( poster.self() );
            post.createdOn().set( new Date( module.currentUnitOfWork().currentTime() ) );
            post.replyTo().set( viewPost.self() );

            self().lastPost().set( post );
            Numbers.add( self().postCount(), 1 );

            return post;
View Full Code Here


        {
            Topic topic = module.currentUnitOfWork().newEntity( Topic.class );

            topic.subject().set( subject );

            Post post = module.currentUnitOfWork().newEntity( Post.class );
            post.message().set( message );

            // Moderation checks
            if( boardModeration.isModerator( poster ) )
            {
                post.status().set( Post.Status.POSTED );

                self.lastPost().set( post );
                add( self.topicCount(), 1 );
                add( self.postCount(), 1 );

                return topic;
            }
            else
            {
                post.status().set( Post.Status.MODERATION );
            }

            return topic;
        }
View Full Code Here

TOP

Related Classes of org.qi4j.samples.forum.data.entity.Post

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.