From 182d900e8045a9c59cc5eeac75220407ddaa8a89 Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Wed, 12 Jan 2011 21:49:43 +0000
Subject: [PATCH] [LMS-1949] introduced ManagedValueEntityProperty

SVN: 19402
---
 .../basic/dto/AbstractEntityProperty.java     |   4 +-
 .../basic/dto/ManagedValueEntityProperty.java | 127 ++++++++++++++++++
 .../translator/EntityPropertyTranslator.java  |   4 +-
 .../translator/PropertyTranslatorUtils.java   |  35 ++++-
 .../dataset/DataSetPropertiesPanel.java       |  55 ++++----
 .../experiment/EntityPropertyGrid.java        |   6 +-
 .../experiment/ExperimentPropertiesPanel.java |  34 ++---
 .../material/GenericMaterialViewer.java       |  25 ++--
 .../sample/GenericSampleViewer.java           |   3 +
 9 files changed, 233 insertions(+), 60 deletions(-)
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedValueEntityProperty.java

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java
index 49e8eb3a14f..fb29168d71a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java
@@ -121,9 +121,9 @@ public abstract class AbstractEntityProperty implements IEntityProperty
         return propertyType + ": " + tryGetAsString();
     }
 
-    // 
+    //
     // Comparable
-    // 
+    //
 
     public int compareTo(IEntityProperty o)
     {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedValueEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedValueEntityProperty.java
new file mode 100644
index 00000000000..6395c7bcfa2
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedValueEntityProperty.java
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+/**
+ * An {@link IEntityProperty} implementation for managed properties.
+ * 
+ * @author Piotr Buczek
+ */
+public class ManagedValueEntityProperty implements IEntityProperty
+{
+
+    private static final long serialVersionUID = ServiceVersionHolder.VERSION;
+
+    private IEntityProperty delegatedProperty;
+
+    public ManagedValueEntityProperty(IEntityProperty delegatedProperty)
+    {
+        this.delegatedProperty = delegatedProperty;
+    }
+
+    //
+    // IEntityProperty delegated methods
+    //
+
+    public String tryGetAsString()
+    {
+        return delegatedProperty.tryGetAsString();
+    }
+
+    public String tryGetOriginalValue()
+    {
+        return delegatedProperty.tryGetOriginalValue();
+    }
+
+    public Material getMaterial()
+    {
+        return delegatedProperty.getMaterial();
+    }
+
+    public void setMaterial(Material material)
+    {
+        delegatedProperty.setMaterial(material);
+    }
+
+    public VocabularyTerm getVocabularyTerm()
+    {
+        return delegatedProperty.getVocabularyTerm();
+    }
+
+    public void setVocabularyTerm(VocabularyTerm vocabularyTerm)
+    {
+        delegatedProperty.setVocabularyTerm(vocabularyTerm);
+    }
+
+    public String getValue()
+    {
+        // TODO 2010-01-12, Piotr Buczek: remove special handling after testing
+        String delegatedValue = delegatedProperty.getValue();
+        return delegatedValue == null ? null : "(managed) " + delegatedValue;
+    }
+
+    public void setValue(String value)
+    {
+        delegatedProperty.setValue(value);
+    }
+
+    public PropertyType getPropertyType()
+    {
+        return delegatedProperty.getPropertyType();
+    }
+
+    public void setPropertyType(PropertyType propertyType)
+    {
+        delegatedProperty.setPropertyType(propertyType);
+    }
+
+    public void setOrdinal(Long ordinal)
+    {
+        delegatedProperty.setOrdinal(ordinal);
+    }
+
+    public Long getOrdinal()
+    {
+        return delegatedProperty.getOrdinal();
+    }
+
+    public int compareTo(IEntityProperty o)
+    {
+        return delegatedProperty.compareTo(o);
+    }
+
+    //
+    // For serialization
+    //
+
+    public ManagedValueEntityProperty()
+    {
+    }
+
+    @SuppressWarnings("unused")
+    private IEntityProperty getDelegatedProperty()
+    {
+        return delegatedProperty;
+    }
+
+    @SuppressWarnings("unused")
+    private void setDelegatedProperty(IEntityProperty delegatedProperty)
+    {
+        this.delegatedProperty = delegatedProperty;
+    }
+
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java
index 03b717c1e6c..4af3b63e2cb 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/EntityPropertyTranslator.java
@@ -42,11 +42,11 @@ public final class EntityPropertyTranslator
     public final static IEntityProperty translate(final EntityPropertyPE propertyPE,
             Map<PropertyTypePE, PropertyType> cacheOrNull)
     {
-        final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(propertyPE);
-        final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(typeCode);
+        final IEntityProperty result = PropertyTranslatorUtils.createEntityProperty(propertyPE);
         result.setPropertyType(PropertyTypeTranslator.translate(propertyPE
                 .getEntityTypePropertyType().getPropertyType(), cacheOrNull));
         result.setOrdinal(propertyPE.getEntityTypePropertyType().getOrdinal());
+        final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(propertyPE);
         switch (typeCode)
         {
             case CONTROLLEDVOCABULARY:
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 82c98e9e625..939deb768ab 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
@@ -19,10 +19,13 @@ package ch.systemsx.cisd.openbis.generic.shared.translator;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ScriptType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.ScriptPE;
 
 /**
  * Some utility methods for entity property translations.
@@ -50,10 +53,40 @@ final class PropertyTranslatorUtils
         return translateDataTypeCode(property.getEntityTypePropertyType());
     }
 
+    /**
+     * Creates an appropriate {@link IEntityProperty} for the given <var>propertyPE</var> based on
+     * its type.
+     */
+    static IEntityProperty createEntityProperty(EntityPropertyPE propertyPE)
+    {
+        final DataTypeCode typeCode = PropertyTranslatorUtils.getDataTypeCode(propertyPE);
+        final IEntityProperty basicProperty = createEntityProperty(typeCode);
+        if (propertyPE.getEntityTypePropertyType().isManaged())
+        {
+            return createManagedEntityProperty(propertyPE, basicProperty);
+        } else
+        {
+            return basicProperty;
+        }
+    }
+
+    /**
+     * Creates a managed {@link IEntityProperty} wrapping given <var>basicProperty</var>.
+     */
+    private static IEntityProperty createManagedEntityProperty(EntityPropertyPE property,
+            IEntityProperty basicProperty)
+    {
+        final ScriptPE script = property.getEntityTypePropertyType().getScript();
+        assert script != null && script.getScriptType() == ScriptType.MANAGED_PROPERTY;
+        final ManagedValueEntityProperty result = new ManagedValueEntityProperty(basicProperty);
+        // TODO 2010-01-12, Piotr Buczek: fill managed property
+        return result;
+    }
+
     /**
      * Creates an appropriate {@link IEntityProperty} for the given <var>dataTypeCode</var>.
      */
-    static IEntityProperty createEntityProperty(DataTypeCode dataTypeCode)
+    private static IEntityProperty createEntityProperty(DataTypeCode dataTypeCode)
     {
         switch (dataTypeCode)
         {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
index c18814fae09..259a90333c0 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java
@@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project;
@@ -55,8 +56,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEnti
  */
 public class DataSetPropertiesPanel extends ContentPanel
 {
-    public static final String PROPERTIES_ID_PREFIX =
-            GenericConstants.ID_PREFIX + "dataset-properties-section_";
+    public static final String PROPERTIES_ID_PREFIX = GenericConstants.ID_PREFIX
+            + "dataset-properties-section_";
 
     private final ExternalData dataset;
 
@@ -76,14 +77,14 @@ public class DataSetPropertiesPanel extends ContentPanel
         final Map<String, Object> properties = createProperties(viewContext);
         final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size());
         propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + dataset.getIdentifier());
-        propertyGrid.registerPropertyValueRenderer(Person.class, PropertyValueRenderers
-                .createPersonPropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(DataSetType.class, PropertyValueRenderers
-                .createDataSetTypePropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers
-                .createInvalidationPropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(Project.class, PropertyValueRenderers
-                .createProjectPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Person.class,
+                PropertyValueRenderers.createPersonPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(DataSetType.class,
+                PropertyValueRenderers.createDataSetTypePropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Invalidation.class,
+                PropertyValueRenderers.createInvalidationPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Project.class,
+                PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext));
         final IPropertyValueRenderer<IEntityProperty> propertyRenderer =
                 PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext);
         propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer);
@@ -93,14 +94,16 @@ public class DataSetPropertiesPanel extends ContentPanel
                 propertyRenderer);
         propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class,
                 propertyRenderer);
-        propertyGrid.registerPropertyValueRenderer(Sample.class, PropertyValueRenderers
-                .createSamplePropertyValueRenderer(viewContext, true));
-        propertyGrid.registerPropertyValueRenderer(Experiment.class, PropertyValueRenderers
-                .createExperimentPropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(ExternalData.class, PropertyValueRenderers
-                .createExternalDataPropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(DataStore.class, PropertyValueRenderers
-                .createDataStorePropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(ManagedValueEntityProperty.class,
+                propertyRenderer);
+        propertyGrid.registerPropertyValueRenderer(Sample.class,
+                PropertyValueRenderers.createSamplePropertyValueRenderer(viewContext, true));
+        propertyGrid.registerPropertyValueRenderer(Experiment.class,
+                PropertyValueRenderers.createExperimentPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(ExternalData.class,
+                PropertyValueRenderers.createExternalDataPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(DataStore.class,
+                PropertyValueRenderers.createDataStorePropertyValueRenderer(viewContext));
         propertyGrid.setProperties(properties);
         return propertyGrid;
     }
@@ -112,8 +115,8 @@ public class DataSetPropertiesPanel extends ContentPanel
         final Invalidation invalidation = dataset.getInvalidation();
         final Sample sample = dataset.getSample();
 
-        properties.put(messageProvider.getMessage(Dict.DATA_SET), new ExternalHyperlink(dataset
-                .getPermId(), dataset.getPermlink()));
+        properties.put(messageProvider.getMessage(Dict.DATA_SET),
+                new ExternalHyperlink(dataset.getPermId(), dataset.getPermlink()));
         properties.put(messageProvider.getMessage(Dict.DATA_SET_TYPE), datasetType);
 
         properties.put(messageProvider.getMessage(Dict.SOURCE_TYPE), dataset.getSourceType());
@@ -127,14 +130,14 @@ public class DataSetPropertiesPanel extends ContentPanel
         properties.put(messageProvider.getMessage(Dict.IS_COMPLETE), dataset.getComplete());
         properties.put(messageProvider.getMessage(Dict.FILE_FORMAT_TYPE), dataset
                 .getFileFormatType().getCode());
-        properties.put(messageProvider.getMessage(Dict.DATA_PRODUCER_CODE), dataset
-                .getDataProducerCode());
-        properties.put(messageProvider.getMessage(Dict.PRODUCTION_DATE), dataset
-                .getProductionDate());
+        properties.put(messageProvider.getMessage(Dict.DATA_PRODUCER_CODE),
+                dataset.getDataProducerCode());
+        properties.put(messageProvider.getMessage(Dict.PRODUCTION_DATE),
+                dataset.getProductionDate());
 
         properties.put(messageProvider.getMessage(Dict.REGISTRATOR), dataset.getRegistrator());
-        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE), dataset
-                .getRegistrationDate());
+        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE),
+                dataset.getRegistrationDate());
         properties.put(messageProvider.getMessage(Dict.PROJECT), dataset.getExperiment()
                 .getProject());
         properties.put(messageProvider.getMessage(Dict.EXPERIMENT), dataset.getExperiment());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java
index 61b2c930094..edf6a820539 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java
@@ -29,6 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty;
 
@@ -55,12 +56,13 @@ public class EntityPropertyGrid<T extends EntityType, S extends EntityTypeProper
 
     private void registerRenderers()
     {
-        final IPropertyValueRenderer<IEntityProperty> renderer = PropertyValueRenderers
-                .createEntityPropertyPropertyValueRenderer(viewContext);
+        final IPropertyValueRenderer<IEntityProperty> renderer =
+                PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext);
         grid.registerPropertyValueRenderer(EntityProperty.class, renderer);
         grid.registerPropertyValueRenderer(GenericValueEntityProperty.class, renderer);
         grid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class, renderer);
         grid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, renderer);
+        grid.registerPropertyValueRenderer(ManagedValueEntityProperty.class, renderer);
     }
 
     private final Map<String, Object> createProperties(List<P> list)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java
index f02ac1eb9bf..6fd9112cd07 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java
@@ -40,18 +40,19 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.Entit
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind;
 import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync;
 
 /**
@@ -61,8 +62,8 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientS
  */
 public class ExperimentPropertiesPanel extends ContentPanel
 {
-    public static final String PROPERTIES_ID_PREFIX =
-            GenericConstants.ID_PREFIX + "experiment-properties-section_";
+    public static final String PROPERTIES_ID_PREFIX = GenericConstants.ID_PREFIX
+            + "experiment-properties-section_";
 
     private final TechId experimentId;
 
@@ -95,14 +96,14 @@ public class ExperimentPropertiesPanel extends ContentPanel
         IMessageProvider messageProvider = viewContext;
         final PropertyGrid propertyGrid = new PropertyGrid(messageProvider, properties.size());
         propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + experimentId);
-        propertyGrid.registerPropertyValueRenderer(Person.class, PropertyValueRenderers
-                .createPersonPropertyValueRenderer(messageProvider));
-        propertyGrid.registerPropertyValueRenderer(ExperimentType.class, PropertyValueRenderers
-                .createExperimentTypePropertyValueRenderer(messageProvider));
-        propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers
-                .createInvalidationPropertyValueRenderer(messageProvider));
-        propertyGrid.registerPropertyValueRenderer(Project.class, PropertyValueRenderers
-                .createProjectPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Person.class,
+                PropertyValueRenderers.createPersonPropertyValueRenderer(messageProvider));
+        propertyGrid.registerPropertyValueRenderer(ExperimentType.class,
+                PropertyValueRenderers.createExperimentTypePropertyValueRenderer(messageProvider));
+        propertyGrid.registerPropertyValueRenderer(Invalidation.class,
+                PropertyValueRenderers.createInvalidationPropertyValueRenderer(messageProvider));
+        propertyGrid.registerPropertyValueRenderer(Project.class,
+                PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext));
         final IPropertyValueRenderer<IEntityProperty> renderer =
                 PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext);
         propertyGrid.registerPropertyValueRenderer(EntityProperty.class, renderer);
@@ -110,6 +111,7 @@ public class ExperimentPropertiesPanel extends ContentPanel
         propertyGrid.registerPropertyValueRenderer(VocabularyTermValueEntityProperty.class,
                 renderer);
         propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class, renderer);
+        propertyGrid.registerPropertyValueRenderer(ManagedValueEntityProperty.class, renderer);
         propertyGrid.setProperties(properties);
         return propertyGrid;
     }
@@ -121,12 +123,12 @@ public class ExperimentPropertiesPanel extends ContentPanel
         final ExperimentType experimentType = experiment.getExperimentType();
         final Invalidation invalidation = experiment.getInvalidation();
         properties.put(messageProvider.getMessage(Dict.EXPERIMENT), experiment.getIdentifier());
-        properties.put(messageProvider.getMessage(Dict.PERM_ID), new ExternalHyperlink(experiment
-                .getPermId(), experiment.getPermlink()));
+        properties.put(messageProvider.getMessage(Dict.PERM_ID),
+                new ExternalHyperlink(experiment.getPermId(), experiment.getPermlink()));
         properties.put(messageProvider.getMessage(Dict.EXPERIMENT_TYPE), experimentType);
         properties.put(messageProvider.getMessage(Dict.REGISTRATOR), experiment.getRegistrator());
-        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE), experiment
-                .getRegistrationDate());
+        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE),
+                experiment.getRegistrationDate());
         if (invalidation != null)
         {
             properties.put(messageProvider.getMessage(Dict.INVALIDATION), invalidation);
@@ -145,7 +147,7 @@ public class ExperimentPropertiesPanel extends ContentPanel
 
     //
     // auto-refresh
-    // 
+    //
 
     private final void updateProperties(Experiment experiment)
     {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java
index 96996c064c8..6443af4f689 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java
@@ -49,17 +49,18 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.Entit
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermValueEntityProperty;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind;
 import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync;
 
 /**
@@ -70,8 +71,8 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientS
 abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSplit<Material>
         implements IDatabaseModificationObserver
 {
-    public static final String PROPERTIES_ID_PREFIX =
-            GenericConstants.ID_PREFIX + "material-properties-section_";
+    public static final String PROPERTIES_ID_PREFIX = GenericConstants.ID_PREFIX
+            + "material-properties-section_";
 
     private static final String GENERIC_MATERIAL_VIEWER = "generic-material-viewer";
 
@@ -180,12 +181,12 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp
     {
         final Map<String, Object> properties = createProperties(viewContext, material);
         final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size());
-        propertyGrid.registerPropertyValueRenderer(Person.class, PropertyValueRenderers
-                .createPersonPropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(MaterialType.class, PropertyValueRenderers
-                .createMaterialTypePropertyValueRenderer(viewContext));
-        propertyGrid.registerPropertyValueRenderer(Invalidation.class, PropertyValueRenderers
-                .createInvalidationPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Person.class,
+                PropertyValueRenderers.createPersonPropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(MaterialType.class,
+                PropertyValueRenderers.createMaterialTypePropertyValueRenderer(viewContext));
+        propertyGrid.registerPropertyValueRenderer(Invalidation.class,
+                PropertyValueRenderers.createInvalidationPropertyValueRenderer(viewContext));
         final IPropertyValueRenderer<IEntityProperty> propertyRenderer =
                 PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext);
         propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer);
@@ -195,6 +196,8 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp
                 propertyRenderer);
         propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class,
                 propertyRenderer);
+        propertyGrid.registerPropertyValueRenderer(ManagedValueEntityProperty.class,
+                propertyRenderer);
         propertyGrid.setProperties(properties);
         propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + material.getIdentifier());
         return propertyGrid;
@@ -209,8 +212,8 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp
         properties.put(messageProvider.getMessage(Dict.MATERIAL), material.getCode());
         properties.put(messageProvider.getMessage(Dict.MATERIAL_TYPE), materialType);
         properties.put(messageProvider.getMessage(Dict.REGISTRATOR), material.getRegistrator());
-        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE), material
-                .getRegistrationDate());
+        properties.put(messageProvider.getMessage(Dict.REGISTRATION_DATE),
+                material.getRegistrationDate());
 
         final List<IEntityProperty> materialProperties = material.getProperties();
         Collections.sort(materialProperties);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
index b96888d6990..64e3ca0df27 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
@@ -66,6 +66,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialValueEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project;
@@ -335,6 +336,8 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
                 propertyValueRenderer);
         propertyGrid.registerPropertyValueRenderer(MaterialValueEntityProperty.class,
                 propertyValueRenderer);
+        propertyGrid.registerPropertyValueRenderer(ManagedValueEntityProperty.class,
+                propertyValueRenderer);
         propertyGrid.registerPropertyValueRenderer(Experiment.class,
                 PropertyValueRenderers.createExperimentPropertyValueRenderer(viewContext));
         propertyGrid.setProperties(properties);
-- 
GitLab