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 org.opencms.util.CmsUUID;
031
032import java.util.List;
033
034import com.google.gwt.user.client.rpc.IsSerializable;
035
036/**
037 * The result of a workflow action.<p>
038 */
039public class CmsWorkflowResponse implements IsSerializable {
040
041    /** An internal workflow id. */
042    private CmsUUID m_workflowId;
043
044    /** The list of workflow actions which should be available next in case of failure. */
045    private List<CmsWorkflowAction> m_availableActions;
046
047    /** A flag indicating whether the workflow action was successful. */
048    private boolean m_success;
049
050    /** The message text which should be displayed to the user in case of failure. */
051    private String m_message;
052
053    /** A list of resources which should be presented to the user in case of failure. */
054    private List<CmsPublishResource> m_resources;
055
056    /**
057     * Creates a new workflow response object.<p>
058     *
059     * @param isSuccess a flag indicating whether the workflow action was successful
060     * @param message the message which should be displayed to the user in case of failure
061     * @param resources the resources which should be presented to the user in case of  failure
062     * @param availableActions the actions which should be possible for the user in case of failure
063     * @param workflowId the internal workflow id
064     */
065    public CmsWorkflowResponse(
066        boolean isSuccess,
067        String message,
068        List<CmsPublishResource> resources,
069        List<CmsWorkflowAction> availableActions,
070        CmsUUID workflowId) {
071
072        m_success = isSuccess;
073        m_message = message;
074        m_resources = resources;
075        m_availableActions = availableActions;
076        m_workflowId = workflowId;
077    }
078
079    /**
080     * Constructor needed for serialization only.<p>
081     */
082    protected CmsWorkflowResponse() {
083
084        // nothing to do
085    }
086
087    /**
088     * Returns the list of actions which are available next.<p>
089     *
090     * @return a list of beans representing the next possible workflow actions
091     */
092    public List<CmsWorkflowAction> getAvailableActions() {
093
094        return m_availableActions;
095    }
096
097    /**
098     * Gets the message which should be displayed to the user in case of failure.<p>
099     *
100     * @return the message which should be displayed to the user in case of failure
101     */
102    public String getMessage() {
103
104        return m_message;
105    }
106
107    /**
108     * Gets the list of resources which should be presented to the user in case of failure.<p>
109     *
110     * @return a list of resources
111     */
112    public List<CmsPublishResource> getResources() {
113
114        return m_resources;
115    }
116
117    /**
118     * Gets the internal workflow id.<p>
119     *
120     * @return the internal workflow id
121     */
122    public CmsUUID getWorkflowId() {
123
124        return m_workflowId;
125    }
126
127    /**
128     * Returns true if the action for which this object is the workflow response was successful or not.<p>
129     *
130     * @return true if the workflow action was successful
131     */
132    public boolean isSuccess() {
133
134        return m_success;
135    }
136}