001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://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.containerpage.shared;
029
030import com.google.gwt.user.client.rpc.IsSerializable;
031
032/**
033 * Bean representing a link to a different locale variant.<p>
034 */
035public class CmsLocaleLinkBean implements IsSerializable {
036
037    /** Error message if the link can't be opened. */
038    private String m_error;
039
040    /** The link. */
041    private String m_link;
042
043    /**
044     * Default constructor for serialization.<p>
045     */
046    protected CmsLocaleLinkBean() {
047
048        // do nothing
049    }
050
051    /**
052     * Creates a new instance.<p>
053     *
054     * @param error the error
055     * @param link the link
056     */
057    protected CmsLocaleLinkBean(String error, String link) {
058
059        m_error = error;
060        m_link = link;
061    }
062
063    /**
064     * Creates a new link bean with an error message.<p>
065     *
066     * @param errorMsg the error message
067     *
068     * @return the new bean
069     */
070    public static CmsLocaleLinkBean error(String errorMsg) {
071
072        return new CmsLocaleLinkBean(errorMsg, null);
073    }
074
075    /**
076     * Creates a new link bean with a link.<p>
077     *
078     * @param link the link
079     *
080     * @return the link bean
081     */
082    public static CmsLocaleLinkBean link(String link) {
083
084        return new CmsLocaleLinkBean(null, link);
085    }
086
087    /**
088     * Gets the error message.<p>
089     *
090     * @return the error message
091     */
092    public String getError() {
093
094        return m_error;
095    }
096
097    /**
098     * Gets the link.<p>
099     *
100     * @return the link
101     */
102    public String getLink() {
103
104        return m_link;
105    }
106
107}