private void doResource(Session hSession, MSystem hSystem) throws HibernateException {
    MetadataTable tResource = getMetadataTable(MetadataTable.RESOURCE);

    Set hResources = new HashSet();
    List resources = tResource.getDataRows("");
    Iterator i = resources.iterator();
    while (i.hasNext()) {
      Metadata md = (Metadata) i.next();
      Resource hResource = new Resource();

      hResource.setSystem(hSystem);
      String resourceID = md.getAttribute("ResourceID");
      hResource.setResourceID(resourceID);
      hResource.setStandardName(
          ResourceStandardNameEnum.fromString(md.getAttribute("StandardName")));
      hResource.setVisibleName(md.getAttribute("VisibleName"));
      hResource.setDescription(md.getAttribute("Description"));
      hResource.setKeyField(md.getAttribute("KeyField"));

      hResource.updateLevel();

      hSession.save(hResource);
      hResources.add(hResource);
      mResources.put(hResource.getPath(), hResource);
    }

    hSystem.setResources(hResources);
    hSession.saveOrUpdate(hSystem);
  }
 public static String toString(ResourceStandardNameEnum rsne) {
   return toString(rsne.toInt());
 }