diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedMultilineTextWidgetDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedMultilineTextWidgetDescription.java new file mode 100644 index 0000000000000000000000000000000000000000..ce1d76316499f31cd2d3ef83c04b104f0260d20f --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedMultilineTextWidgetDescription.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedOutputWidgetDescription; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedOutputWidgetType; + +/** + * {@link IManagedOutputWidgetDescription} implementation for multiline text fields. + * + * @author Piotr Buczek + */ +public class ManagedMultilineTextWidgetDescription implements IManagedOutputWidgetDescription +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private String text; + + public ManagedMultilineTextWidgetDescription() + { + } + + // + // IManagedWidgetDescription + // + + public String getText() + { + return text; + } + + public void setText(String text) + { + this.text = text; + } + + public ManagedOutputWidgetType getManagedOutputWidgetType() + { + return ManagedOutputWidgetType.MULTILINE_TEXT; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiDescription.java index f298ac9b2ac82efc75cd07e31adab44a2c6533a3..5dd0dba01449e770d2af3a9b71cc5da01b72855b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiDescription.java @@ -83,4 +83,12 @@ public class ManagedUiDescription implements IManagedUiDescription, ISerializabl } setOutputWidgetDescription(tableWidget); } + + public void useMultilineTextOutput(String text) + { + ManagedMultilineTextWidgetDescription textWidget = + new ManagedMultilineTextWidgetDescription(); + textWidget.setText(text); + setOutputWidgetDescription(textWidget); + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java index 1e189d3c4754bd891115f9da1e297ca989186633..32a8ffe6a279e2e7f73f6c5b52dc07159077c8a9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java @@ -34,6 +34,11 @@ public interface IManagedUiDescription extends ISerializable */ void useTableOutput(ITableModel tableModel); + /** + * Sets the output to be shown as a multi-line text view. + */ + void useMultilineTextOutput(String text); + /** * Adds a table action with given name to actions that can be performed in the user interface * for modification of the managed property. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ManagedOutputWidgetType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ManagedOutputWidgetType.java index 60187549004b842b25946b0ee337d5e926b3c6ee..0cbff6dfb800b44d18723cfeef5bf463aecf5304 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ManagedOutputWidgetType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ManagedOutputWidgetType.java @@ -24,5 +24,5 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; // NOTE: This enumeration is part of the Managed Properties API. public enum ManagedOutputWidgetType implements ISerializable { - TABLE, LABEL; + TABLE, MULTILINE_TEXT; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluator.java index 52e7f62c98ed39a04560bf9228c94f1417cf8f76..19e9c09b65314b2c2c2ed7ee850ddd836fd87562 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluator.java @@ -32,6 +32,7 @@ import ch.systemsx.cisd.common.logging.LogCategory; import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiAction; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; /** * Class for evaluating scripts that control managed properties. @@ -65,6 +66,8 @@ public class ManagedPropertyEvaluator private static final String PROPERTY_VARIABLE_NAME = "property"; + private static final String PROPERTY_PE_VARIABLE_NAME = "propertyPE"; + /** * Asserts that for all specified batch column names bindings are specified. If the list of * column names is empty the value should be bound at an empty string. @@ -153,7 +156,7 @@ public class ManagedPropertyEvaluator columnNames = Collections.unmodifiableList(names); } - public void configureUI(IManagedProperty managedProperty) + public void configureUI(IManagedProperty managedProperty, EntityPropertyPE entityPropertyPE) { if (operationLog.isDebugEnabled()) { @@ -162,6 +165,7 @@ public class ManagedPropertyEvaluator } evaluator.set(PROPERTY_VARIABLE_NAME, managedProperty); + evaluator.set(PROPERTY_PE_VARIABLE_NAME, entityPropertyPE); evaluator.evalFunction(CONFIGURE_UI_FUNCTION); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java index 45d6af550f90d2663bcb64e61b95ecea87f60c8e..9cb238b01a31bec194ba90a18cca60c07b3b4dad 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java @@ -86,7 +86,7 @@ final class PropertyTranslatorUtils ManagedPropertyEvaluator evaluator = ManagedPropertyEvaluatorFactory.createManagedPropertyEvaluator(script .getScript()); - evaluator.configureUI(result); + evaluator.configureUI(result, property); } catch (EvaluatorException ex) { result.setValue(BasicConstant.ERROR_PROPERTY_PREFIX + ex.getMessage()); diff --git a/openbis/source/java/service.properties b/openbis/source/java/service.properties index c7018a8dcad1664ce7bdc1bff1ba4ee9b903344b..04b001615ddca55f4b1a178941b66777d0e13890 100644 --- a/openbis/source/java/service.properties +++ b/openbis/source/java/service.properties @@ -15,7 +15,10 @@ database.create-from-scratch = false # For debugging set this value to true. database.script-single-step-mode = false database.url-host-part = +# database.kind = new +# database.kind = basynthec database.kind = test +# database.kind = basysbio # database.kind = system_test_strict # database.kind = system_test_plates_on_demand # database.kind = system_test_multi_groups @@ -54,6 +57,7 @@ hibernate.search.index-base = ./targets/indices-${database.kind} # If not specified, default (SKIP_IF_MARKER_FOUND) is taken. #hibernate.search.index-mode = INDEX_FROM_SCRATCH hibernate.search.index-mode = SKIP_IF_MARKER_FOUND + # Defines the maximum number of elements indexed before flushing the transaction-bound queue. # Default is 1000. hibernate.search.batch-size = 1000 diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluatorTest.java index cbdde2e1240d7c9fa0791f212897812870de98b9..f751b9138a876a7af77a33eade487c48e7afbdb2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/ManagedPropertyEvaluatorTest.java @@ -39,6 +39,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiAction; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiDescription; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedInputFieldType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedOutputWidgetType; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder; /** @@ -86,7 +87,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_OUTPUT_TEST_PY); ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); - evaluator.configureUI(managedProperty); + evaluator.configureUI(managedProperty, new SamplePropertyPE()); assertEquals(true, managedProperty.isOwnTab()); IManagedOutputWidgetDescription outputWidgetDescripion = managedProperty.getUiDescription().getOutputWidgetDescription(); @@ -143,7 +144,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_INPUT_TEST_PY); ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); - evaluator.configureUI(managedProperty); + evaluator.configureUI(managedProperty, new SamplePropertyPE()); assertEquals(false, managedProperty.isOwnTab()); List<IManagedUiAction> actions = managedProperty.getUiDescription().getActions(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/StructuredPropertyConverterPythonTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/StructuredPropertyConverterPythonTest.java index c44864b8c53fadfa915ca2055619f4f73ab129d8..d205edbc317901ff22601a2dbf8ac2b909755729 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/StructuredPropertyConverterPythonTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/StructuredPropertyConverterPythonTest.java @@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedProperty; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyEvaluator; import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyFunctions; import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IElement; @@ -49,7 +50,7 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, "structured-property-test.py"); ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); - evaluator.configureUI(managedProperty); + evaluator.configureUI(managedProperty, new SamplePropertyPE()); // the script will create several elements and serialize them in the property value List<IElement> elements = @@ -57,5 +58,4 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit assertEquals(3, elements.size()); } - }