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.shared;
029
030import java.util.List;
031
032import com.google.common.collect.Lists;
033import com.google.gwt.user.client.rpc.IsSerializable;
034
035/**
036 * A class which represents a list of publish groups to display to the user for selection.<p>
037 *
038 * It may be the case that there are too many resources to display. In this case, the instance
039 * will not contain the publish groups, but instead a publish list token which can be used later
040 * to reconstruct the publish list.<p>
041 *
042 */
043public class CmsPublishGroupList implements IsSerializable {
044
045    /** The list of publish groups. */
046    private List<CmsPublishGroup> m_groups = Lists.newArrayList();
047
048    /** Workflow ID which, if not null, is used to override the workflow selected by default in the publish dialog. */
049    private String m_overrideWorkflowId;
050
051    /** The publish token which can be used to reconstruct the publish list. */
052    private CmsPublishListToken m_token;
053
054    /** The message to display if the publish list token is being used instead of the publish groups list. */
055    private String m_tooManyResourcesMessage = "";
056
057    /**
058     * Default constructor.<p>
059     */
060    public CmsPublishGroupList() {
061
062        // do nothing
063    }
064
065    /**
066     * Constructs a new instance with a publish list token and an empty group list.<p<
067     *      *
068     * @param token the publish list token to use
069     */
070    public CmsPublishGroupList(CmsPublishListToken token) {
071
072        m_token = token;
073    }
074
075    /**
076     * Gets the list of publish groups.<p>
077     *
078     * @return the publish groups
079     */
080    public List<CmsPublishGroup> getGroups() {
081
082        return m_groups;
083    }
084
085    /**
086     * Gets the override workflow id.<p>
087     *
088     * If this is not null, this indicates that the publish groups were fetched for a different workflow than that selected by default
089     * in the publish dialog, and that the publish dialog should change its selected workflow accordingly.<p>
090     *
091     * @return the override workflow id
092     */
093    public String getOverrideWorkflowId() {
094
095        return m_overrideWorkflowId;
096    }
097
098    /**
099     * Returns the token.<p>
100     *
101     * @return the token
102     */
103    public CmsPublishListToken getToken() {
104
105        return m_token;
106    }
107
108    /**
109     * Gets the message which should be displayed if the token is being used instead of the list of publish groups.<p>
110     *
111     * @return the message
112     */
113    public String getTooManyResourcesMessage() {
114
115        return m_tooManyResourcesMessage;
116    }
117
118    /**
119     * Sets the publish groups.<p>
120     *
121     * @param groups the list of publish groups
122     */
123    public void setGroups(List<CmsPublishGroup> groups) {
124
125        m_groups = groups;
126    }
127
128    /**
129     * Sets the Override workflow.<p>
130     *
131     * @param id the id of the override workflow
132     */
133    public void setOverrideWorkflowId(String id) {
134
135        m_overrideWorkflowId = id;
136    }
137
138    /**
139     * Sets the tooManyResourcesMessage.<p>
140     *
141     * @param tooManyResourcesMessage the tooManyResourcesMessage to set
142     */
143    public void setTooManyResourcesMessage(String tooManyResourcesMessage) {
144
145        m_tooManyResourcesMessage = tooManyResourcesMessage;
146    }
147
148}