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);
    }
  }
  private void createIndex_Resource(ResourceDetail resource) {
    SilverTrace.info(
        "resourceManager",
        "resourceManagerBmEJB.createIndex_Resource()",
        "root.MSG_GEN_ENTER_METHOD",
        "resource = " + resource.toString());
    FullIndexEntry indexEntry = null;

    if (resource != null) {
      // Index the Reservation
      indexEntry = new FullIndexEntry(resource.getInstanceId(), "Resource", resource.getId());
      indexEntry.setTitle(resource.getName());
      indexEntry.setPreView(resource.getDescription());
      if (resource.getUpdateDate() != null) indexEntry.setCreationDate(resource.getUpdateDate());
      else indexEntry.setCreationDate(resource.getCreationDate());
      indexEntry.setCreationUser(resource.getCreaterId());

      String categoryId = resource.getCategoryId();
      if (StringUtil.isDefined(categoryId)) {
        CategoryDetail category = getCategory(categoryId);
        if (category != null) {
          String xmlFormName = category.getForm();
          if (StringUtil.isDefined(xmlFormName)) {
            // indéxation du contenu du formulaire XML
            String xmlFormShortName =
                xmlFormName.substring(xmlFormName.indexOf("/") + 1, xmlFormName.indexOf("."));
            PublicationTemplate pubTemplate;
            try {
              pubTemplate =
                  PublicationTemplateManager.getInstance()
                      .getPublicationTemplate(resource.getInstanceId() + ":" + xmlFormShortName);
              RecordSet set = pubTemplate.getRecordSet();
              set.indexRecord(resource.getId(), xmlFormName, indexEntry);
            } catch (Exception e) {
              throw new ResourcesManagerRuntimeException(
                  "ResourceManagerBmEJB.createIndex_Resource()",
                  SilverpeasRuntimeException.ERROR,
                  "resourcesManager.EX_CREATE_INDEX_FAILED",
                  e);
            }
          }
        }
      }

      IndexEngineProxy.addIndexEntry(indexEntry);
    }
  }