Beispiel #1
0
 void renderMappers(Configuration cfg) throws IOException {
   for (EntityModel model : getAllModels()) {
     Map<String, Object> params = new HashMap<String, Object>();
     params.put("model", model);
     params.put("version", currentVersion());
     for (Query query : model.getSelectQueries()) {
       params.put("query", query);
       writeFile(
           defaultPackageName + ".mapper.cursor",
           model.getName() + query.getName() + "Mapper",
           getTemplate(cfg, "java", "cursorobjectmapper"),
           params);
     }
     params.put("prefix", "insert");
     params.put("suffix", "");
     writeFile(
         defaultPackageName + ".mapper.content.insert",
         model.getName() + "Mapper",
         getTemplate(cfg, "java", "contentvaluesmapper"),
         params);
     for (Query query : model.getUpdateQueries()) {
       params.put("prefix", "update");
       params.put("suffix", query.getName());
       writeFile(
           defaultPackageName + ".mapper.content.update",
           model.getName() + query.getName() + "Mapper",
           getTemplate(cfg, "java", "contentvaluesmapper"),
           params);
     }
   }
 }
Beispiel #2
0
 void renderModels(Configuration cfg) throws IOException {
   List<EntityModel> allModels = getAllModels();
   Map<String, Object> params = new HashMap<String, Object>();
   params.put("models", allModels);
   params.put("packageName", defaultPackageName + ".providers");
   params.put("authority", authority);
   params.put("version", currentVersion());
   writeFile(
       defaultPackageName + ".providers", "Schemas", getTemplate(cfg, "java", "schema"), params);
   for (EntityModel model : allModels) {
     if (!model.isRender()) continue;
     params = new HashMap<String, Object>();
     params.put("model", model);
     params.put("version", currentVersion());
     params.put("properties", model.getAllProperties(null));
     writeFile(
         model.getPackageName() + ".model",
         model.getName(),
         getTemplate(cfg, "java", "model"),
         params);
   }
 }