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, 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.ade.publish;
029
030import org.opencms.ade.publish.shared.CmsProjectBean;
031import org.opencms.ade.publish.shared.CmsPublishOptions;
032import org.opencms.file.CmsObject;
033import org.opencms.file.CmsResource;
034import org.opencms.main.CmsException;
035import org.opencms.util.CmsUUID;
036
037import java.util.List;
038import java.util.Map;
039
040/**
041 * This interface can be used to implement a new option in the publish dialog's project selector.
042 *
043 * Instead of reading the resources from a real project, the resource lists will be generated by the classes which implement this interface.
044 */
045public interface I_CmsVirtualProject {
046
047    /**
048     * Gets the project bean.<p>
049     *
050     * Should return null if the virtual project is not available or applicable for the given parameters.<p>
051     *
052     * @param cms the CMS context to use
053     * @param params the publish parameters
054     *
055     * @return the project bean
056     */
057    CmsProjectBean getProjectBean(CmsObject cms, Map<String, String> params);
058
059    /**
060     * Gets the project id.<p>
061     *
062     * @return the project id
063     */
064    CmsUUID getProjectId();
065
066    /**
067     * Returns an object that can be queried for 'related' resources specific to this virtual project.<p>
068     *
069     * @param cmsObject the current CMS context
070     * @param options the publish options
071     *
072     * @return the related resource provider
073     */
074    I_CmsPublishRelatedResourceProvider getRelatedResourceProvider(CmsObject cmsObject, CmsPublishOptions options);
075
076    /**
077     * Gets the resources of the virtual project.<p>
078     *
079     * @param cms the CMS context to use
080     * @param params the publish parameters
081     * @param workflowId the workflow id
082     *
083     * @return the generated list of resources
084     *
085     * @throws CmsException if something goes wrong
086     */
087    List<CmsResource> getResources(CmsObject cms, Map<String, String> params, String workflowId) throws CmsException;
088
089    /**
090     * Returns true if in this virtual project, resource groups should be able to be automatically selected by the GUI.<p>
091     *
092     * @return true if resource groups should be auto-selectable
093     */
094    boolean isAutoSelectable();
095}