コード例 #1
0
ファイル: SetupGrids.java プロジェクト: haruo31/langrid
 private static List<String> setupGrids(DaoFactory factory, File baseDir) throws Exception {
   baseDir = new File(baseDir, "grids");
   GridDao gdao = factory.createGridDao();
   DomainDao ddao = factory.createDomainDao();
   List<String> gridIds = new ArrayList<String>();
   for (File f : baseDir.listFiles(new RegexFileNameFilter(".*\\.json$"))) {
     Grid g =
         new LangridJSON(baseDir, FilenameUtil.getIdFromFileName(f))
             .parse(new FileInputStream(f), Grid.class);
     List<Domain> domains = new ArrayList<Domain>();
     for (Domain d : g.getSupportedDomains()) {
       domains.add(ddao.getDomain(d.getDomainId()));
     }
     g.getSupportedDomains().clear();
     g.getSupportedDomains().addAll(domains);
     gdao.addGrid(g);
     gridIds.add(g.getGridId());
   }
   return gridIds;
 }
コード例 #2
0
ファイル: SetupGrids.java プロジェクト: haruo31/langrid
 private static void clearAll(DaoFactory factory) throws Exception {
   factory.createServiceDao().clear();
   factory.createResourceDao().clear();
   factory.createUserDao().clear();
   factory.createGridDao().clear();
 }