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); } }
private void createIndex_Category(CategoryDetail category) { SilverTrace.info( "resourceManager", "resourceManagerBmEJB.createIndex_Category()", "root.MSG_GEN_ENTER_METHOD", "category = " + category.toString()); FullIndexEntry indexEntry = null; if (category != null) { indexEntry = new FullIndexEntry(category.getInstanceId(), "Category", category.getId()); indexEntry.setTitle(category.getName()); indexEntry.setPreView(category.getDescription()); if (category.getUpdateDate() != null) indexEntry.setCreationDate(category.getUpdateDate()); else indexEntry.setCreationDate(category.getCreationDate()); indexEntry.setCreationUser(category.getCreaterId()); IndexEngineProxy.addIndexEntry(indexEntry); } }
/** * Gestion des catégories ** */ public void createCategory(CategoryDetail category) { Connection con = initCon(); try { int id = ResourcesManagerDAO.createCategory(con, category); category.setId(Integer.toString(id)); createIndex_Category(category); } catch (Exception e) { throw new ResourcesManagerRuntimeException( "ResourcesManagerBmEJB.createCategory()", SilverpeasRuntimeException.ERROR, "resourcesManager.EX_CREATE_CATEGORY", e); } finally { fermerCon(con); } }