From 54db716a93be810e43e11e6c8f016ff1d0185ca5 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Wed, 22 Jun 2011 11:00:18 +0000 Subject: [PATCH] [LMS-2209] switch off invalidation by default (added a setting to web-client.properties) SVN: 21801 --- openbis/dist/server/web-client.properties | 4 ++++ openbis/etc/web-client.properties | 4 ++++ ...actDataListDeletionConfirmationDialog.java | 24 ++++++++++++++----- .../WebClientConfigurationProvider.java | 12 ++++++++++ .../basic/dto/WebClientConfiguration.java | 17 +++++++++++-- 5 files changed, 53 insertions(+), 8 deletions(-) diff --git a/openbis/dist/server/web-client.properties b/openbis/dist/server/web-client.properties index 14d50a0e7c0..6fca2e4f9a0 100644 --- a/openbis/dist/server/web-client.properties +++ b/openbis/dist/server/web-client.properties @@ -14,6 +14,10 @@ # Maximal number of visible columns in tables. Default: 50. #max-visible-columns = 20 +# Experimental: Enable invalidation (non-permanent deletion) of entities in UI. +# Default value: false +#enable-invalidation = true + # Should the feature of adding unofficial/ad-hoc terms to vocabularies be turned on. # Default value: false #allow-adding-unofficial-terms = true diff --git a/openbis/etc/web-client.properties b/openbis/etc/web-client.properties index 80f1f99e8b2..c4b257d8d8a 100644 --- a/openbis/etc/web-client.properties +++ b/openbis/etc/web-client.properties @@ -8,6 +8,10 @@ # Default value: false #default-anonymous-login = true +# Experimental: Enable invalidation (non-permanent deletion) of entities in UI. +# Default value: false +#enable-invalidation = true + # Maximal number of visible columns in tables. Default: 50. max-visible-columns = 25 diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/AbstractDataListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/AbstractDataListDeletionConfirmationDialog.java index c19986e97aa..3804f9ad418 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/AbstractDataListDeletionConfirmationDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/AbstractDataListDeletionConfirmationDialog.java @@ -28,11 +28,12 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AsyncCallbackWithProgressBar; import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.CheckBoxField; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.ReasonField; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.WidgetUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DeletionType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.WebClientConfiguration; /** * {@link AbstractDataConfirmationDialog} abstract implementation for deleting given list of data on @@ -51,6 +52,8 @@ public abstract class AbstractDataListDeletionConfirmationDialog<T> extends private static final String SELECTED = " selected "; + private final IViewContext<?> viewContext; + private final AbstractAsyncCallback<Void> deletionCallback; private boolean withRadio = false; @@ -65,10 +68,11 @@ public abstract class AbstractDataListDeletionConfirmationDialog<T> extends protected ReasonField reason; - public AbstractDataListDeletionConfirmationDialog(IMessageProvider messageProvider, - List<T> data, AbstractAsyncCallback<Void> deletionCallback) + public AbstractDataListDeletionConfirmationDialog(IViewContext<?> viewContext, List<T> data, + AbstractAsyncCallback<Void> deletionCallback) { - super(messageProvider, data, messageProvider.getMessage(Dict.DELETE_CONFIRMATION_TITLE)); + super(viewContext, data, viewContext.getMessage(Dict.DELETE_CONFIRMATION_TITLE)); + this.viewContext = viewContext; this.deletionCallback = deletionCallback; } @@ -89,8 +93,16 @@ public abstract class AbstractDataListDeletionConfirmationDialog<T> extends /** adds invalidation option to the dialog with fiven callback */ protected void withInvalidation(AbstractAsyncCallback<Void> invalidationCallback) { - this.withInvalidationOption = true; - this.invalidationCallbackOrNull = invalidationCallback; + if (getWebClientConfiguration().getEnableInvalidation()) + { + this.withInvalidationOption = true; + this.invalidationCallbackOrNull = invalidationCallback; + } + } + + private WebClientConfiguration getWebClientConfiguration() + { + return viewContext.getModel().getApplicationInfo().getWebClientConfiguration(); } // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java index 25046d5a59a..4f48ff35be2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProvider.java @@ -72,8 +72,12 @@ public class WebClientConfigurationProvider private static final String ALLOW_ADDING_UNOFFICIAL_TERMS = "allow-adding-unofficial-terms"; + private static final String ENABLE_INVALIDATION = "enable-invalidation"; + private static final boolean DEFAULT_ALLOW_ADDING_UNOFFICIAL_TERMS = false; + private static final boolean DEFAULT_ENABLE_INVALIDATION = false; + static final String TECHNOLOGIES = "technologies"; private WebClientConfiguration webClientConfiguration = new WebClientConfiguration(); @@ -101,6 +105,7 @@ public class WebClientConfigurationProvider webClientConfiguration.setMaxVisibleColumns(DEFAULT_MAX_VISIBLE_COLUMNS); webClientConfiguration.setMaxEntityVisits(DEFAULT_MAX_ENTITY_VISITS); webClientConfiguration.setAllowAddingUnofficialTerms(DEFAULT_ALLOW_ADDING_UNOFFICIAL_TERMS); + webClientConfiguration.setEnableInvalidation(DEFAULT_ENABLE_INVALIDATION); } private void init(Properties properties) @@ -110,6 +115,7 @@ public class WebClientConfigurationProvider webClientConfiguration.setMaxVisibleColumns(extractMaxVisibleColumns(properties)); webClientConfiguration .setAllowAddingUnofficialTerms(extractAllowAddingUnofficialTerms(properties)); + webClientConfiguration.setEnableInvalidation(extractEnableInvalidation(properties)); webClientConfiguration.setMaxEntityVisits(PropertyUtils.getInt(properties, MAX_ENTITY_VISITS, DEFAULT_MAX_ENTITY_VISITS)); webClientConfiguration @@ -221,6 +227,12 @@ public class WebClientConfigurationProvider DEFAULT_ALLOW_ADDING_UNOFFICIAL_TERMS); } + private boolean extractEnableInvalidation(Properties properties) + { + return PropertyUtils.getBoolean(properties, ENABLE_INVALIDATION, + DEFAULT_ENABLE_INVALIDATION); + } + public WebClientConfiguration getWebClientConfiguration() { return webClientConfiguration; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebClientConfiguration.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebClientConfiguration.java index 12d2909ebfe..d0767334da4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebClientConfiguration.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebClientConfiguration.java @@ -53,6 +53,8 @@ public class WebClientConfiguration implements ISerializable private int maxEntityVisits; + private boolean enableInvalidation; + private boolean allowAddingUnofficielTerms; public String getPropertyOrNull(String technology, String key) @@ -126,17 +128,28 @@ public class WebClientConfiguration implements ISerializable this.maxEntityVisits = maxEntityVisits; } + public boolean getAllowAddingUnofficialTerms() + { + return allowAddingUnofficielTerms; + } + public void setAllowAddingUnofficialTerms(boolean allowAddingUnofficialTerms) { this.allowAddingUnofficielTerms = allowAddingUnofficialTerms; } - public boolean getAllowAddingUnofficialTerms() + public boolean getEnableInvalidation() { - return allowAddingUnofficielTerms; + return enableInvalidation; + } + + public void setEnableInvalidation(boolean enableInvalidation) + { + this.enableInvalidation = enableInvalidation; } public WebClientConfiguration() { } + } -- GitLab