001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/content/check/CmsContentCheckCollector.java,v $
003: * Date : $Date: 2008-02-27 12:05:41 $
004: * Version: $Revision: 1.5 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace.tools.content.check;
033:
034: import org.opencms.file.CmsObject;
035: import org.opencms.workplace.explorer.CmsResourceUtil;
036: import org.opencms.workplace.list.A_CmsListResourceCollector;
037: import org.opencms.workplace.list.A_CmsListExplorerDialog;
038: import org.opencms.workplace.list.CmsListItem;
039: import org.opencms.workplace.list.I_CmsListResourceCollector;
040:
041: import java.util.ArrayList;
042: import java.util.List;
043: import java.util.Map;
044:
045: /**
046: * Collector for receiving {@link org.opencms.file.CmsResource} objects from a {@link CmsContentCheckResult}.<p>
047: *
048: * @author Michael Emmerich
049: * @author Michael Moossen
050: *
051: * @version $Revision: 1.5 $
052: *
053: * @since 6.1.2
054: */
055: public class CmsContentCheckCollector extends
056: A_CmsListResourceCollector {
057:
058: /** Parameter of the default collector name. */
059: public static final String COLLECTOR_NAME = "checkresources";
060:
061: /** Parameter to get all resources with errors and warnings. */
062: public static final String PARAM_ALL = "all";
063:
064: /** Parameter to get all resources with errors. */
065: public static final String PARAM_ERROR = "error";
066:
067: /** Parameter to get all resources with warnings. */
068: public static final String PARAM_WARNING = "warning";
069:
070: /** The list of resources delivered by the collector. */
071: private CmsContentCheckResult m_results;
072:
073: /**
074: * Constructor, creates a new CmsContentCheckCollector.<p>
075: *
076: * @param wp the workplace object
077: *
078: * @param results a CmsContentCheckResult object, containing the results of the content check.
079: */
080: public CmsContentCheckCollector(A_CmsListExplorerDialog wp,
081: CmsContentCheckResult results) {
082:
083: super (wp);
084: m_collectorParameter += I_CmsListResourceCollector.SEP_PARAM
085: + PARAM_ALL;
086: m_results = results;
087: }
088:
089: /**
090: * @see org.opencms.file.collectors.I_CmsResourceCollector#getCollectorNames()
091: */
092: public List getCollectorNames() {
093:
094: List names = new ArrayList();
095: names.add(COLLECTOR_NAME);
096: return names;
097: }
098:
099: /**
100: * @see org.opencms.workplace.list.A_CmsListResourceCollector#getResources(org.opencms.file.CmsObject, java.util.Map)
101: */
102: public List getResources(CmsObject cms, Map params) {
103:
104: if (params.containsKey(PARAM_ERROR)) {
105: return m_results.getErrorResources();
106: } else if (params.containsKey(PARAM_WARNING)) {
107: return m_results.getWarningResources();
108: } else if (params.containsKey(PARAM_ALL)) {
109: return m_results.getAllResources();
110: } else {
111: // the default is to return all resources
112: return m_results.getAllResources();
113: }
114: }
115:
116: /**
117: * @see org.opencms.workplace.list.A_CmsListResourceCollector#setAdditionalColumns(org.opencms.workplace.list.CmsListItem, org.opencms.workplace.explorer.CmsResourceUtil)
118: */
119: protected void setAdditionalColumns(CmsListItem item,
120: CmsResourceUtil resUtil) {
121:
122: // no-op
123: }
124: }
|