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.postupload.shared;
029
030import org.opencms.util.CmsUUID;
031
032import java.util.HashSet;
033import java.util.LinkedHashMap;
034import java.util.Map;
035import java.util.Set;
036
037import com.google.gwt.user.client.rpc.IsSerializable;
038
039/**
040 * Runtime data bean for prefetching.<p>
041 *
042 * @since 8.0.0
043 */
044public class CmsPostUploadDialogBean implements IsSerializable {
045
046    /** Name of the used js variable. */
047    public static final String DICT_NAME = "postupload_dialog";
048
049    /**
050     * A map of the resources for which the properties should be edited, with the structure ids as keys and the resource
051     * paths as values.
052     */
053    private Map<CmsUUID, String> m_resources = new LinkedHashMap<CmsUUID, String>();
054
055    /** Ids of resources for which validation is required. */
056    private Set<CmsUUID> m_idsWithRequiredValidation = new HashSet<>();
057
058    /** Flag which controls whether the property configurations should be used. */
059    private boolean m_useConfiguration;
060
061    /** Flag to control if configured basic properties should be shown. */
062    private boolean m_addBasicProperties;
063
064    /**
065     * Default constructor for serialization.<p>
066     */
067    public CmsPostUploadDialogBean() {
068
069        // default constructor for serialization
070    }
071
072    /**
073     * Creates a new instance.<p>
074     *
075     * @param resources the map of resources for which the properties should be uploaded
076     * @param idsWithRequiredValidation structurei ids of resources for which validation is required
077     */
078    public CmsPostUploadDialogBean(Map<CmsUUID, String> resources, Set<CmsUUID> idsWithRequiredValidation) {
079
080        m_resources.putAll(resources);
081        m_idsWithRequiredValidation = idsWithRequiredValidation;
082    }
083
084    /**
085     * Gets the structure ids of resources for which validation is required.
086     *
087     * @return the structure ids of resources for which validation is required
088     */
089    public Set<CmsUUID> getIdsWithRequiredValidation() {
090
091        return m_idsWithRequiredValidation;
092    }
093
094    /**
095     * Returns the list of resource paths.<p>
096     *
097     * @return the list of resource paths
098     */
099    public Map<CmsUUID, String> getResources() {
100
101        return m_resources;
102    }
103
104    /**
105     * Returns true if the basic properties configured for the sitemap should be shown.
106     * @return true if the basic properties configured for the sitemap should be shown.
107     */
108    public boolean isAddBasicProperties() {
109
110        return m_addBasicProperties;
111    }
112
113    /**
114     * Returns true if the property configurations should be used.<p>
115     *
116     * @return true if the property configurations should be used
117     */
118    public boolean isUsePropertyConfiguration() {
119
120        return m_useConfiguration;
121
122    }
123
124    /**
125     * Set a flag, indicating if basic properties as configured in the sitemap are merged into the
126     * properties shown on file upload.
127     *
128     * @param addBasicProperties flag, indicating if basic properties as configured in the sitemap should be added
129     */
130    public void setAddBasicProperties(final boolean addBasicProperties) {
131
132        m_addBasicProperties = addBasicProperties;
133    }
134
135    /**
136     * Sets the map of resources for which the properties should be uploaded.<p>
137     *
138     * @param resources the map of resources for which the properties should be uploaded
139     */
140    public void setResources(Map<CmsUUID, String> resources) {
141
142        m_resources = resources;
143    }
144
145    /**
146     * Enables/disables use of the property configuration.<p>
147     *
148     * @param useConfiguration true if the property configuration should be used
149     */
150    public void setUsePropertyConfiguration(boolean useConfiguration) {
151
152        m_useConfiguration = useConfiguration;
153    }
154
155}