Package models

Examples of models.User.save()


public class Accounts extends Controller {
  public static void settingsPost(boolean periodicSort) {
      checkAuthenticity();
      User user = Login.getUser();
      user.periodicSort = periodicSort;
      user.save();
      if (periodicSort) {
        flash.success("Periodic sort enabled.");
      } else {
        flash.success("Periodic sort disabled.");
      }
View Full Code Here


            }

          u.sortingFolder = folder;
          String createdFolderMsg = createdFolder ? " This folder didn't exist, so we created it for you." : "";
          flash.success("%s is now your sorting folder.%s", folder, createdFolderMsg);
          u.save();
          Logger.info("Updated sorting folder to %s", folder);
          settings();
        } catch (InvalidTokenException e) {
            Logger.error(e, "Bad token when trying to update sorting folder to '%s' for user %s", folder, u);
            Login.logout();
View Full Code Here

     @Test
    public void checkFieldAccessibility() throws Exception {
        User u = new User();
        u.name = "alex";
        u.photo = blob;
        u.save();

        Object name = u.getClass().getField("name").get(u);
        assertNotNull(name);
        assertEquals("alex", name);;
View Full Code Here

    @Test
    public void testStoreUser() {
        User u = new User();
        u.name = "alex";
        assertTrue(u.isNew());
        u.save();

        assertFalse(u.isNew());
        assertEquals("alex", u.name);
        assertNull(u.photo);
    }
View Full Code Here

    public void testStoreUserWithAttachment() throws IOException {
        User u = new User();
        u.name = "alex";
        u.photo = blob;
        assertTrue(u.isNew());
        u = u.save();

        assertFalse(u.isNew());
        assertEquals("alex", u.name);

        assertNotNull(u.photo);
View Full Code Here

    @Test
    public void testDeleteBlob() throws Exception {
        User u = new User();
        u.name = "alex";
        u.photo = blob;
        u.save();

        GridFSDBFile file = Blob.findFile(u.getBlobFileName("photo"));
       
        assertThatPhotoBlobIsValid(file);
        u.delete();
View Full Code Here

    public void testBatchDeleteBlob() throws Exception {
        User a = new User();
        a.name = "alex";
        a.tag = "testing";
        a.photo = newBlob();
        a.save();

        User b = new User();
        b.name = "bob";
        b.tag = "testing";
        b.photo = newBlob();
View Full Code Here

        User b = new User();
        b.name = "bob";
        b.tag = "testing";
        b.photo = newBlob();
        b.save();
       
        GridFSDBFile file = Blob.findFile(a.getBlobFileName("photo"));
        assertThatPhotoBlobIsValid(file);

        file = Blob.findFile(b.getBlobFileName("photo"));
View Full Code Here

        file = Blob.findFile(b.getBlobFileName("photo"));
        assertThatPhotoBlobIsValid(file);
       
        b.photo = newBlob("test/user.png");
        b.save();
        file = Blob.findFile(b.getBlobFileName("photo"));
        assertThatPhotoBlobIsValid(file, "user.png");

        User.q("tag", "testing").delete();
       
View Full Code Here

    @Test
    public void test() {
        User user = new User();
        user.name = "alex";
        user.photo = newBlob("test/googlelogo.png");
        user.save();

        user.photo = newBlob("test/user.png");
        user.save();
       
        String name = user.getBlobFileName("photo");
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.