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.publish.shared;
029
030import com.google.gwt.user.client.rpc.IsSerializable;
031
032/**
033 * A publish resource additional information bean.<p>
034 *
035 * @since 7.6
036 */
037public class CmsPublishResourceInfo implements IsSerializable {
038
039    /** Reason value constants, when resources can not be published. */
040    public enum Type {
041
042        /** The resource is still used in the online project. */
043        BROKENLINK,
044        /** Resource is locked by another user. */
045        LOCKED,
046        /** The resource is missing in the online project. */
047        MISSING,
048        /** User does not have enough permissions. */
049        PERMISSIONS,
050        /** Resource has been already published. */
051        PUBLISHED,
052        /** Changed related resource can not be published. */
053        RELATED,
054        /** Resource is already in the workflow. */
055        WORKFLOW;
056    }
057
058    /** Flag to hide the publish resource. */
059    private boolean m_hidden;
060
061    /** The additional info type.*/
062    private Type m_type;
063
064    /** The additional info.*/
065    private String m_value;
066
067    /**
068     * Creates a new publish resource additional information bean.<p>
069     *
070     * @param value the additional info
071     * @param type the additional info type
072     */
073    public CmsPublishResourceInfo(String value, Type type) {
074
075        m_type = type;
076        m_value = value;
077    }
078
079    /**
080     * Creates a new publish resource additional information bean.<p>
081     *
082     * @param value the additional info
083     * @param type the additional info type
084     * @param hidden flag to hide the publish resource
085     */
086    public CmsPublishResourceInfo(String value, Type type, boolean hidden) {
087
088        m_type = type;
089        m_value = value;
090        m_hidden = hidden;
091    }
092
093    /**
094     * For serialization.<p>
095     */
096    protected CmsPublishResourceInfo() {
097
098        // for serialization
099    }
100
101    /**
102     * Returns the type.<p>
103     *
104     * @return the type
105     */
106    public Type getType() {
107
108        return m_type;
109    }
110
111    /**
112     * Returns the value.<p>
113     *
114     * @return the value
115     */
116    public String getValue() {
117
118        return m_value;
119    }
120
121    /**
122     * Returns if there is a problem type set.<p>
123     *
124     * @return <code>true</code> if the problem type is set
125     */
126    public boolean hasProblemType() {
127
128        return m_type != null;
129    }
130
131    /**
132     * Returns true if the publish resource should be hidden.<p>
133     *
134     * @return true if the publish resource should be hidden
135     */
136    public boolean isHidden() {
137
138        return m_hidden;
139    }
140}