/** * Creates a "dummy" search index that is not linked to the search manager and has * a <code>null</code> name property that will be used for being filled with * the widget bean technology. <p> * * @return a "dummy" search index that is not linked to the search manager and has * a <code>null</code> name property that will be used for being filled with * the widget bean technology */ private CmsSearchIndex createDummySearchIndex() { CmsSearchIndex result = new CmsSearchIndex(); result.setLocale(Locale.ENGLISH); result.setProject("Online"); result.setRebuildMode("auto"); // find default source Map<String, CmsSearchIndexSource> sources = m_searchManager.getSearchIndexSources(); if (sources.isEmpty()) { CmsSearchIndexSource source = createDummyIndexSource(); sources.put(source.getName(), source); } result.addSourceName(sources.keySet().iterator().next()); return result; } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { CmsSearchManager searchManager = OpenCms.getSearchManager(); CmsListItem item = getSelectedItem(); String indexsourceName = (String)item.get(LIST_COLUMN_NAME); String action = getParamListAction(); if (action.equals(LIST_ACTION_ADDSOURCE) || action.equals(LIST_COLUMN_ADDSOURCE2)) { CmsSearchIndex idx = searchManager.getIndex(getParamIndexName()); idx.addSourceName(indexsourceName); try { idx.initialize(); } catch (CmsSearchException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } refreshList(); writeConfiguration(false); } else if (action.equals(CmsSearchIndexSourceControlList.LIST_ACTION_OVERVIEW_INDEXSOURCE)) { // action currently unused (not triggered by a column any more) Map<String, String[]> params = new HashMap<String, String[]>(); // forward to the edit indexsource screen params.put(A_CmsEditIndexSourceDialog.PARAM_INDEXSOURCE, new String[] {indexsourceName}); params.put(PARAM_STYLE, new String[] {CmsToolDialog.STYLE_NEW}); getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource", params); } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions() */ @Override public void executeListMultiActions() { CmsSearchManager searchManager = OpenCms.getSearchManager(); CmsListItem item = getSelectedItem(); if (getParamListAction().equals(LIST_MACTION_ADDSOURCE)) { // execute the delete multiaction Iterator<CmsListItem> itItems = getSelectedItems().iterator(); String indexSource; CmsSearchIndex idx = searchManager.getIndex(getParamIndexName()); while (itItems.hasNext()) { item = itItems.next(); indexSource = (String)item.get(LIST_COLUMN_NAME); idx.addSourceName(indexSource); } try { idx.initialize(); } catch (CmsSearchException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } writeConfiguration(false); refreshList(); } listSave(); }