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.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        // do nothing
048    }
049
050    /**
051     * Creates a new instance.<p>
052     *
053     * @param error the error
054     * @param link the link
055     */
056    protected CmsLocaleLinkBean(String error, String link) {
057        m_error = error;
058        m_link = link;
059    }
060
061    /**
062     * Creates a new link bean with an error message.<p>
063     *
064     * @param errorMsg the error message
065     *
066     * @return the new bean
067     */
068    public static CmsLocaleLinkBean error(String errorMsg) {
069
070        return new CmsLocaleLinkBean(errorMsg, null);
071    }
072
073    /**
074     * Creates a new link bean with a link.<p>
075     *
076     * @param link the link
077     *
078     * @return the link bean
079     */
080    public static CmsLocaleLinkBean link(String link) {
081
082        return new CmsLocaleLinkBean(null, link);
083    }
084
085    /**
086     * Gets the error message.<p>
087     *
088     * @return the error message
089     */
090    public String getError() {
091
092        return m_error;
093    }
094
095    /**
096     * Gets the link.<p>
097     *
098     * @return the link
099     */
100    public String getLink() {
101
102        return m_link;
103    }
104
105}