示例#1
0
文件: Global.java 项目: unaor/Zentask
 @Override
 public void onStart(Application app) {
   // Check if the database is empty
   if (User.finder.findRowCount() == 0) {
     Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");
     Ebean.save(all.get("users"));
     Ebean.save(all.get("projects"));
     Ebean.save(all.get("tasks"));
   }
 }
示例#2
0
文件: Global.java 项目: msobon/portal
    public static void insert(Application app) {
      if (Ebean.find(User.class).findRowCount() == 0) {

        Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");

        // Insert users first
        Ebean.save(all.get("users"));

        // Insert tapps
        Ebean.save(all.get("apps"));

        //                // Insert projects
        //                Ebean.save(all.get("projects"));
        //                for(Object project: all.get("projects")) {
        //                    // Insert the project/user relation
        //                    Ebean.saveManyToManyAssociations(project, "members");
        //                }
        //
        //

      }
    }