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 com.google.gwt.user.client.rpc.IsSerializable;
031
032/**
033 * Work flow action information.<p>
034 */
035public class CmsWorkflowAction implements IsSerializable {
036
037    /** The cancel workflow action. */
038    public static final String ACTION_CANCEL = "cancel";
039
040    /** The action key. */
041    private String m_action;
042
043    /** The action label. */
044    private String m_label;
045
046    /** Action enabled flag. */
047    private boolean m_enabled;
048
049    /** A flag which indicates whether this workflow action is actually a publish action. */
050    private boolean m_isPublish;
051
052    /**
053     * Constructor.<p>
054     *
055     * @param actionKey the action key
056     * @param label the action label
057     * @param isEnabled <code>true</code> if the action is enabled
058     */
059    public CmsWorkflowAction(String actionKey, String label, boolean isEnabled) {
060
061        m_action = actionKey;
062        m_label = label;
063        m_enabled = isEnabled;
064    }
065
066    /**
067     * Constructor.<p>
068     *
069     * @param actionKey the action key
070     * @param label the action label
071     * @param isEnabled <code>true</code> if the action is enabled
072     * @param isPublish a flag to distinguish publish actions from other workflow actions
073     */
074    public CmsWorkflowAction(String actionKey, String label, boolean isEnabled, boolean isPublish) {
075
076        m_action = actionKey;
077        m_label = label;
078        m_enabled = isEnabled;
079        m_isPublish = isPublish;
080    }
081
082    /**
083     * Constructor. For serialization only.<p>
084     */
085    protected CmsWorkflowAction() {
086
087        // nothing to do
088    }
089
090    /**
091     * Returns the action key.<p>
092     *
093     * @return the action key
094     */
095    public String getAction() {
096
097        return m_action;
098    }
099
100    /**
101     * Returns the action label.<p>
102     *
103     * @return the action label
104     */
105    public String getLabel() {
106
107        return m_label;
108    }
109
110    /**
111     * Returns if the action is enabled.<p>
112     *
113     * @return <code>true</code> if the action is enabled
114     */
115    public boolean isEnabled() {
116
117        return m_enabled;
118    }
119
120    /**
121     * Check whether this action is a publish action.<p>
122     *
123     * @return true if this is a publish action
124     */
125    public boolean isPublish() {
126
127        return m_isPublish;
128    }
129}