예제 #1
0
 public static void hashPasswords() {
   List<User> users = User.findAll();
   for (User u : users) {
     u.password = Crypto.passwordHash(u.password);
     u.save();
   }
 }
예제 #2
0
  /** Method to be run at start */
  @SuppressWarnings("unused")
  public void doJob() {
    // Check if the database is empty
    if (User.count() == 0) {
      // The really handy YML file doesnt handle inheritance well
      // Fixtures.loadModels("data.yml");
      Physician bob = new Physician("*****@*****.**", "secret", "Bob", "Doctor").save();
      Physician george = new Physician("*****@*****.**", "secret", "George", "Test").save();
      Patient bill =
          new Patient(
                  "*****@*****.**",
                  "secret",
                  "Bill",
                  "Sick",
                  "123 Main Street",
                  "410-000-0000",
                  'M')
              .save();
      Patient harriet =
          new Patient(
                  "*****@*****.**",
                  "secret",
                  "Harriet",
                  "Blarg",
                  "124 Main Street",
                  "410-000-0001",
                  'F')
              .save();

      Exam exam1 = new Exam(bill, george, "Bill Sucks!", "Bob is awesome!", null).save();
      Exam exam2 = new Exam(harriet, bob, "Harriet is awesome!", "Bob is awesome!", null).save();
    }
  }
예제 #3
0
 public void doJob() {
   // Check if the database is empty
   if (User.count() == 0) {
     // Initial data of the plateform
     Fixtures.load("initial-data.yml");
   }
 }
예제 #4
0
  public static void initFriends() {
    List<User> users = User.findAll();
    for (User u : users) {
      u.friends.add(u);
      u.save();
    }
    User bob = User.findById(2L);
    User alice = User.findById(3L);
    User jeff = User.findById(4L);

    bob.friends.add(jeff);
    alice.friends.add(jeff);
    jeff.friends.add(bob);
    jeff.friends.add(alice);
    jeff.save();
  }
예제 #5
0
 public void doJob() throws FileNotFoundException, IOException {
   // Check if the database is empty
   if (User.count() == 0) {
     Fixtures.loadModels("default-data.yml"); // Default User
     // load in pictures
     Photo photo;
     String path = new java.io.File(".").getCanonicalPath() + "/public/images/";
     photo =
         Photos.initFileToPhoto(path + "GreenTaijitu.png", "By Chinneeb via Wikimedia Commons");
     peacePhotoID = photo.id;
     photo = Photos.initFileToPhoto(path + "default.png", "Default Profile Photo");
     defaultProfilePhotoID = photo.id;
     photo = Photos.initFileToPhoto(path + "headerBG.png", "Default Header Background Photo");
     defaultHeaderPhotoID = photo.id;
     photo =
         Photos.initFileToPhoto(path + "UT-Austin-Tower.jpg", "UT Austin via Wikimedia Commons");
     Fixtures.loadModels("skinTemplates.yml"); // initial data for skin templates
     Fixtures.loadModels("initial-data.yml"); // rest of the data
     hashPasswords();
     initFriends();
   }
 }
예제 #6
0
 public void doJob() {
   // Check if the database is empty
   if (User.count() == 0) {
     Fixtures.loadModels("data.yml");
   }
 }