Package models

Examples of models.Article


    ///////////////////////////////////////////////////////////////////////////
    // Show article
    ///////////////////////////////////////////////////////////////////////////
    public Result articleShow(@PathParam("id") Long id) {

        Article article = null;

        if (id != null) {

            article = articleDao.getArticle(id);
View Full Code Here


    }
   
   
    public Article getFirstArticleForFrontPage() {
       
        Article frontPost = objectify.get().load().type(Article.class).order("-postedAt").first()
                .now();
        return frontPost;
       
       
    }
View Full Code Here

    }
   
   
    public Article getArticle(Long id) {
       
        Article article = objectify.get().load().type(Article.class).filter("id", id).first()
                .now();
       
        return article;
       
    }
View Full Code Here

       
        if (user == null) {
            return false;
        }
       
        Article article = new Article(user, articleDto.title, articleDto.content);
        objectify.get().save().entity(article);
       
        return true;
       
    }
View Full Code Here

            // Create a new user and save it
            User bob = new User("bob@gmail.com", "secret", "Bob");
            ofy.save().entity(bob).now();

            // Create a new post
            Article bobPost3 = new Article(bob, "My third post", lipsum);
            ofy.save().entity(bobPost3).now();

            // Create a new post
            Article bobPost2 = new Article(bob, "My second post", lipsum);
            ofy.save().entity(bobPost2).now();

            // Create a new post
            Article bobPost1 = new Article(bob, post1Title, post1Content);
            ofy.save().entity(bobPost1).now();
        }

    }
View Full Code Here

        // Create a new user and save it
        User anotherBob = new User("another_bob@gmail.com", "secret", "Bob");
        ofy.save().entity(anotherBob).now();
       
        // Create a new post
        Article post = new Article(anotherBob, "My first post", "Hello world");
        ofy.save().entity(post).now();
            
        // Test that the post has been created
        assertNotNull(ofy.load().type(Article.class).first().now());
       
        // Retrieve all posts created by Bob
        List<Article> bobPosts = ofy.load().type(Article.class)
                .filter("authorIds",  anotherBob.id).list();

       
        // Tests
        assertEquals(1, bobPosts.size());
        Article firstPost = bobPosts.get(0);
        assertNotNull(firstPost);
        assertEquals(anotherBob.id, firstPost.authorIds.get(0));
        assertEquals("My first post", firstPost.title);
        assertEquals("Hello world", firstPost.content);
        assertNotNull(firstPost.postedAt);
View Full Code Here

    }
   
   
    public Article getFirstArticleForFrontPage() {
       
        Article frontPost = objectify.get().load().type(Article.class).order("-postedAt").first()
                .now();
        return frontPost;
       
       
    }
View Full Code Here

    }
   
   
    public Article getArticle(Long id) {
       
        Article article = objectify.get().load().type(Article.class).filter("id", id).first()
                .now();
       
        return article;
       
    }
View Full Code Here

       
        if (user == null) {
            return false;
        }
       
        Article article = new Article(user, articleDto.title, articleDto.content);
        objectify.get().save().entity(article);
       
        return true;
       
    }
View Full Code Here

            // Create a new user and save it
            User bob = new User("bob@gmail.com", "secret", "Bob");
            ofy.save().entity(bob).now();

            // Create a new post
            Article bobPost3 = new Article(bob, "My third post", lipsum);
            ofy.save().entity(bobPost3).now();

            // Create a new post
            Article bobPost2 = new Article(bob, "My second post", lipsum);
            ofy.save().entity(bobPost2).now();

            // Create a new post
            Article bobPost1 = new Article(bob, post1Title, post1Content);
            ofy.save().entity(bobPost1).now();
        }

    }
View Full Code Here

TOP

Related Classes of models.Article

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.