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.gwt.shared;
029
030import org.opencms.util.CmsUUID;
031
032import com.google.gwt.user.client.rpc.IsSerializable;
033
034/**
035 * Parameters used by the quick launch provider.<p>
036 */
037public class CmsQuickLaunchParams implements IsSerializable {
038
039    /** Context (sitmap or page editor). */
040    private String m_context;
041
042    /** Page id. */
043    private CmsUUID m_pageId;
044
045    /** Detail content id. */
046    private CmsUUID m_detailId;
047
048    /** The last opened page id from the session storage. */
049    private CmsUUID m_sessionPageId;
050
051    /** Return code. */
052    private String m_returnCode;
053
054    /** Path. */
055    private String m_path;
056
057    /**
058     * Creates a new instance.<p>
059     *
060     * @param context the quick launch context
061     * @param pageId the page id
062     * @param detailId the detail content id
063     * @param returnCode the return code
064     * @param path  the path
065     * @param sessionPageId the id of the last opened page from the browser sessionStorage
066     */
067    public CmsQuickLaunchParams(
068        String context,
069        CmsUUID pageId,
070        CmsUUID detailId,
071        String returnCode,
072        String path,
073        CmsUUID sessionPageId) {
074
075        m_context = context;
076        m_pageId = pageId;
077        m_detailId = detailId;
078        m_returnCode = returnCode;
079        m_path = path;
080        m_sessionPageId = sessionPageId;
081    }
082
083    /**
084     * Default constructor for serialization.<p>
085     */
086    protected CmsQuickLaunchParams() {
087
088        // do nothing
089    }
090
091    /**
092     * Returns the context.<p>
093     *
094     * @return the context
095     */
096    public String getContext() {
097
098        return m_context;
099    }
100
101    /**
102     * Returns the detailId.<p>
103     *
104     * @return the detailId
105     */
106    public CmsUUID getDetailId() {
107
108        return m_detailId;
109    }
110
111    /**
112     * Returns the pageId.<p>
113     *
114     * @return the pageId
115     */
116    public CmsUUID getPageId() {
117
118        return m_pageId;
119    }
120
121    /**
122     * Gets the path.<p>
123     *
124     * @return the path
125     */
126    public String getPath() {
127
128        return m_path;
129    }
130
131    /**
132     * Returns the returnCode.<p>
133     *
134     * @return the returnCode
135     */
136    public String getReturnCode() {
137
138        return m_returnCode;
139    }
140
141    /**
142     * Gets the id of the last edited container page.
143     *
144     * @return the id of the last edited container page
145     */
146    public CmsUUID getSessionPageId() {
147
148        return m_sessionPageId;
149    }
150
151    /**
152     * Returns true if the quick launcher is called from the page editor.<p>
153     *
154     * @return true if the quick launcher was called from the page editor
155     */
156    public boolean isPageContext() {
157
158        return CmsGwtConstants.QuickLaunch.CONTEXT_PAGE.equals(m_context);
159    }
160
161    /**
162     * Returns true if the quick launcher is called from the sitemap editor.<p>
163     *
164     * @return true if the quick launcher was called from the sitemap editor
165     */
166    public boolean isSitemapContext() {
167
168        return CmsGwtConstants.QuickLaunch.CONTEXT_SITEMAP.equals(m_context);
169    }
170
171}