Package com.googlecode.objectify

Examples of com.googlecode.objectify.Objectify.load()


            LOG.info("userId is null, so trying to obtain it from the datastore.");
            AppEngineUser appEngineUser = new AppEngineUser(user);
            ofy().save().entity(appEngineUser).now();
            // Begin new session for not using session cache.
            Objectify objectify = ofy().factory().begin();
            AppEngineUser savedUser = objectify.load().key(appEngineUser.getKey()).now();
            userId = savedUser.getUser().getUserId();
            LOG.info("Obtained the userId: " + userId);
        }
        return userId;
    }
View Full Code Here


    public static void setup() {

        String lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit sed nisl sed lorem commodo elementum in a leo. Aliquam erat volutpat. Nulla libero odio, consectetur eget rutrum ac, varius vitae orci. Suspendisse facilisis tempus elit, facilisis ultricies massa condimentum in. Aenean id felis libero. Quisque nisl eros, accumsan eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula.";

        Objectify ofy = ObjectifyService.ofy();
        User user = ofy.load().type(User.class).first().now();

        if (user == null) {

            // Create a new user and save it
            User bob = new User("bob@gmail.com", "secret", "Bob");
View Full Code Here

        // 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();
View Full Code Here

            
        // 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());
View Full Code Here

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

        // Retrieve the user with e-mail address bob@gmail.com
        User bob = ofy.load().type(User.class).filter("username", "bob@gmail.com").first().get();

        // Test
        assertNotNull(bob);
        assertEquals("Bob", bob.fullname);
    }
View Full Code Here

    public static void setup() {

        String lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit sed nisl sed lorem commodo elementum in a leo. Aliquam erat volutpat. Nulla libero odio, consectetur eget rutrum ac, varius vitae orci. Suspendisse facilisis tempus elit, facilisis ultricies massa condimentum in. Aenean id felis libero. Quisque nisl eros, accumsan eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula. eget ornare id, pharetra eget felis. Aenean purus erat, egestas nec scelerisque non, eleifend id ligula.";

        Objectify ofy = ObjectifyService.ofy();
        User user = ofy.load().type(User.class).first().now();

        if (user == null) {

            // Create a new user and save it
            User bob = new User("bob@gmail.com", "secret", "Bob");
View Full Code Here

        // 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();
View Full Code Here

            
        // 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());
View Full Code Here

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

        // Retrieve the user with e-mail address bob@gmail.com
        User bob = ofy.load().type(User.class).filter("username", "bob@gmail.com").first().get();

        // Test
        assertNotNull(bob);
        assertEquals("Bob", bob.fullname);
    }
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.