Skip to content
Snippets Groups Projects
Commit 92788074 authored by cramakri's avatar cramakri
Browse files

LMS-2474 Work on adding varchar managed properties in their own page.

SVN: 22580
parent f5cd5975
No related branches found
No related tags found
No related merge requests found
Showing
with 85 additions and 7 deletions
/*
* 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;
}
}
...@@ -83,4 +83,12 @@ public class ManagedUiDescription implements IManagedUiDescription, ISerializabl ...@@ -83,4 +83,12 @@ public class ManagedUiDescription implements IManagedUiDescription, ISerializabl
} }
setOutputWidgetDescription(tableWidget); setOutputWidgetDescription(tableWidget);
} }
public void useMultilineTextOutput(String text)
{
ManagedMultilineTextWidgetDescription textWidget =
new ManagedMultilineTextWidgetDescription();
textWidget.setText(text);
setOutputWidgetDescription(textWidget);
}
} }
...@@ -34,6 +34,11 @@ public interface IManagedUiDescription extends ISerializable ...@@ -34,6 +34,11 @@ public interface IManagedUiDescription extends ISerializable
*/ */
void useTableOutput(ITableModel tableModel); 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 * Adds a table action with given name to actions that can be performed in the user interface
* for modification of the managed property. * for modification of the managed property.
......
...@@ -24,5 +24,5 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; ...@@ -24,5 +24,5 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable;
// NOTE: This enumeration is part of the Managed Properties API. // NOTE: This enumeration is part of the Managed Properties API.
public enum ManagedOutputWidgetType implements ISerializable public enum ManagedOutputWidgetType implements ISerializable
{ {
TABLE, LABEL; TABLE, MULTILINE_TEXT;
} }
...@@ -32,6 +32,7 @@ import ch.systemsx.cisd.common.logging.LogCategory; ...@@ -32,6 +32,7 @@ import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory; 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.IManagedProperty;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiAction; 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. * Class for evaluating scripts that control managed properties.
...@@ -65,6 +66,8 @@ public class ManagedPropertyEvaluator ...@@ -65,6 +66,8 @@ public class ManagedPropertyEvaluator
private static final String PROPERTY_VARIABLE_NAME = "property"; 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 * 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. * column names is empty the value should be bound at an empty string.
...@@ -153,7 +156,7 @@ public class ManagedPropertyEvaluator ...@@ -153,7 +156,7 @@ public class ManagedPropertyEvaluator
columnNames = Collections.unmodifiableList(names); columnNames = Collections.unmodifiableList(names);
} }
public void configureUI(IManagedProperty managedProperty) public void configureUI(IManagedProperty managedProperty, EntityPropertyPE entityPropertyPE)
{ {
if (operationLog.isDebugEnabled()) if (operationLog.isDebugEnabled())
{ {
...@@ -162,6 +165,7 @@ public class ManagedPropertyEvaluator ...@@ -162,6 +165,7 @@ public class ManagedPropertyEvaluator
} }
evaluator.set(PROPERTY_VARIABLE_NAME, managedProperty); evaluator.set(PROPERTY_VARIABLE_NAME, managedProperty);
evaluator.set(PROPERTY_PE_VARIABLE_NAME, entityPropertyPE);
evaluator.evalFunction(CONFIGURE_UI_FUNCTION); evaluator.evalFunction(CONFIGURE_UI_FUNCTION);
} }
......
...@@ -86,7 +86,7 @@ final class PropertyTranslatorUtils ...@@ -86,7 +86,7 @@ final class PropertyTranslatorUtils
ManagedPropertyEvaluator evaluator = ManagedPropertyEvaluator evaluator =
ManagedPropertyEvaluatorFactory.createManagedPropertyEvaluator(script ManagedPropertyEvaluatorFactory.createManagedPropertyEvaluator(script
.getScript()); .getScript());
evaluator.configureUI(result); evaluator.configureUI(result, property);
} catch (EvaluatorException ex) } catch (EvaluatorException ex)
{ {
result.setValue(BasicConstant.ERROR_PROPERTY_PREFIX + ex.getMessage()); result.setValue(BasicConstant.ERROR_PROPERTY_PREFIX + ex.getMessage());
......
...@@ -15,7 +15,10 @@ database.create-from-scratch = false ...@@ -15,7 +15,10 @@ database.create-from-scratch = false
# For debugging set this value to true. # For debugging set this value to true.
database.script-single-step-mode = false database.script-single-step-mode = false
database.url-host-part = database.url-host-part =
# database.kind = new
# database.kind = basynthec
database.kind = test database.kind = test
# database.kind = basysbio
# database.kind = system_test_strict # database.kind = system_test_strict
# database.kind = system_test_plates_on_demand # database.kind = system_test_plates_on_demand
# database.kind = system_test_multi_groups # database.kind = system_test_multi_groups
...@@ -54,6 +57,7 @@ hibernate.search.index-base = ./targets/indices-${database.kind} ...@@ -54,6 +57,7 @@ hibernate.search.index-base = ./targets/indices-${database.kind}
# If not specified, default (SKIP_IF_MARKER_FOUND) is taken. # If not specified, default (SKIP_IF_MARKER_FOUND) is taken.
#hibernate.search.index-mode = INDEX_FROM_SCRATCH #hibernate.search.index-mode = INDEX_FROM_SCRATCH
hibernate.search.index-mode = SKIP_IF_MARKER_FOUND hibernate.search.index-mode = SKIP_IF_MARKER_FOUND
# Defines the maximum number of elements indexed before flushing the transaction-bound queue. # Defines the maximum number of elements indexed before flushing the transaction-bound queue.
# Default is 1000. # Default is 1000.
hibernate.search.batch-size = 1000 hibernate.search.batch-size = 1000
......
...@@ -39,6 +39,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiAction; ...@@ -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.IManagedUiDescription;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedInputFieldType; 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.basic.dto.api.ManagedOutputWidgetType;
import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE;
import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder; import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder;
/** /**
...@@ -86,7 +87,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit ...@@ -86,7 +87,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit
CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_OUTPUT_TEST_PY); CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_OUTPUT_TEST_PY);
ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script);
evaluator.configureUI(managedProperty); evaluator.configureUI(managedProperty, new SamplePropertyPE());
assertEquals(true, managedProperty.isOwnTab()); assertEquals(true, managedProperty.isOwnTab());
IManagedOutputWidgetDescription outputWidgetDescripion = IManagedOutputWidgetDescription outputWidgetDescripion =
managedProperty.getUiDescription().getOutputWidgetDescription(); managedProperty.getUiDescription().getOutputWidgetDescription();
...@@ -143,7 +144,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit ...@@ -143,7 +144,7 @@ public class ManagedPropertyEvaluatorTest extends AssertJUnit
CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_INPUT_TEST_PY); CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, CONFIGURE_UI_INPUT_TEST_PY);
ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script);
evaluator.configureUI(managedProperty); evaluator.configureUI(managedProperty, new SamplePropertyPE());
assertEquals(false, managedProperty.isOwnTab()); assertEquals(false, managedProperty.isOwnTab());
List<IManagedUiAction> actions = managedProperty.getUiDescription().getActions(); List<IManagedUiAction> actions = managedProperty.getUiDescription().getActions();
......
...@@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; ...@@ -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.EntityProperty;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; 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.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.ManagedPropertyEvaluator;
import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyFunctions; import ch.systemsx.cisd.openbis.generic.shared.managed_property.ManagedPropertyFunctions;
import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IElement; import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IElement;
...@@ -49,7 +50,7 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit ...@@ -49,7 +50,7 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit
CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, "structured-property-test.py"); CommonTestUtils.getResourceAsString(SCRIPT_FOLDER, "structured-property-test.py");
ManagedPropertyEvaluator evaluator = new ManagedPropertyEvaluator(script); 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 // the script will create several elements and serialize them in the property value
List<IElement> elements = List<IElement> elements =
...@@ -57,5 +58,4 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit ...@@ -57,5 +58,4 @@ public class StructuredPropertyConverterPythonTest extends AssertJUnit
assertEquals(3, elements.size()); assertEquals(3, elements.size());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment