org.opencms.ade.sitemap.shared.CmsSitemapClipboardData Maven / Gradle / Ivy
Show all versions of opencms-gwt Show documentation
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.ade.sitemap.shared;
import org.opencms.util.CmsUUID;
import java.util.LinkedHashMap;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Sitemap clipboard data bean.
*
* @since 8.0
*/
public class CmsSitemapClipboardData implements IsSerializable {
/** The session stored list of deleted sitemap entries. */
private LinkedHashMap m_deletions;
/** The session stored list of modified sitemap entry paths. */
private LinkedHashMap m_modifications;
/**
* Constructor.
*/
public CmsSitemapClipboardData() {
m_deletions = new LinkedHashMap();
m_modifications = new LinkedHashMap();
}
/**
* Constructor.
*
* @param deletions the session stored list of deleted sitemap entries
* @param modifications the session stored list of modified sitemap entry paths
*/
public CmsSitemapClipboardData(
LinkedHashMap deletions,
LinkedHashMap modifications) {
m_deletions = deletions;
m_modifications = modifications;
}
/**
* Adds an entry to the deleted list.
*
* @param entry the entry to add
*/
public void addDeleted(CmsClientSitemapEntry entry) {
if (m_deletions.containsKey(entry.getId())) {
m_deletions.remove(entry.getId());
}
m_deletions.put(entry.getId(), entry);
}
/**
* Adds an entry to the modified list.
*
* @param entry the entry to add
*/
public void addModified(CmsClientSitemapEntry entry) {
if (m_modifications.containsKey(entry.getId())) {
m_modifications.remove(entry.getId());
}
m_modifications.put(entry.getId(), entry);
}
/**
* Provides a copy of the clip-board data.
*
* @return the copied data
*/
public CmsSitemapClipboardData copy() {
LinkedHashMap deletions = new LinkedHashMap();
deletions.putAll(m_deletions);
LinkedHashMap modifications = new LinkedHashMap();
modifications.putAll(m_modifications);
return new CmsSitemapClipboardData(deletions, modifications);
}
/**
* Returns the session stored list of deleted sitemap entries.
*
* @return the session stored list of deleted sitemap entries
*/
public LinkedHashMap getDeletions() {
return m_deletions;
}
/**
* Returns the session stored list of modified sitemap entry paths.
*
* @return the session stored list of modified sitemap entry paths
*/
public LinkedHashMap getModifications() {
return m_modifications;
}
/**
* Removes an entry from the deleted list.
*
* @param entry the entry to remove
*/
public void removeDeleted(CmsClientSitemapEntry entry) {
m_deletions.remove(entry.getId());
}
/**
* Removes an entry from the modified list.
*
* @param entry the entry to remove
*/
public void removeModified(CmsClientSitemapEntry entry) {
m_modifications.remove(entry.getId());
}
/**
* Sets list of deleted sitemap entries.
*
* @param deletions the deleted sitemap entries
*/
public void setDeletions(LinkedHashMap deletions) {
m_deletions = deletions;
}
/**
* Sets the list of modified sitemap entry paths.
*
* @param modifications the list of modified sitemap entry paths
*/
public void setModifications(LinkedHashMap modifications) {
m_modifications = modifications;
}
}