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.list;
029
030import org.opencms.file.CmsObject;
031import org.opencms.file.CmsResource;
032import org.opencms.file.collectors.I_CmsResourceCollector;
033import org.opencms.main.CmsException;
034
035import java.util.List;
036import java.util.Map;
037
038/**
039 * Collector to provide {@link CmsResource} objects for a explorer List.<p>
040 *
041 * @since 6.1.0
042 */
043public interface I_CmsListResourceCollector extends I_CmsResourceCollector {
044
045    /** Parameter name constant. */
046    String PARAM_FILTER = "filter";
047
048    /** Parameter name constant. */
049    String PARAM_ORDER = "order";
050
051    /** Parameter name constant. */
052    String PARAM_PAGE = "page";
053
054    /** Resources parameter name constant. */
055    String PARAM_RESOURCES = "resources";
056
057    /** Parameter name constant. */
058    String PARAM_SORTBY = "sortby";
059
060    /** Key-Value delimiter constant. */
061    String SEP_KEYVAL = ":";
062
063    /** Parameter delimiter constant. */
064    String SEP_PARAM = "|";
065
066    /**
067     * Returns a list of list items from a list of resources.<p>
068     *
069     * @param parameter the collector parameter or <code>null</code> for default.<p>
070     *
071     * @return a list of {@link CmsListItem} objects
072     *
073     * @throws CmsException if something goes wrong
074     */
075    List<CmsListItem> getListItems(String parameter) throws CmsException;
076
077    /**
078     * Returns the resource for the given item.<p>
079     *
080     * @param cms the cms object
081     * @param item the item
082     *
083     * @return the resource
084     */
085    CmsResource getResource(CmsObject cms, CmsListItem item);
086
087    /**
088     * Returns all, unsorted and unfiltered, resources.<p>
089     *
090     * Be sure to cache the resources.<p>
091     *
092     * @param cms the cms object
093     * @param params the parameter map
094     *
095     * @return a list of {@link CmsResource} objects
096     *
097     * @throws CmsException if something goes wrong
098     */
099    List<CmsResource> getResources(CmsObject cms, Map<String, String> params) throws CmsException;
100
101    /**
102     * Returns the workplace object.<p>
103     *
104     * @return the workplace object
105     */
106    A_CmsListExplorerDialog getWp();
107
108    /**
109     * Sets the current display page.<p>
110     *
111     * @param page the new display page
112     */
113    void setPage(int page);
114}