diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java index e93b628e16743de34f74cf6d82958d05fc9641f8..e7cd55ec780afc724f2cccd7275b9b08aaa07f33 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/DisplaySettingsProvider.java @@ -53,7 +53,7 @@ public class DisplaySettingsProvider settings = person.getDisplaySettings(); displaySettingsMap.put(person.getUserId(), settings); } - settings = settings.clone(); + settings = new DisplaySettings(settings); settings.clearCustomWebAppSettings(); return settings; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java index 1224b4e6558e9acfec49442484b1ff62aee66a25..b8dd1a569f738b49721b593889d8fd9944e97f24 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DisplaySettings.java @@ -34,10 +34,14 @@ import java.util.Map; * * @author Franz-Josef Elmer */ -public class DisplaySettings implements Serializable, Cloneable +public class DisplaySettings implements Serializable { private static final long serialVersionUID = 1L; + // + // NOTE: if you add new fields to this class, you also need to add it to the copy constructor! + // + private Map<String, List<ColumnSetting>> columnSettings = new HashMap<String, List<ColumnSetting>>(); @@ -74,6 +78,31 @@ public class DisplaySettings implements Serializable, Cloneable private Map<String, Map<String, String>> customWebAppDisplaySettings; + public DisplaySettings() + { + } + + /** + * Copy constructor (shallow copy). + */ + public DisplaySettings(DisplaySettings other) + { + this.columnSettings = other.columnSettings; + this.technologySpecificSettings = other.technologySpecificSettings; + this.tabSettings = other.tabSettings; + this.dropDownSettings = other.dropDownSettings; + this.useWildcardSearchMode = other.useWildcardSearchMode; + this.debugging = other.debugging; + this.lastHistoryTokenOrNull = other.lastHistoryTokenOrNull; + this.ignoreLastHistoryToken = other.ignoreLastHistoryToken; + this.realNumberFormatingParameters = other.realNumberFormatingParameters; + this.panelCollapsedSettings = other.panelCollapsedSettings; + this.panelSizeSettings = other.panelSizeSettings; + this.visits = other.visits; + this.portletConfigurations = other.portletConfigurations; + this.customWebAppDisplaySettings = other.customWebAppDisplaySettings; + } + /** @deprecated Should be used only by DisplaySettingsManager. */ @Deprecated public Map<String, Serializable> getTechnologySpecificSettings() @@ -357,15 +386,4 @@ public class DisplaySettings implements Serializable, Cloneable customWebAppDisplaySettings = null; } - @Override - public DisplaySettings clone() - { - try - { - return (DisplaySettings) super.clone(); - } catch (CloneNotSupportedException ex) - { - throw new Error(ex); - } - } }