From 61f8059263135aa6d27015fb497fc02cf9fef241 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Tue, 26 Oct 2010 09:15:30 +0000 Subject: [PATCH] [LMS-1845] don't add dynamic properties to adaptor; ignore property type code case; SVN: 18436 --- .../dynamic_property/calculator/AbstractEntityAdaptor.java | 7 ++++++- .../cisd/openbis/generic/shared/basic/BasicConstant.java | 4 ++-- .../calculator/DynamicPropertyCalculatorTest.java | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java index 48d6cc8f94b..3c26663825a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java @@ -45,6 +45,11 @@ public class AbstractEntityAdaptor implements IEntityAdaptor { for (EntityPropertyPE property : propertiesHolder.getProperties()) { + if (property.getEntityTypePropertyType().isDynamic()) + { + // values of dynamic properties can't be referred to - it wouldn't be deterministic + continue; + } final PropertyTypePE propertyType = property.getEntityTypePropertyType().getPropertyType(); final String propertyTypeCode = propertyType.getCode(); @@ -82,7 +87,7 @@ public class AbstractEntityAdaptor implements IEntityAdaptor public IEntityPropertyAdaptor property(String propertyTypeCode) { - return propertiesByCode.get(propertyTypeCode); + return propertiesByCode.get(propertyTypeCode.toUpperCase()); } public String propertyValue(String propertyTypeCode) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicConstant.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicConstant.java index ec6f695cbbc..ac26dc4a7bf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicConstant.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicConstant.java @@ -38,10 +38,10 @@ public class BasicConstant /** Prefix of internal namespace vocabulary code. */ public static final String INTERNAL_NAMESPACE_PREFIX = "$"; - private static final int UNI_REPLACEMENT_CHAR = 0xFFFD; + private static final char UNI_REPLACEMENT_CHAR = 0xFFFD; /** Prefix of property value that contains error message. */ - public static final String ERROR_PROPERTY_PREFIX = "" + (char) UNI_REPLACEMENT_CHAR; + public static final String ERROR_PROPERTY_PREFIX = "" + UNI_REPLACEMENT_CHAR; // placeholder /** Prefix of property value that contains error message. */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java index 75d9fabaeea..1f1d225f672 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java @@ -52,9 +52,9 @@ public class DynamicPropertyCalculatorTest extends AssertJUnit final String entityCode = "ecode"; - IEntityPropertyAdaptor p1 = createProperty("p1", "v1"); - IEntityPropertyAdaptor p21 = createProperty("p2", "v21"); - IEntityPropertyAdaptor p22 = createProperty("p2", "v22"); + IEntityPropertyAdaptor p1 = createProperty("P1", "v1"); + IEntityPropertyAdaptor p21 = createProperty("P2", "v21"); + IEntityPropertyAdaptor p22 = createProperty("P2", "v22"); calculator.setEntity(createEntity(entityCode, null)); assertEquals("", calculator.evalAsString()); -- GitLab