/** * Adds a search index source configuration.<p> * * @param searchIndexSource a search index source configuration */ public void addSearchIndexSource(CmsSearchIndexSource searchIndexSource) { m_indexSources.put(searchIndexSource.getName(), searchIndexSource); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_SEARCH_INDEX_SOURCE_2, searchIndexSource.getName(), searchIndexSource.getIndexerClassName())); } }
/** * Adds a search index source configuration.<p> * * @param searchIndexSource a search index source configuration */ public void addSearchIndexSource(CmsSearchIndexSource searchIndexSource) { m_indexSources.put(searchIndexSource.getName(), searchIndexSource); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_SEARCH_INDEX_SOURCE_2, searchIndexSource.getName(), searchIndexSource.getIndexerClassName())); } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() { List<CmsListItem> result = new ArrayList<CmsListItem>(); // get content List<CmsSearchIndexSource> sources = searchIndexSources(); Iterator<CmsSearchIndexSource> itSources = sources.iterator(); CmsSearchIndexSource source; while (itSources.hasNext()) { source = itSources.next(); CmsListItem item = getList().newItem(source.getName()); item.set(LIST_COLUMN_NAME, source.getName()); item.set(LIST_COLUMN_INDEXER, source.getIndexer().getClass().getName()); result.add(item); } return result; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() { List<CmsListItem> result = new ArrayList<CmsListItem>(); // get content List<CmsSearchIndexSource> sources = searchIndexSources(); Iterator<CmsSearchIndexSource> itSources = sources.iterator(); CmsSearchIndexSource source; while (itSources.hasNext()) { source = itSources.next(); CmsListItem item = getList().newItem(source.getName()); // use "null" String to avoid exception if name is empty item.set(LIST_COLUMN_NAME, String.valueOf(source.getName())); item.set(LIST_COLUMN_INDEXER, source.getIndexer().getClass()); result.add(item); } return result; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() { List<CmsListItem> result = new ArrayList<CmsListItem>(); // get content // cannot use the returned map: unmodifyable List<CmsSearchIndexSource> allSources = new LinkedList<CmsSearchIndexSource>( OpenCms.getSearchManager().getSearchIndexSources().values()); allSources.removeAll(searchIndexSources()); Iterator<CmsSearchIndexSource> itSources = allSources.iterator(); CmsSearchIndexSource source; while (itSources.hasNext()) { source = itSources.next(); CmsListItem item = getList().newItem(source.getName()); item.set(LIST_COLUMN_NAME, source.getName()); item.set(LIST_COLUMN_INDEXER, source.getIndexer().getClass().getName()); result.add(item); } return result; }
/** * Commits the edited search index to the search manager.<p> */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { // if new create it first if (!m_searchManager.getSearchIndexSources().keySet().contains(m_indexsource.getName())) { m_searchManager.addSearchIndexSource(m_indexsource); } writeConfiguration(); } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
html.append(" <li>\n").append(" ").append("name : ").append(idxSource.getName()).append("\n"); html.append(" </li>");
/** * Creates the dialog HTML for all defined widgets of the named dialog (page).<p> * * This overwrites the method from the super class to create a layout variation for the widgets.<p> * * @param dialog the dialog (page) to get the HTML for * @return the dialog HTML for all defined widgets of the named dialog (page) */ @Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(512); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_NAME_0))); result.append(createWidgetTableStart()); result.append( key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_1, new Object[] {m_indexsource.getName()})); result.append(createWidgetTableEnd()); result.append(dialogBlockEnd()); } result.append(createWidgetTableEnd()); // See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets, // no dialog buttons (Ok, Cancel) will be visible.... result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2])); return result.toString(); }
/** * 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; } }
indexsourceElement.addElement(N_NAME).addText(searchIndexSource.getName());
indexsourceElement.addElement(N_NAME).addText(searchIndexSource.getName());
/** * Creates the list of widgets for this dialog.<p> */ @Override protected void defineWidgets() { super.defineWidgets(); // widgets to display // new indexsource if (m_indexsource.getName() == null) { addWidget(new CmsWidgetDialogParameter(m_indexsource, "name", PAGES[0], new CmsInputWidget())); } else { // existing indexsource addWidget(new CmsWidgetDialogParameter(m_indexsource, "name", PAGES[0], new CmsDisplayWidget())); } addWidget( new CmsWidgetDialogParameter( m_indexsource, "indexerClassName", "", PAGES[0], new CmsComboWidget(getIndexerClassWidgetConfiguration()), 1, 1)); }