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