public void saveTo(File f, XModelObject object) {
   XModelObject o = object.copy(1);
   XModelObject[] cs = o.getChildren();
   for (XModelObject c : cs) {
     if (c.getModelEntity().getName().equals("FileSystemJar")) { // $NON-NLS-1$
       o.removeChild(c);
     }
     if (!c.getAttributeValue(XModelObjectConstants.ATTR_NAME_LOCATION)
         .startsWith("%")) { // $NON-NLS-1$
       o.removeChild(c);
     }
   }
   util().save(f, o);
 }
 private XModelObject validateLib(XModelObject object) {
   XModelObject lib = object.getChildByPath("lib"); // $NON-NLS-1$
   if (lib == null) {
     XModelObject wi = object.getChildByPath("WEB-INF"); // $NON-NLS-1$
     if (wi == null) return null;
     XModelObject lb = wi.getChildByPath("lib"); // $NON-NLS-1$
     if (lb == null) return null;
     lib = wi.getModel().createModelObject(XModelObjectConstants.ENT_FILE_SYSTEM_FOLDER, null);
     lib.setAttributeValue(XModelObjectConstants.ATTR_NAME, "lib"); // $NON-NLS-1$
     lib.setAttributeValue(
         XModelObjectConstants.ATTR_NAME_LOCATION,
         wi.getAttributeValue(XModelObjectConstants.ATTR_NAME_LOCATION) + "/lib"); // $NON-NLS-1$
     object.addChild(lib);
     object.setModified(true);
   }
   return lib;
 }