예제 #1
0
 private static void setupResources(DaoFactory factory, String gridId, File baseDir)
     throws Exception {
   baseDir = new File(new File(new File(baseDir, "grids"), gridId), "resources");
   ResourceDao dao = factory.createResourceDao();
   for (File f : baseDir.listFiles(new RegexFileNameFilter(".*\\.json$"))) {
     Resource r =
         new LangridJSON(baseDir, FilenameUtil.getIdFromFileName(f))
             .parse(new FileInputStream(f), Resource.class);
     for (ResourceAttribute a : r.getAttributes()) {
       a.setGridId(r.getGridId());
       a.setResourceId(r.getResourceId());
     }
     dao.addResource(r);
   }
 }
예제 #2
0
 @Override
 protected EqualsBuilder appendSpecialEquals(
     EqualsBuilder builder, Object value, Collection<String> appendedFields, boolean ignoreDates) {
   Resource s = (Resource) value;
   EqualsBuilder b = super.appendSpecialEquals(builder, value, appendedFields, ignoreDates);
   appendedFields.add("attributes");
   if (!ignoreDates) {
     EqualsBuilderUtil.appendAsSet(b, getAttributes(), s.getAttributes());
     return b;
   }
   try {
     EqualsBuilderUtil.appendAsSet(
         b, getAttributes(), s.getAttributes(), ResourceAttribute.class, "equalsIgnoreDates");
     return b;
   } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
   } catch (InvocationTargetException e) {
     throw new RuntimeException(e);
   } catch (NoSuchMethodException e) {
     throw new RuntimeException(e);
   }
 }