001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.workplace.tools.searchindex;
029
030import org.opencms.configuration.CmsSearchConfiguration;
031import org.opencms.i18n.CmsMessageContainer;
032import org.opencms.jsp.CmsJspActionElement;
033import org.opencms.main.CmsLog;
034import org.opencms.main.OpenCms;
035import org.opencms.search.CmsSearchDocumentType;
036import org.opencms.search.CmsSearchIndexSource;
037import org.opencms.search.CmsSearchManager;
038import org.opencms.workplace.list.A_CmsListDialog;
039import org.opencms.workplace.list.CmsListColumnAlignEnum;
040import org.opencms.workplace.list.CmsListColumnDefinition;
041import org.opencms.workplace.list.CmsListDefaultAction;
042import org.opencms.workplace.list.CmsListDirectAction;
043import org.opencms.workplace.list.CmsListItem;
044import org.opencms.workplace.list.CmsListItemDetails;
045import org.opencms.workplace.list.CmsListItemDetailsFormatter;
046import org.opencms.workplace.list.CmsListMetadata;
047import org.opencms.workplace.list.CmsListMultiAction;
048import org.opencms.workplace.list.CmsListOrderEnum;
049import org.opencms.workplace.tools.CmsToolDialog;
050
051import java.io.IOException;
052import java.util.ArrayList;
053import java.util.HashMap;
054import java.util.Iterator;
055import java.util.LinkedList;
056import java.util.List;
057import java.util.Map;
058
059import javax.servlet.ServletException;
060import javax.servlet.http.HttpServletRequest;
061import javax.servlet.http.HttpServletResponse;
062import javax.servlet.jsp.PageContext;
063
064import org.apache.commons.logging.Log;
065
066/**
067 * A list that displays information about the <code>{@link org.opencms.search.CmsSearchIndexSource}</code>
068 * that are members of the <code>{@link org.opencms.search.CmsSearchIndex}</code>
069 * in the current request scope (param "searchindex").<p>
070 *
071 * Unlike <code>{@link org.opencms.workplace.tools.searchindex.CmsSearchIndexSourceList}</code>
072 * this list is stand-alone displayable (not to embed in another dialog) and
073 * offers single actions within the rows related to the current selected indexsource
074 * which has to be found by the <b>request parameter <code></code></b>.
075 *
076 * @since 6.0.0
077 */
078public class CmsSearchIndexSourceControlList extends A_CmsListDialog {
079
080    /** list action dummy id constant. */
081    public static final String LIST_ACTION_DELETE = "ade";
082
083    /** list action dummy id constant. */
084    public static final String LIST_ACTION_DOCUMENTS = "ado";
085
086    /** list action dummy id constant. */
087    public static final String LIST_ACTION_EDIT = "ae";
088
089    /** list action dummy id constant. */
090    public static final String LIST_ACTION_OVERVIEW_INDEXSOURCE = "aois";
091
092    /**
093     * List action dummy id constant. <p>
094     *
095     * This is meant to be used for the same action as
096     * <code>{@link #LIST_ACTION_OVERVIEW_INDEXSOURCE}</code> but has to be used if
097     * within one list two columns shall trigger the same action...<p>
098     **/
099    public static final String LIST_ACTION_OVERVIEW_INDEXSOURCE2 = "aois2";
100
101    /** list action dummy id constant. */
102    public static final String LIST_ACTION_RESOURCES = "ar";
103
104    /** list column id constant. */
105    public static final String LIST_COLUMN_DELETE = "cde";
106
107    /** list item detail id constant. */
108    public static final String LIST_COLUMN_DOCUMENTS = "cdo";
109
110    /** list column id constant. */
111    public static final String LIST_COLUMN_EDIT = "ce";
112
113    /** list column id constant. */
114    public static final String LIST_COLUMN_INDEXER = "ca";
115
116    /** list column id constant. */
117    public static final String LIST_COLUMN_NAME = "cn";
118
119    /** list column id constant. */
120    public static final String LIST_COLUMN_RESOURCES = "cr";
121
122    /** list item detail id constant. */
123    public static final String LIST_DETAIL_DOCTYPES = "dd";
124
125    /** list item detail id constant. */
126    public static final String LIST_DETAIL_RESOURCES = "dr";
127
128    /** list id constant. */
129    public static final String LIST_ID = "lssisc";
130
131    /** list action id constant. */
132    public static final String LIST_MACTION_DELETESOURCE = "mad";
133
134    /** The list icon for a folder resource of a indexsource-documenttype. **/
135    protected static final String ICON_FOLDER = "tools/searchindex/icons/small/indexsource-resources.png";
136
137    /** The log object for this class. */
138    private static final Log LOG = CmsLog.getLog(CmsSearchIndexSourceControlList.class);
139
140    /**
141     * Public constructor.<p>
142     *
143     * @param jsp an initialized JSP action element
144     */
145    public CmsSearchIndexSourceControlList(CmsJspActionElement jsp) {
146
147        this(jsp, LIST_ID, Messages.get().container(Messages.GUI_LIST_INDEXSOURCES_NAME_0));
148    }
149
150    /**
151     * Public constructor.<p>
152     *
153     * @param jsp an initialized JSP action element
154     * @param listId the id of the list
155     * @param listName the list name
156     */
157    public CmsSearchIndexSourceControlList(CmsJspActionElement jsp, String listId, CmsMessageContainer listName) {
158
159        this(jsp, listId, listName, LIST_COLUMN_NAME, CmsListOrderEnum.ORDER_ASCENDING, null);
160    }
161
162    /**
163     * Public constructor.<p>
164     *
165     * @param jsp an initialized JSP action element
166     * @param listId the id of the displayed list
167     * @param listName the name of the list
168     * @param sortedColId the a priory sorted column
169     * @param sortOrder the order of the sorted column
170     * @param searchableColId the column to search into
171     */
172    public CmsSearchIndexSourceControlList(
173        CmsJspActionElement jsp,
174        String listId,
175        CmsMessageContainer listName,
176        String sortedColId,
177        CmsListOrderEnum sortOrder,
178        String searchableColId) {
179
180        super(jsp, listId, listName, sortedColId, sortOrder, searchableColId);
181
182    }
183
184    /**
185     * Public constructor.<p>
186     *
187     * Public constructor with JSP variables.<p>
188     *
189     * @param context the JSP page context
190     * @param req the JSP request
191     * @param res the JSP response
192     */
193    public CmsSearchIndexSourceControlList(PageContext context, HttpServletRequest req, HttpServletResponse res) {
194
195        this(new CmsJspActionElement(context, req, res));
196    }
197
198    /**
199     * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
200     */
201    @Override
202    public void executeListMultiActions() {
203
204        CmsSearchManager searchManager = OpenCms.getSearchManager();
205        if (getParamListAction().equals(LIST_MACTION_DELETESOURCE)) {
206            // execute the delete multiaction
207            Iterator<CmsListItem> itItems = getSelectedItems().iterator();
208            CmsListItem listItem;
209            CmsSearchIndexSource idxsource;
210            while (itItems.hasNext()) {
211                listItem = itItems.next();
212                idxsource = searchManager.getIndexSource((String)listItem.get(LIST_COLUMN_NAME));
213                searchManager.removeSearchIndexSource(idxsource);
214            }
215            refreshList();
216            writeConfiguration(false);
217        }
218        listSave();
219    }
220
221    /**
222     * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
223     */
224    @Override
225    public void executeListSingleActions() throws IOException, ServletException {
226
227        String indexSource = getSelectedItem().getId();
228
229        Map<String, String[]> params = new HashMap<String, String[]>();
230        params.put(A_CmsEditIndexSourceDialog.PARAM_INDEXSOURCE, new String[] {indexSource});
231        params.put(PARAM_STYLE, new String[] {CmsToolDialog.STYLE_NEW});
232        params.put(PARAM_ACTION, new String[] {DIALOG_INITIAL});
233
234        String action = getParamListAction();
235        if (action.equals(LIST_ACTION_EDIT)) {
236            // forward to the edit indexsource screen
237            getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource/edit", params);
238        } else if (action.equals(LIST_ACTION_DELETE)) {
239            // forward to the delete indexsource screen
240            getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource/delete", params);
241        } else if (action.equals(LIST_ACTION_RESOURCES)) {
242            // forward to the assign resources to indexsource screen
243            getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource/resources", params);
244        } else if (action.equals(LIST_ACTION_DOCUMENTS)) {
245            // forward to the assign document types to indexsource screen
246            getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource/doctypes", params);
247        } else if (action.equals(LIST_ACTION_OVERVIEW_INDEXSOURCE)) {
248            // forward to the index overview screen
249            getToolManager().jspForwardTool(this, "/searchindex/indexsources/indexsource", params);
250        }
251        listSave();
252    }
253
254    /**
255     * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
256     */
257    @Override
258    protected void fillDetails(String detailId) {
259
260        // get content
261        List<CmsListItem> items = getList().getAllContent();
262        Iterator<CmsListItem> itItems = items.iterator();
263        CmsListItem item;
264        if (detailId.equals(LIST_DETAIL_DOCTYPES)) {
265            while (itItems.hasNext()) {
266                item = itItems.next();
267                fillDetailDocTypes(item, detailId);
268            }
269        }
270        if (detailId.equals(LIST_DETAIL_RESOURCES)) {
271            while (itItems.hasNext()) {
272                item = itItems.next();
273                fillDetailResources(item, detailId);
274            }
275        }
276    }
277
278    /**
279     * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
280     */
281    @Override
282    protected List<CmsListItem> getListItems() {
283
284        List<CmsListItem> result = new ArrayList<CmsListItem>();
285        // get content
286        List<CmsSearchIndexSource> sources = searchIndexSources();
287        Iterator<CmsSearchIndexSource> itSources = sources.iterator();
288        CmsSearchIndexSource source;
289        String value;
290        while (itSources.hasNext()) {
291            try {
292                source = itSources.next();
293                // use "null" String and avoid list exception in gui.
294                CmsListItem item = getList().newItem(source.getName());
295                item.set(LIST_COLUMN_NAME, source.getName());
296                try {
297                    value = source.getIndexer().getClass().getName();
298                } catch (Throwable f) {
299                    value = "null";
300                }
301                item.set(LIST_COLUMN_INDEXER, value);
302                result.add(item);
303            } catch (Throwable g) {
304                CmsMessageContainer msg = Messages.get().container(
305                    Messages.LOG_ERR_LIST_ITEM_SKIPPED_2,
306                    getList().getName().key(getLocale()),
307                    "Name");
308                if (LOG.isWarnEnabled()) {
309                    LOG.warn(msg.key(getLocale()));
310                }
311            }
312        }
313        return result;
314    }
315
316    /**
317     * @see org.opencms.workplace.CmsWorkplace#initMessages()
318     */
319    @Override
320    protected void initMessages() {
321
322        // add specific dialog resource bundle
323        addMessages(Messages.get().getBundleName());
324        // add default resource bundles
325        super.initMessages();
326    }
327
328    /**
329     * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
330     */
331    @Override
332    protected void setColumns(CmsListMetadata metadata) {
333
334        // create column for edit
335        CmsListColumnDefinition editCol = new CmsListColumnDefinition(LIST_COLUMN_EDIT);
336        editCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_EDIT_NAME_0));
337        editCol.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_EDIT_NAME_HELP_0));
338        editCol.setWidth("5");
339        editCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
340        editCol.setSorteable(false);
341        // add dummy icon
342        CmsListDirectAction editAction = new CmsListDirectAction(LIST_ACTION_EDIT);
343        editAction.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_ACTION_EDIT_NAME_0));
344        editAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_EDIT_NAME_HELP_0));
345        editAction.setIconPath(CmsSearchIndexList.LIST_ICON_INDEXSOURCE);
346        editCol.addDirectAction(editAction);
347        // add it to the list definition
348        metadata.addColumn(editCol);
349
350        // create column for resource assignment
351        CmsListColumnDefinition resCol = new CmsListColumnDefinition(LIST_COLUMN_RESOURCES);
352        resCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_RESOURCES_NAME_0));
353        resCol.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_RESOURCES_NAME_HELP_0));
354        resCol.setWidth("5");
355        resCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
356        resCol.setSorteable(false);
357        // add resource icon
358        CmsListDirectAction resAction = new CmsListDirectAction(LIST_ACTION_RESOURCES);
359        resAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_RESOURCES_NAME_0));
360        resAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_RESOURCES_NAME_HELP_0));
361        resAction.setIconPath(ICON_FOLDER);
362        resCol.addDirectAction(resAction);
363        // add it to the list definition
364        metadata.addColumn(resCol);
365
366        // create column for document type assignment
367        CmsListColumnDefinition docCol = new CmsListColumnDefinition(LIST_COLUMN_DOCUMENTS);
368        docCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_DOCUMENTS_NAME_0));
369        docCol.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_DOCUMENTS_NAME_HELP_0));
370        docCol.setWidth("5");
371        docCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
372        docCol.setSorteable(false);
373        // add document type icon
374        CmsListDirectAction docAction = new CmsListDirectAction(LIST_ACTION_DOCUMENTS);
375        docAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_DOCUMENTS_NAME_0));
376        docAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_DOCUMENTS_NAME_HELP_0));
377        docAction.setIconPath(CmsDocumentTypeList.ICON_DOCTYPE);
378        docCol.addDirectAction(docAction);
379        // add it to the list definition
380        metadata.addColumn(docCol);
381
382        // create column for deletion
383        CmsListColumnDefinition deleteCol = new CmsListColumnDefinition(LIST_COLUMN_DELETE);
384        deleteCol.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_COL_DELETE_NAME_0));
385        deleteCol.setHelpText(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_COL_DELETE_HELP_0));
386        deleteCol.setWidth("10");
387        deleteCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
388        deleteCol.setSorteable(false);
389        // add delete action
390        CmsListDirectAction deleteAction = new CmsListDirectAction(LIST_ACTION_DELETE);
391        deleteAction.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_DELETE_NAME_0));
392        deleteAction.setHelpText(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_ACTION_DELETE_HELP_0));
393        // skipped as the following page will have to ask for confirmation again (and additionally check a constraint)
394        //        deleteAction.setConfirmationMessage(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_0));
395        deleteAction.setIconPath(ICON_DELETE);
396        deleteCol.addDirectAction(deleteAction);
397        // add it to the list definition
398        metadata.addColumn(deleteCol);
399
400        // add column for name
401        CmsListColumnDefinition nameCol = new CmsListColumnDefinition(LIST_COLUMN_NAME);
402        nameCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
403        nameCol.setName(Messages.get().container(Messages.GUI_LIST_SEARCHINDEX_COL_NAME_0));
404        nameCol.setWidth("50%");
405        // add overview action
406        CmsListDefaultAction defEditAction = new CmsListDefaultAction(LIST_ACTION_OVERVIEW_INDEXSOURCE);
407        defEditAction.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_OVERVIEW_NAME_0));
408        defEditAction.setHelpText(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_OVERVIEW_NAME_HELP_0));
409        nameCol.addDefaultAction(defEditAction);
410        metadata.addColumn(nameCol);
411
412        // add column for analyzer
413        CmsListColumnDefinition analyzerCol = new CmsListColumnDefinition(LIST_COLUMN_INDEXER);
414        analyzerCol.setAlign(CmsListColumnAlignEnum.ALIGN_LEFT);
415        analyzerCol.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_COL_INDEXER_0));
416        analyzerCol.setWidth("45%");
417        metadata.addColumn(analyzerCol);
418
419    }
420
421    /**
422     * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
423     */
424    @Override
425    protected void setIndependentActions(CmsListMetadata metadata) {
426
427        // add document types of index source detail help
428        CmsListItemDetails doctypeDetails = new CmsListItemDetails(LIST_DETAIL_DOCTYPES);
429        doctypeDetails.setAtColumn(LIST_COLUMN_NAME);
430        doctypeDetails.setVisible(false);
431        doctypeDetails.setShowActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_SHOW_0));
432        doctypeDetails.setShowActionHelpText(
433            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_SHOW_HELP_0));
434        doctypeDetails.setHideActionName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_HIDE_0));
435        doctypeDetails.setHideActionHelpText(
436            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_HIDE_HELP_0));
437        doctypeDetails.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0));
438        doctypeDetails.setFormatter(
439            new CmsListItemDetailsFormatter(
440                Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_DOCTYPE_NAME_0)));
441        metadata.addItemDetails(doctypeDetails);
442
443        // add resources of index source detail help
444        CmsListItemDetails resourceDetails = new CmsListItemDetails(LIST_DETAIL_RESOURCES);
445        resourceDetails.setAtColumn(LIST_COLUMN_NAME);
446        resourceDetails.setVisible(false);
447        resourceDetails.setShowActionName(
448            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_SHOW_0));
449        resourceDetails.setShowActionHelpText(
450            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_SHOW_HELP_0));
451        resourceDetails.setHideActionName(
452            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_HIDE_0));
453        resourceDetails.setHideActionHelpText(
454            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_HIDE_HELP_0));
455        resourceDetails.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0));
456        resourceDetails.setFormatter(
457            new CmsListItemDetailsFormatter(
458                Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_DETAIL_RESOURCE_NAME_0)));
459        metadata.addItemDetails(resourceDetails);
460
461    }
462
463    /**
464     * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
465     */
466    @Override
467    protected void setMultiActions(CmsListMetadata metadata) {
468
469        // add add multi action
470        CmsListMultiAction deleteMultiAction = new CmsListMultiAction(LIST_MACTION_DELETESOURCE);
471        deleteMultiAction.setName(Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_MACTION_DELETESOURCE_NAME_0));
472        deleteMultiAction.setHelpText(
473            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_MACTION_DELETESOURCE_NAME_HELP_0));
474        deleteMultiAction.setConfirmationMessage(
475            Messages.get().container(Messages.GUI_LIST_INDEXSOURCE_MACTION_DELETESOURCE_CONF_0));
476        deleteMultiAction.setIconPath(ICON_MULTI_MINUS);
477        metadata.addMultiAction(deleteMultiAction);
478
479    }
480
481    /**
482     * Writes the updated search configuration back to the XML
483     * configuration file and refreshes the complete list.<p>
484     *
485     * @param refresh if true, the list items are refreshed
486     */
487    protected void writeConfiguration(boolean refresh) {
488
489        // update the XML configuration
490        OpenCms.writeConfiguration(CmsSearchConfiguration.class);
491        if (refresh) {
492            refreshList();
493        }
494    }
495
496    /**
497     * Fills details about document types of the index source into the given item. <p>
498     *
499     * @param item the list item to fill
500     * @param detailId the id for the detail to fill
501     *
502     */
503    private void fillDetailDocTypes(CmsListItem item, String detailId) {
504
505        CmsSearchManager searchManager = OpenCms.getSearchManager();
506        StringBuffer html = new StringBuffer();
507
508        // search for the corresponding CmsSearchIndexSource:
509        String idxSourceName = (String)item.get(LIST_COLUMN_NAME);
510        CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName);
511
512        // get the index sources doc types
513        List<String> docTypes = idxSource.getDocumentTypes();
514        // output of found index sources
515        Iterator<String> itDocTypes = docTypes.iterator();
516        CmsSearchDocumentType docType;
517        html.append("<ul>\n");
518        while (itDocTypes.hasNext()) {
519            // get the instance (instead of plain name) for more detail in future...
520            docType = searchManager.getDocumentTypeConfig(itDocTypes.next());
521            // harden against unconfigured doctypes that are refferred to by indexsource nodes
522            if (docType != null) {
523
524                html.append("  <li>\n").append("  ").append(docType.getName()).append("\n");
525                html.append("  </li>");
526            }
527        }
528
529        html.append("</ul>\n");
530        item.set(detailId, html.toString());
531    }
532
533    /**
534     * Fills details about resource paths of the index source into the given item. <p>
535     *
536     * @param item the list item to fill
537     * @param detailId the id for the detail to fill
538     *
539     */
540    private void fillDetailResources(CmsListItem item, String detailId) {
541
542        CmsSearchManager searchManager = OpenCms.getSearchManager();
543        StringBuffer html = new StringBuffer();
544
545        // search for the corresponding CmsSearchIndexSource:
546        String idxSourceName = (String)item.get(LIST_COLUMN_NAME);
547        CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName);
548
549        // get the index sources resource strings
550        List<String> resources = idxSource.getResourcesNames();
551        // output of found index sources
552        Iterator<String> itResources = resources.iterator();
553        html.append("<ul>\n");
554        while (itResources.hasNext()) {
555
556            html.append("  <li>\n").append("  ").append(itResources.next()).append("\n");
557            html.append("  </li>");
558        }
559
560        html.append("</ul>\n");
561
562        item.set(detailId, html.toString());
563    }
564
565    /**
566     * Returns the available search indexes of this installation.
567     *
568     * @return the available search indexes of this installation
569     */
570    private List<CmsSearchIndexSource> searchIndexSources() {
571
572        CmsSearchManager manager = OpenCms.getSearchManager();
573        return new LinkedList<CmsSearchIndexSource>(manager.getSearchIndexSources().values());
574
575    }
576}