public void deleteCategory(String id, String componentId) {
    Connection con = initCon();
    try {
      // First delete all resources of category
      List<ResourceDetail> resources = getResourcesByCategory(id);
      ResourceDetail resource;
      for (int r = 0; r < resources.size(); r++) {
        resource = resources.get(r);

        ResourcesManagerDAO.deleteResource(con, resource.getId());
        deleteIndex("Resource", resource.getId(), componentId);
      }

      // Then delete category itself
      ResourcesManagerDAO.deleteCategory(con, id);
      deleteIndex(id, "Category", componentId);
    } catch (Exception e) {
      throw new ResourcesManagerRuntimeException(
          "ResourcesManagerBmEJB.deleteCategory()",
          SilverpeasRuntimeException.ERROR,
          "resourcesManager.EX_DELETE_CATEGORY",
          e);
    } finally {
      fermerCon(con);
    }
  }
 public void deleteResource(String id, String componentId) {
   Connection con = initCon();
   try {
     ResourcesManagerDAO.deleteResource(con, id);
     deleteIndex(id, "Resource", componentId);
   } catch (Exception e) {
     throw new ResourcesManagerRuntimeException(
         "ResourcesManagerBmEJB.deleteResource()",
         SilverpeasRuntimeException.ERROR,
         "resourcesManager.EX_DELETE_RESOURCE",
         e);
   } finally {
     fermerCon(con);
   }
 }