From 05e7467ad812285bd473ce71a33dc9a7c5a094bd Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 5 Apr 2016 07:28:51 +0000
Subject: [PATCH] SSDM-3401: Java part including system tests implemented.

SVN: 36075
---
 .../asapi/v3/helper/generators/Generator.java | 14 ++-
 .../PropertyAssignmentComparatorFactory.java  | 89 +++++++++++++++++
 .../v3/helper/sort/ComparatorFactory.java     |  2 +
 .../DataSetPropertyAssignmentTranslator.java  | 58 +++++++++++
 .../entity/dataset/DataSetQuery.java          |  9 ++
 .../entity/dataset/DataSetTypeTranslator.java | 21 +++-
 .../IDataSetPropertyAssignmentTranslator.java | 29 ++++++
 ...xperimentPropertyAssignmentTranslator.java | 58 +++++++++++
 .../entity/experiment/ExperimentQuery.java    |  8 ++
 .../experiment/ExperimentTypeTranslator.java  | 21 +++-
 ...xperimentPropertyAssignmentTranslator.java | 29 ++++++
 ...IMaterialPropertyAssignmentTranslator.java | 29 ++++++
 .../MaterialPropertyAssignmentTranslator.java | 58 +++++++++++
 .../entity/material/MaterialQuery.java        | 18 +++-
 .../material/MaterialTypeTranslator.java      | 21 +++-
 .../IPropertyAssignmentTranslator.java        | 31 ++++++
 .../property/PropertyAssignmentRecord.java    | 30 ++++++
 .../PropertyAssignmentTranslator.java         | 75 +++++++++++++++
 .../entity/property/PropertyTypeQuery.java    | 38 ++++++++
 .../entity/property/PropertyTypeRecord.java   | 33 +++++++
 .../ISamplePropertyAssignmentTranslator.java  | 28 ++++++
 .../SamplePropertyAssignmentTranslator.java   | 57 +++++++++++
 .../translator/entity/sample/SampleQuery.java |  9 ++
 .../entity/sample/SampleTypeTranslator.java   | 24 ++++-
 .../systemtest/asapi/v3/MapDataSetTest.java   | 34 ++++++-
 .../asapi/v3/MapExperimentTest.java           | 31 ++++++
 .../systemtest/asapi/v3/MapMaterialTest.java  | 95 ++++++++++++++-----
 .../systemtest/asapi/v3/MapSampleTest.java    | 44 ++++++++-
 .../asapi/v3/dto/dataset/DataSetType.java     | 36 ++++++-
 .../fetchoptions/DataSetTypeFetchOptions.java | 27 ++++++
 .../v3/dto/experiment/ExperimentType.java     | 35 ++++++-
 .../ExperimentTypeFetchOptions.java           | 27 ++++++
 .../asapi/v3/dto/material/MaterialType.java   | 35 ++++++-
 .../MaterialTypeFetchOptions.java             | 27 ++++++
 .../asapi/v3/dto/property/DataTypeCode.java   | 32 +++++++
 .../v3/dto/property/PropertyAssignment.java   | 58 +++++++++++
 .../asapi/v3/dto/property/PropertyType.java   | 95 +++++++++++++++++++
 .../PropertyAssignmentFetchOptions.java       | 59 ++++++++++++
 .../PropertyAssignmentSortOptions.java        | 62 ++++++++++++
 .../asapi/v3/dto/sample/SampleType.java       | 35 ++++++-
 .../fetchoptions/SampleTypeFetchOptions.java  | 27 ++++++
 .../generic/sharedapi/v3/dictionary.txt       | 32 ++++++-
 42 files changed, 1517 insertions(+), 63 deletions(-)
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/property/PropertyAssignmentComparatorFactory.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/IDataSetPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/IExperimentPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/IMaterialPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/IPropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentRecord.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeQuery.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeRecord.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/ISamplePropertyAssignmentTranslator.java
 create mode 100644 openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SamplePropertyAssignmentTranslator.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/DataTypeCode.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentSortOptions.java

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java
index bab0dfe6d31..217e8981b95 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java
@@ -61,6 +61,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.Project;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.fetchoptions.ProjectFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectIdentifier;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectPermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleFetchOptions;
@@ -126,7 +127,6 @@ public class Generator extends AbstractGenerator
 
         // potentially missing fields:
 
-        // type.getSampleTypePropertyTypes();
         // type.getValidationScript();
 
         DtoGenerator gen = new DtoGenerator("sample", "SampleType", SampleTypeFetchOptions.class);
@@ -143,6 +143,8 @@ public class Generator extends AbstractGenerator
         addModificationDate(gen);
 
         gen.setToStringMethod("\"SampleType \" + code");
+        gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments", 
+                "Property assigments", PropertyAssignmentFetchOptions.class);
 
         return gen;
     }
@@ -212,8 +214,8 @@ public class Generator extends AbstractGenerator
         addModificationDate(gen);
 
         gen.setToStringMethod("\"ExperimentType \" + code");
-
-        // TODO add property definitions
+        gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments", 
+                "Property assigments", PropertyAssignmentFetchOptions.class);
 
         // TODO add validation script
         return gen;
@@ -275,8 +277,8 @@ public class Generator extends AbstractGenerator
         addModificationDate(gen);
 
         gen.setToStringMethod("\"DataSetType \" + code");
-
-        // TODO add property definitions
+        gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments", 
+                "Property assigments", PropertyAssignmentFetchOptions.class);
 
         // TODO add validation script
         return gen;
@@ -517,6 +519,8 @@ public class Generator extends AbstractGenerator
         addModificationDate(gen);
 
         gen.setToStringMethod("\"MaterialType \" + code");
+        gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments", 
+                "Property assigments", PropertyAssignmentFetchOptions.class);
 
         return gen;
     }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/property/PropertyAssignmentComparatorFactory.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/property/PropertyAssignmentComparatorFactory.java
new file mode 100644
index 00000000000..51977744c98
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/property/PropertyAssignmentComparatorFactory.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.helper.property;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentSortOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.AbstractStringComparator;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.ComparatorFactory;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class PropertyAssignmentComparatorFactory extends ComparatorFactory
+{
+    private static final Map<String, Comparator<PropertyAssignment>> COMPARATORS_BY_FIELD = new HashMap<>();
+    
+    static 
+    {
+        COMPARATORS_BY_FIELD.put(PropertyAssignmentSortOptions.CODE, new AbstractPropertyAssignmentComparator()
+            {
+                @Override
+                protected String getValue(PropertyType propertyType)
+                {
+                    return propertyType.getCode();
+                }
+            });
+        COMPARATORS_BY_FIELD.put(PropertyAssignmentSortOptions.LABEL, new AbstractPropertyAssignmentComparator()
+        {
+            @Override
+            protected String getValue(PropertyType propertyType)
+            {
+                return propertyType.getLabel();
+            }
+        });
+    }
+
+    @Override
+    public boolean accepts(Class<?> sortOptionsClass)
+    {
+        return PropertyAssignmentSortOptions.class.isAssignableFrom(sortOptionsClass);
+    }
+
+    @Override
+    public Comparator<PropertyAssignment> getComparator(String field)
+    {
+        return COMPARATORS_BY_FIELD.get(field);
+    }
+
+    @Override
+    public Comparator<PropertyAssignment> getDefaultComparator()
+    {
+        return COMPARATORS_BY_FIELD.get(PropertyAssignmentSortOptions.CODE);
+    }
+
+    private abstract static class AbstractPropertyAssignmentComparator extends AbstractStringComparator<PropertyAssignment>
+    {
+        @Override
+        protected String getValue(PropertyAssignment assignment)
+        {
+            PropertyType propertyType = assignment.getPropertyType();
+            String v = propertyType == null ? null : getValue(propertyType);
+            return v == null ? "" : v;
+        }
+        
+        protected abstract String getValue(PropertyType propertyType);
+        
+    }
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sort/ComparatorFactory.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sort/ComparatorFactory.java
index ae2da28fb6c..0846383fac8 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sort/ComparatorFactory.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/sort/ComparatorFactory.java
@@ -21,6 +21,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.globalsearch.GlobalSearchObjectComparatorFactory;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.property.PropertyAssignmentComparatorFactory;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.tag.TagComparatorFactory;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.vocabulary.VocabularyTermComparatorFactory;
 
@@ -40,6 +41,7 @@ public abstract class ComparatorFactory
         factories.add(new VocabularyTermComparatorFactory());
         factories.add(new EntityWithPropertiesComparatorFactory());
         factories.add(new EntityComparatorFactory());
+        factories.add(new PropertyAssignmentComparatorFactory());
     }
 
     public abstract boolean accepts(Class<?> sortOptionsClass);
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..81a7344c240
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetPropertyAssignmentTranslator.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.dataset;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentTranslator;
+
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.lemnik.eodsql.QueryTool;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component
+public class DataSetPropertyAssignmentTranslator extends PropertyAssignmentTranslator implements IDataSetPropertyAssignmentTranslator
+{
+
+    @Override
+    protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet dataSetTypeIds)
+    {
+        DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class);
+        return query.getPropertyAssignmentIds(dataSetTypeIds);
+    }
+
+    @Override
+    protected Map<Long, PropertyAssignment> translateRelated(TranslationContext context, 
+            Collection<Long> dataSetTypePropertyTypeIds, PropertyAssignmentFetchOptions relatedFetchOptions)
+    {
+        DataSetQuery query = QueryTool.getManagedQuery(DataSetQuery.class);
+        return getAssignments(query.getPropertyAssignments(new LongOpenHashSet(dataSetTypePropertyTypeIds)));
+    }
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetQuery.java
index e2d2b93c312..1972f65e214 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetQuery.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetQuery.java
@@ -22,6 +22,7 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.Obje
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.history.HistoryPropertyRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.MaterialPropertyRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyRecord;
 import ch.systemsx.cisd.common.db.mapper.LongSetMapper;
 
@@ -183,5 +184,13 @@ public interface DataSetQuery extends ObjectQuery
     @Select(sql = "select d.id as objectId, d.pers_id_modifier as relatedId from data d where d.id = any(?{1})", parameterBindings = {
             LongSetMapper.class }, fetchSize = FETCH_SIZE)
     public List<ObjectRelationRecord> getModifierIds(LongSet dataSetIds);
+    
+    @Select(sql = "select dsty_id as objectId, id as relatedId from data_set_type_property_types where dsty_id = any(?{1})", 
+            parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<ObjectRelationRecord> getPropertyAssignmentIds(LongSet dataSetTypeIds);
+    
+    @Select(sql = "select * from data_set_type_property_types where id = any(?{1})", parameterBindings = {
+            LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<PropertyAssignmentRecord> getPropertyAssignments(LongSet dataSetTypePropertyTypeIds);
 
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetTypeTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetTypeTranslator.java
index c0034883fbc..d30f1e9d925 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetTypeTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/DataSetTypeTranslator.java
@@ -16,7 +16,9 @@
 
 package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.dataset;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -25,6 +27,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetKind;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.SortAndPage;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationResults;
@@ -39,12 +43,15 @@ public class DataSetTypeTranslator extends AbstractCachingTranslator<Long, DataS
 
     @Autowired
     private IDataSetTypeBaseTranslator baseTranslator;
+    
+    @Autowired
+    private IDataSetPropertyAssignmentTranslator assignmentTranslator;
 
     @Override
     protected DataSetType createObject(TranslationContext context, Long typeId, DataSetTypeFetchOptions fetchOptions)
     {
         final DataSetType type = new DataSetType();
-        type.setFetchOptions(new DataSetTypeFetchOptions());
+        type.setFetchOptions(fetchOptions);
         return type;
     }
 
@@ -54,6 +61,11 @@ public class DataSetTypeTranslator extends AbstractCachingTranslator<Long, DataS
         TranslationResults relations = new TranslationResults();
 
         relations.put(IDataSetTypeBaseTranslator.class, baseTranslator.translate(context, typeIds, null));
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            relations.put(IDataSetPropertyAssignmentTranslator.class, 
+                    assignmentTranslator.translate(context, typeIds, fetchOptions.withPropertyAssignments()));
+        }
 
         return relations;
     }
@@ -70,6 +82,13 @@ public class DataSetTypeTranslator extends AbstractCachingTranslator<Long, DataS
         result.setKind(DataSetKind.valueOf(baseRecord.kind));
         result.setDescription(baseRecord.description);
         result.setModificationDate(baseRecord.modificationDate);
+        
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            Collection<PropertyAssignment> assignments = relations.get(IDataSetPropertyAssignmentTranslator.class, typeId);
+            List<PropertyAssignment> propertyAssignments = new ArrayList<>(assignments);
+            result.setPropertyAssignments(new SortAndPage().sortAndPage(propertyAssignments, fetchOptions.withPropertyAssignments()));
+        }
     }
 
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/IDataSetPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/IDataSetPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..937690b1290
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/dataset/IDataSetPropertyAssignmentTranslator.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.dataset;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.IPropertyAssignmentTranslator;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IDataSetPropertyAssignmentTranslator extends IPropertyAssignmentTranslator
+{
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..09ebf33caca
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentPropertyAssignmentTranslator.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.experiment;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentTranslator;
+
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.lemnik.eodsql.QueryTool;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component
+public class ExperimentPropertyAssignmentTranslator extends PropertyAssignmentTranslator implements IExperimentPropertyAssignmentTranslator
+{
+
+    @Override
+    protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet experimentTypeIds)
+    {
+        ExperimentQuery query = QueryTool.getManagedQuery(ExperimentQuery.class);
+        return query.getPropertyAssignmentIds(experimentTypeIds);
+    }
+
+    @Override
+    protected Map<Long, PropertyAssignment> translateRelated(TranslationContext context, 
+            Collection<Long> experimentTypePropertyTypeIds, PropertyAssignmentFetchOptions relatedFetchOptions)
+    {
+        ExperimentQuery query = QueryTool.getManagedQuery(ExperimentQuery.class);
+        return getAssignments(query.getPropertyAssignments(new LongOpenHashSet(experimentTypePropertyTypeIds)));
+    }
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentQuery.java
index 028087975df..5a2d48e92e8 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentQuery.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentQuery.java
@@ -26,6 +26,7 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.Obje
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.history.HistoryPropertyRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.MaterialPropertyRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyRecord;
 import ch.systemsx.cisd.common.db.mapper.LongSetMapper;
 
@@ -105,4 +106,11 @@ public interface ExperimentQuery extends ObjectQuery
     @Select(sql = "select ma.expe_id as objectId, ma.mepr_id as relatedId from metaproject_assignments ma where ma.expe_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
     public List<ObjectRelationRecord> getTagIds(LongSet experimentIds);
 
+    @Select(sql = "select exty_id as objectId, id as relatedId from experiment_type_property_types where exty_id = any(?{1})", 
+            parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<ObjectRelationRecord> getPropertyAssignmentIds(LongSet experimentTypeIds);
+    
+    @Select(sql = "select * from experiment_type_property_types where id = any(?{1})", parameterBindings = {
+            LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<PropertyAssignmentRecord> getPropertyAssignments(LongSet experimentTypePropertyTypeIds);
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentTypeTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentTypeTranslator.java
index 070d082001b..5b0239239ed 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentTypeTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/ExperimentTypeTranslator.java
@@ -16,7 +16,9 @@
 
 package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.experiment;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -24,6 +26,8 @@ import org.springframework.stereotype.Component;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.SortAndPage;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationResults;
@@ -38,12 +42,15 @@ public class ExperimentTypeTranslator extends AbstractCachingTranslator<Long, Ex
 
     @Autowired
     private IExperimentTypeBaseTranslator baseTranslator;
+    
+    @Autowired
+    private IExperimentPropertyAssignmentTranslator assignmentTranslator;
 
     @Override
     protected ExperimentType createObject(TranslationContext context, Long typeId, ExperimentTypeFetchOptions fetchOptions)
     {
         final ExperimentType type = new ExperimentType();
-        type.setFetchOptions(new ExperimentTypeFetchOptions());
+        type.setFetchOptions(fetchOptions);
         return type;
     }
 
@@ -53,6 +60,11 @@ public class ExperimentTypeTranslator extends AbstractCachingTranslator<Long, Ex
         TranslationResults relations = new TranslationResults();
 
         relations.put(IExperimentTypeBaseTranslator.class, baseTranslator.translate(context, typeIds, null));
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            relations.put(IExperimentPropertyAssignmentTranslator.class, 
+                    assignmentTranslator.translate(context, typeIds, fetchOptions.withPropertyAssignments()));
+        }
 
         return relations;
     }
@@ -68,6 +80,13 @@ public class ExperimentTypeTranslator extends AbstractCachingTranslator<Long, Ex
         result.setCode(baseRecord.code);
         result.setDescription(baseRecord.description);
         result.setModificationDate(baseRecord.modificationDate);
+        
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            Collection<PropertyAssignment> assignments = relations.get(IExperimentPropertyAssignmentTranslator.class, typeId);
+            List<PropertyAssignment> propertyAssignments = new ArrayList<>(assignments);
+            result.setPropertyAssignments(new SortAndPage().sortAndPage(propertyAssignments, fetchOptions.withPropertyAssignments()));
+        }
     }
 
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/IExperimentPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/IExperimentPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..a3495c00459
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/experiment/IExperimentPropertyAssignmentTranslator.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.experiment;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.IPropertyAssignmentTranslator;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IExperimentPropertyAssignmentTranslator extends IPropertyAssignmentTranslator
+{
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/IMaterialPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/IMaterialPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..5ed58b82217
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/IMaterialPropertyAssignmentTranslator.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.material;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.IPropertyAssignmentTranslator;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IMaterialPropertyAssignmentTranslator extends IPropertyAssignmentTranslator
+{
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..147cf880924
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialPropertyAssignmentTranslator.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.material;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentTranslator;
+
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.lemnik.eodsql.QueryTool;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component
+public class MaterialPropertyAssignmentTranslator extends PropertyAssignmentTranslator implements IMaterialPropertyAssignmentTranslator
+{
+
+    @Override
+    protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet materialTypeIds)
+    {
+        MaterialQuery query = QueryTool.getManagedQuery(MaterialQuery.class);
+        return query.getPropertyAssignmentIds(materialTypeIds);
+    }
+
+    @Override
+    protected Map<Long, PropertyAssignment> translateRelated(TranslationContext context, 
+            Collection<Long> materialTypePropertyTaypeIds, PropertyAssignmentFetchOptions relatedFetchOptions)
+    {
+        MaterialQuery query = QueryTool.getManagedQuery(MaterialQuery.class);
+        return getAssignments(query.getPropertyAssignments(new LongOpenHashSet(materialTypePropertyTaypeIds)));
+    }
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialQuery.java
index d4f41e5dd4a..78362534dd3 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialQuery.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialQuery.java
@@ -16,20 +16,20 @@
 
 package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.material;
 
-import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
-import it.unimi.dsi.fastutil.longs.LongSet;
-
 import java.util.List;
 
-import net.lemnik.eodsql.Select;
-
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectQuery;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.history.HistoryPropertyRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.MaterialPropertyRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyRecord;
 import ch.systemsx.cisd.common.db.mapper.LongSetMapper;
 
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import it.unimi.dsi.fastutil.longs.LongSet;
+import net.lemnik.eodsql.Select;
+
 /**
  * @author pkupczyk
  */
@@ -79,5 +79,13 @@ public interface MaterialQuery extends ObjectQuery
 
     @Select(sql = "select ma.mate_id as objectId, ma.mepr_id as relatedId from metaproject_assignments ma where ma.mate_id = any(?{1})", parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
     public List<ObjectRelationRecord> getTagIds(LongSet materialIds);
+    
+    @Select(sql = "select maty_id as objectId, id as relatedId from material_type_property_types where maty_id = any(?{1})", 
+            parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<ObjectRelationRecord> getPropertyAssignmentIds(LongSet materialTypeIds);
+    
+    @Select(sql = "select * from material_type_property_types where id = any(?{1})", parameterBindings = {
+            LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<PropertyAssignmentRecord> getPropertyAssignments(LongSet materialTypePropertyTypeIds);
 
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialTypeTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialTypeTranslator.java
index b2009e30608..97974c17e82 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialTypeTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/material/MaterialTypeTranslator.java
@@ -16,7 +16,9 @@
 
 package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.material;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -24,6 +26,8 @@ import org.springframework.stereotype.Component;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.MaterialType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.SortAndPage;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationResults;
@@ -38,12 +42,15 @@ public class MaterialTypeTranslator extends AbstractCachingTranslator<Long, Mate
 
     @Autowired
     private IMaterialTypeBaseTranslator baseTranslator;
+    
+    @Autowired
+    private IMaterialPropertyAssignmentTranslator assignmentTranslator;
 
     @Override
     protected MaterialType createObject(TranslationContext context, Long typeId, MaterialTypeFetchOptions fetchOptions)
     {
         final MaterialType materialType = new MaterialType();
-        materialType.setFetchOptions(new MaterialTypeFetchOptions());
+        materialType.setFetchOptions(fetchOptions);
         return materialType;
     }
 
@@ -53,6 +60,11 @@ public class MaterialTypeTranslator extends AbstractCachingTranslator<Long, Mate
         TranslationResults relations = new TranslationResults();
 
         relations.put(IMaterialTypeBaseTranslator.class, baseTranslator.translate(context, typeIds, null));
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            relations.put(IMaterialPropertyAssignmentTranslator.class, 
+                    assignmentTranslator.translate(context, typeIds, fetchOptions.withPropertyAssignments()));
+        }
 
         return relations;
     }
@@ -68,6 +80,13 @@ public class MaterialTypeTranslator extends AbstractCachingTranslator<Long, Mate
         result.setCode(baseRecord.code);
         result.setDescription(baseRecord.description);
         result.setModificationDate(baseRecord.modificationDate);
+        
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            Collection<PropertyAssignment> assignments = relations.get(IMaterialPropertyAssignmentTranslator.class, typeId);
+            List<PropertyAssignment> propertyAssignments = new ArrayList<>(assignments);
+            result.setPropertyAssignments(new SortAndPage().sortAndPage(propertyAssignments, fetchOptions.withPropertyAssignments()));
+        }
     }
 
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/IPropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/IPropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..f5e5086fa2f
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/IPropertyAssignmentTranslator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.IObjectToManyRelationTranslator;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface IPropertyAssignmentTranslator extends IObjectToManyRelationTranslator<PropertyAssignment, PropertyAssignmentFetchOptions>
+{
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentRecord.java
new file mode 100644
index 00000000000..a2ebb7e055b
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentRecord.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectBaseRecord;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class PropertyAssignmentRecord extends ObjectBaseRecord
+{
+    public Boolean is_mandatory;
+    public Long prty_id;
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..0f3dbdc19c2
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyAssignmentTranslator.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataTypeCode;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectToManyRelationTranslator;
+
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.lemnik.eodsql.QueryTool;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public abstract class PropertyAssignmentTranslator extends ObjectToManyRelationTranslator<PropertyAssignment, PropertyAssignmentFetchOptions>
+{
+    protected Map<Long, PropertyAssignment> getAssignments(Collection<PropertyAssignmentRecord> assignmentRecords)
+    {
+        Map<Long, PropertyAssignment> assignments = new HashMap<>();
+        Map<Long, PropertyAssignment> assignmentsByPropertyTypeId = new HashMap<>();
+        for (PropertyAssignmentRecord assignmentRecord : assignmentRecords)
+        {
+            PropertyAssignment assignment = new PropertyAssignment();
+            assignment.setMandatory(assignmentRecord.is_mandatory);
+            assignments.put(assignmentRecord.id, assignment);
+            assignmentsByPropertyTypeId.put(assignmentRecord.prty_id, assignment);
+        }
+        PropertyTypeQuery query = QueryTool.getManagedQuery(PropertyTypeQuery.class);
+        List<PropertyTypeRecord> propertyTypeRecords = query.getPropertyTypes(new LongOpenHashSet(assignmentsByPropertyTypeId.keySet()));
+        for (PropertyTypeRecord propertyTypeRecord : propertyTypeRecords)
+        {
+            Long propertyTypeId = propertyTypeRecord.id;
+            PropertyType propertyType = new PropertyType();
+            propertyType.setCode(propertyTypeRecord.code);
+            propertyType.setLabel(propertyTypeRecord.label);
+            propertyType.setDescription(propertyTypeRecord.description);
+            propertyType.setDataTypeCode(DataTypeCode.valueOf(propertyTypeRecord.dataSetTypeCode));
+            propertyType.setInternalNameSpace(propertyTypeRecord.is_internal_namespace);
+            PropertyAssignment assignment = assignmentsByPropertyTypeId.get(propertyTypeId);
+            assignment.setPropertyType(propertyType);
+        }
+        return assignments;
+    }
+
+
+    @Override
+    protected Collection<PropertyAssignment> createCollection()
+    {
+        return new ArrayList<>();
+    }
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeQuery.java
new file mode 100644
index 00000000000..49da3813ffe
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeQuery.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property;
+
+import java.util.List;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectQuery;
+import ch.systemsx.cisd.common.db.mapper.LongSetMapper;
+
+import it.unimi.dsi.fastutil.longs.LongSet;
+import net.lemnik.eodsql.Select;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface PropertyTypeQuery extends ObjectQuery
+{
+    @Select(sql = "select pt.*, t.code as dataSetTypeCode "
+            + "from property_types pt join data_types t on pt.daty_id=t.id where pt.id = any(?{1})", 
+            parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<PropertyTypeRecord> getPropertyTypes(LongSet propertyTypeIds);
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeRecord.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeRecord.java
new file mode 100644
index 00000000000..61a6ced468e
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/property/PropertyTypeRecord.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectBaseRecord;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class PropertyTypeRecord extends ObjectBaseRecord
+{
+    public String code;
+    public String label;
+    public String description;
+    public Boolean is_internal_namespace;
+    public String dataSetTypeCode;
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/ISamplePropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/ISamplePropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..7c62a2d03bc
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/ISamplePropertyAssignmentTranslator.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.sample;
+
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.IPropertyAssignmentTranslator;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public interface ISamplePropertyAssignmentTranslator extends IPropertyAssignmentTranslator
+{
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SamplePropertyAssignmentTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SamplePropertyAssignmentTranslator.java
new file mode 100644
index 00000000000..c3680de801e
--- /dev/null
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SamplePropertyAssignmentTranslator.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.sample;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentTranslator;
+
+import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
+import net.lemnik.eodsql.QueryTool;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@Component
+public class SamplePropertyAssignmentTranslator extends PropertyAssignmentTranslator implements ISamplePropertyAssignmentTranslator
+{
+    @Override
+    protected List<ObjectRelationRecord> loadRecords(LongOpenHashSet sampleTypeIds)
+    {
+        SampleQuery query = QueryTool.getManagedQuery(SampleQuery.class);
+        return query.getPropertyAssignmentIds(sampleTypeIds);
+    }
+
+    @Override
+    protected Map<Long, PropertyAssignment> translateRelated(TranslationContext context, 
+            Collection<Long> sampleTypePropertyTypeIds, PropertyAssignmentFetchOptions relatedFetchOptions)
+    {
+        SampleQuery query = QueryTool.getManagedQuery(SampleQuery.class);
+        return getAssignments(query.getPropertyAssignments(new LongOpenHashSet(sampleTypePropertyTypeIds)));
+    }
+
+}
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleQuery.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleQuery.java
index f767fd26f55..e3a2adeed5f 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleQuery.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleQuery.java
@@ -22,6 +22,7 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.Obje
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.common.ObjectRelationRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.history.HistoryPropertyRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.MaterialPropertyRecord;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyAssignmentRecord;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.property.PropertyRecord;
 import ch.systemsx.cisd.common.db.mapper.LongSetMapper;
 
@@ -139,4 +140,12 @@ public interface SampleQuery extends ObjectQuery
     @Select(sql = "select s.id as objectId, s.proj_id as relatedId from samples s where s.id = any(?{1})", parameterBindings = {
             LongSetMapper.class }, fetchSize = FETCH_SIZE)
     public List<ObjectRelationRecord> getProjectIds(LongSet sampleIds);
+    
+    @Select(sql = "select saty_id as objectId, id as relatedId from sample_type_property_types where saty_id = any(?{1})", 
+            parameterBindings = { LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<ObjectRelationRecord> getPropertyAssignmentIds(LongSet sampleTypeIds);
+    
+    @Select(sql = "select * from sample_type_property_types where id = any(?{1})", parameterBindings = {
+            LongSetMapper.class }, fetchSize = FETCH_SIZE)
+    public List<PropertyAssignmentRecord> getPropertyAssignments(LongSet sampleTypePropertyTypeIds);
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleTypeTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleTypeTranslator.java
index 261218dc7e2..be62800dd23 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleTypeTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/translator/entity/sample/SampleTypeTranslator.java
@@ -16,14 +16,18 @@
 
 package ch.ethz.sis.openbis.generic.server.asapi.v3.translator.entity.sample;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.SortAndPage;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.asapi.v3.translator.TranslationResults;
@@ -39,20 +43,29 @@ public class SampleTypeTranslator extends AbstractCachingTranslator<Long, Sample
     @Autowired
     private ISampleTypeBaseTranslator baseTranslator;
 
+    @Autowired
+    private ISamplePropertyAssignmentTranslator assignmentTranslator;
+
     @Override
     protected SampleType createObject(TranslationContext context, Long typeId, SampleTypeFetchOptions fetchOptions)
     {
         final SampleType type = new SampleType();
-        type.setFetchOptions(new SampleTypeFetchOptions());
+        type.setFetchOptions(fetchOptions);
         return type;
     }
 
     @Override
-    protected TranslationResults getObjectsRelations(TranslationContext context, Collection<Long> typeIds, SampleTypeFetchOptions fetchOptions)
+    protected TranslationResults getObjectsRelations(TranslationContext context, Collection<Long> typeIds, 
+            SampleTypeFetchOptions fetchOptions)
     {
         TranslationResults relations = new TranslationResults();
 
         relations.put(ISampleTypeBaseTranslator.class, baseTranslator.translate(context, typeIds, null));
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            relations.put(ISamplePropertyAssignmentTranslator.class, 
+                    assignmentTranslator.translate(context, typeIds, fetchOptions.withPropertyAssignments()));
+        }
 
         return relations;
     }
@@ -73,6 +86,13 @@ public class SampleTypeTranslator extends AbstractCachingTranslator<Long, Sample
         result.setShowParentMetadata(baseRecord.showParentMetadata);
         result.setSubcodeUnique(baseRecord.subcodeUnique);
         result.setModificationDate(baseRecord.modificationDate);
+        
+        if (fetchOptions.hasPropertyAssignments())
+        {
+            Collection<PropertyAssignment> assignments = relations.get(ISamplePropertyAssignmentTranslator.class, typeId);
+            List<PropertyAssignment> propertyAssignments = new ArrayList<>(assignments);
+            result.setPropertyAssignments(new SortAndPage().sortAndPage(propertyAssignments, fetchOptions.withPropertyAssignments()));
+        }
     }
 
 }
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapDataSetTest.java
index 081992cecab..e9482f1c98d 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapDataSetTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapDataSetTest.java
@@ -32,6 +32,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.ArchivingStatus;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.Complete;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSet;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetKind;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.FileFormatType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.LinkedData;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.LocatorType;
@@ -51,6 +52,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.history.PropertyHistoryEntry;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.history.RelationHistoryEntry;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.Material;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataTypeCode;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SampleIdentifier;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.tag.Tag;
@@ -237,6 +240,7 @@ public class MapDataSetTest extends AbstractDataSetTest
         assertEquals(dataSet.getType().getDescription(), "High Content Screening Image");
         assertEquals(dataSet.getType().getKind(), DataSetKind.PHYSICAL);
         assertEqualsDate(dataSet.getType().getModificationDate(), "2009-03-23 15:34:44");
+        assertEquals(dataSet.getType().getFetchOptions().hasPropertyAssignments(), false);
 
         assertPhysicalDataNotFetched(dataSet);
         assertExperimentNotFetched(dataSet);
@@ -272,7 +276,35 @@ public class MapDataSetTest extends AbstractDataSetTest
 
         v3api.logout(sessionToken);
     }
-
+    
+    @Test
+    public void testMapWithTypeWithPropertyAssignments()
+    {
+        String sessionToken = v3api.login(TEST_USER, PASSWORD);
+        DataSetPermId permId = new DataSetPermId("20081105092159111-1");
+        DataSetFetchOptions fetchOptions = new DataSetFetchOptions();
+        fetchOptions.withType().withPropertyAssignments().sortBy().code().desc();
+        
+        Map<IDataSetId, DataSet> map = v3api.mapDataSets(sessionToken, Arrays.asList(permId), fetchOptions);
+        
+        assertEquals(map.size(), 1);
+        DataSet dataSet = map.get(permId);
+        DataSetType type = dataSet.getType();
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), true);
+        List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments();
+        assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "GENDER");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getLabel(), "Gender");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDescription(), "The gender of the living organism");
+        assertEquals(propertyAssignments.get(0).getPropertyType().isInternalNameSpace(), false);
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDataTypeCode(), DataTypeCode.CONTROLLEDVOCABULARY);
+        assertEquals(propertyAssignments.get(0).isMandatory(), false);
+        assertEquals(propertyAssignments.get(1).getPropertyType().getCode(), "COMMENT");
+        assertEquals(propertyAssignments.get(2).getPropertyType().getCode(), "BACTERIUM");
+        assertEquals(propertyAssignments.get(3).getPropertyType().getCode(), "ANY_MATERIAL");
+        assertEquals(propertyAssignments.size(), 4);
+        v3api.logout(sessionToken);
+    }
+    
     @Test
     public void testMapWithExperiment()
     {
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapExperimentTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapExperimentTest.java
index b8f78a62c00..13139256c07 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapExperimentTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapExperimentTest.java
@@ -57,6 +57,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.Project;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectIdentifier;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectPermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataTypeCode;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.create.SampleCreation;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId;
@@ -335,9 +337,38 @@ public class MapExperimentTest extends AbstractExperimentTest
         assertRegistratorNotFetched(experiment);
         assertModifierNotFetched(experiment);
         assertAttachmentsNotFetched(experiment);
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), false);
         v3api.logout(sessionToken);
     }
 
+    @Test
+    public void testMapWithTypeAndPropertyAssignments()
+    {
+        String sessionToken = v3api.login(TEST_USER, PASSWORD);
+        ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions();
+        fetchOptions.withType().withPropertyAssignments().sortBy().code().desc();
+        ExperimentPermId permId = new ExperimentPermId("200811050951882-1028");
+        
+        Map<IExperimentId, Experiment> map = v3api.mapExperiments(sessionToken, Arrays.asList(permId), fetchOptions);
+        
+        assertEquals(1, map.size());
+        Experiment experiment = map.get(permId);
+        ExperimentType type = experiment.getType();
+        assertEquals(type.getCode(), "SIRNA_HCS");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), true);
+        List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments();
+        assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "PURCHASE_DATE");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getLabel(), "Purchased");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDescription(), "When material has been bought");
+        assertEquals(propertyAssignments.get(0).getPropertyType().isInternalNameSpace(), false);
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDataTypeCode(), DataTypeCode.TIMESTAMP);
+        assertEquals(propertyAssignments.get(0).isMandatory(), false);
+        assertEquals(propertyAssignments.get(1).getPropertyType().getCode(), "GENDER");
+        assertEquals(propertyAssignments.get(2).getPropertyType().getCode(), "DESCRIPTION");
+        assertEquals(propertyAssignments.size(), 3);
+        v3api.logout(sessionToken);
+    }
+    
     @Test
     public void testMapWithTypeReused()
     {
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapMaterialTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapMaterialTest.java
index f6d2268bc25..2e94fcd56c3 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapMaterialTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapMaterialTest.java
@@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.systemtest.asapi.v3;
 
 import static org.testng.Assert.assertEquals;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
@@ -36,6 +37,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialFe
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.IMaterialId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.update.MaterialUpdate;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataTypeCode;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.tag.Tag;
 import ch.systemsx.cisd.common.test.AssertionUtil;
 
@@ -151,32 +154,7 @@ public class MapMaterialTest extends AbstractDataSetTest
 
         v3api.logout(sessionToken);
     }
-
-    @Test
-    public void testMapWithMaterialProperties()
-    {
-        String sessionToken = v3api.login(TEST_USER, PASSWORD);
-
-        MaterialFetchOptions fetchOptions = new MaterialFetchOptions();
-        fetchOptions.withMaterialProperties().withProperties();
-
-        MaterialPermId selfParentId = new MaterialPermId("SRM_1", "SELF_REF");
-        MaterialPermId selfChildId = new MaterialPermId("SRM_1A", "SELF_REF");
-
-        Map<IMaterialId, Material> map = v3api.mapMaterials(sessionToken, Arrays.asList(selfChildId, selfParentId), fetchOptions);
-
-        Material parent = map.get(selfParentId);
-        Material child = map.get(selfChildId);
-
-        Map<String, Material> materialProperties = parent.getMaterialProperties();
-
-        Material childFromProperties = materialProperties.get("ANY_MATERIAL");
-
-        assertEquals(selfChildId, childFromProperties.getPermId());
-        assertEquals(true, child == childFromProperties);
-        assertEquals(childFromProperties.getProperties().get("DESCRIPTION"), "Material wich is attached material");
-    }
-
+    
     @Test
     public void testMapWithType()
     {
@@ -195,6 +173,71 @@ public class MapMaterialTest extends AbstractDataSetTest
         assertEquals(type.getPermId(), new EntityTypePermId("SELF_REF"));
         assertEquals(type.getDescription(), "Self Referencing Material");
         assertEqualsDate(type.getModificationDate(), "2012-03-13 15:34:44");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), false);
+        
+        v3api.logout(sessionToken);
+    }
+
+    @Test
+    public void testMapWithTypeAndPropertyAssignmentsSortByLabelDesc()
+    {
+        String sessionToken = v3api.login(TEST_USER, PASSWORD);
+        MaterialFetchOptions fetchOptions = new MaterialFetchOptions();
+        fetchOptions.withType().withPropertyAssignments().sortBy().label().desc();
+        List<MaterialPermId> materialIds = Arrays.asList(new MaterialPermId("GFP", "CONTROL"));
+        
+        Map<IMaterialId, Material> map = v3api.mapMaterials(sessionToken, materialIds, fetchOptions);
+
+        assertEquals(map.size(), 1);
+        Material material = map.values().iterator().next();
+        MaterialType type = material.getType();
+        assertEquals(type.getCode(), "CONTROL");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), true);
+        List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments();
+        assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "VOLUME");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getLabel(), "Volume");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDescription(), "The volume of this person");
+        assertEquals(propertyAssignments.get(0).getPropertyType().isInternalNameSpace(), false);
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDataTypeCode(), DataTypeCode.REAL);
+        assertEquals(propertyAssignments.get(0).isMandatory(), false);
+        assertEquals(extractCodes(propertyAssignments).toString(), 
+                "[VOLUME, IS_VALID, SIZE, PURCHASE_DATE, EYE_COLOR, DESCRIPTION]");
+        assertEquals(propertyAssignments.size(), 6);
+        
+        v3api.logout(sessionToken);
+    }
+    
+    @Test
+    public void testMapWithTypeAndPropertyAssignmentsSortByCodeAsc()
+    {
+        String sessionToken = v3api.login(TEST_USER, PASSWORD);
+        MaterialFetchOptions fetchOptions = new MaterialFetchOptions();
+        fetchOptions.withType().withPropertyAssignments().sortBy().code().asc();
+        List<MaterialPermId> materialIds = Arrays.asList(new MaterialPermId("GFP", "CONTROL"));
+        
+        Map<IMaterialId, Material> map = v3api.mapMaterials(sessionToken, materialIds, fetchOptions);
+        
+        assertEquals(map.size(), 1);
+        Material material = map.values().iterator().next();
+        MaterialType type = material.getType();
+        assertEquals(type.getCode(), "CONTROL");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), true);
+        List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments();
+        assertEquals(extractCodes(propertyAssignments).toString(), 
+                "[DESCRIPTION, EYE_COLOR, IS_VALID, PURCHASE_DATE, SIZE, VOLUME]");
+        assertEquals(propertyAssignments.size(), 6);
+        
+        v3api.logout(sessionToken);
+    }
+    
+    private List<String> extractCodes(List<PropertyAssignment> propertyAssignments)
+    {
+        List<String> codes = new ArrayList<>();
+        for (PropertyAssignment propertyAssignment : propertyAssignments)
+        {
+            codes.add(propertyAssignment.getPropertyType().getCode());
+        }
+        return codes;
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java
index 3c947c75306..e531ad3264a 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/MapSampleTest.java
@@ -51,6 +51,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.history.RelationHistoryEntry;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.Material;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.Project;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataTypeCode;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.create.SampleCreation;
@@ -1033,11 +1035,10 @@ public class MapSampleTest extends AbstractSampleTest
         String sessionToken = v3api.login(TEST_USER, PASSWORD);
         SampleFetchOptions fetchOptions = new SampleFetchOptions();
 
-        // fetch parents and their properties
         fetchOptions.withType();
 
-        Map<ISampleId, Sample> map =
-                v3api.mapSamples(sessionToken, Collections.singletonList(new SamplePermId("200811050946559-979")), fetchOptions);
+        List<SamplePermId> sampleIds = Collections.singletonList(new SamplePermId("200811050946559-979"));
+        Map<ISampleId, Sample> map = v3api.mapSamples(sessionToken, sampleIds, fetchOptions);
         List<Sample> samples = new ArrayList<Sample>(map.values());
 
         assertEquals(samples.size(), 1);
@@ -1055,6 +1056,7 @@ public class MapSampleTest extends AbstractSampleTest
         assertFalse(type.isSubcodeUnique());
         assertEquals(type.getGeneratedCodePrefix(), "S");
         assertEqualsDate(type.getModificationDate(), "2009-03-23 15:34:44");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), false);
 
         assertExperimentNotFetched(sample);
         assertPropertiesNotFetched(sample);
@@ -1063,6 +1065,42 @@ public class MapSampleTest extends AbstractSampleTest
         assertSpaceNotFetched(sample);
         v3api.logout(sessionToken);
     }
+    
+    @Test
+    public void testMapWithTypeAndPropertyAssignments()
+    {
+        String sessionToken = v3api.login(TEST_USER, PASSWORD);
+        SampleFetchOptions fetchOptions = new SampleFetchOptions();
+        fetchOptions.withType().withPropertyAssignments().sortBy().label().desc();
+        
+        List<SamplePermId> sampleIds = Collections.singletonList(new SamplePermId("200811050917877-331"));
+        Map<ISampleId, Sample> map = v3api.mapSamples(sessionToken, sampleIds, fetchOptions);
+        List<Sample> samples = new ArrayList<Sample>(map.values());
+        
+        assertEquals(samples.size(), 1);
+        
+        Sample sample = samples.get(0);
+        assertEquals(sample.getIdentifier().toString(), "/CISD/MP002-1");
+        
+        SampleType type = sample.getType();
+        assertEquals(type.getCode(), "MASTER_PLATE");
+        assertEquals(type.getFetchOptions().hasPropertyAssignments(), true);
+        List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments();
+        assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "PLATE_GEOMETRY");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getLabel(), "Plate Geometry");
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDescription(), "Plate Geometry");
+        assertEquals(propertyAssignments.get(0).getPropertyType().isInternalNameSpace(), true);
+        assertEquals(propertyAssignments.get(0).getPropertyType().getDataTypeCode(), DataTypeCode.CONTROLLEDVOCABULARY);
+        assertEquals(propertyAssignments.get(0).isMandatory(), true);
+        assertEquals(propertyAssignments.get(1).getPropertyType().getCode(), "DESCRIPTION");
+        assertEquals(propertyAssignments.get(1).getPropertyType().getLabel(), "Description");
+        assertEquals(propertyAssignments.get(1).getPropertyType().getDescription(), "A Description");
+        assertEquals(propertyAssignments.get(1).getPropertyType().isInternalNameSpace(), false);
+        assertEquals(propertyAssignments.get(1).getPropertyType().getDataTypeCode(), DataTypeCode.VARCHAR);
+        assertEquals(propertyAssignments.get(1).isMandatory(), false);
+        assertEquals(propertyAssignments.size(), 2);
+        v3api.logout(sessionToken);
+    }
 
     @Test
     public void testMapWithTypeReused()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java
index 952f1329e45..3007943d755 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java
@@ -15,18 +15,21 @@
  */
 package ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset;
 
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder;
-import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetKind;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.NotFetchedException;
 import ch.systemsx.cisd.base.annotation.JsonObject;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import java.util.Date;
 
 /*
  * Class automatically generated with DtoGenerator
@@ -54,6 +57,9 @@ public class DataSetType implements Serializable, ICodeHolder, IModificationDate
     @JsonProperty
     private Date modificationDate;
 
+    @JsonProperty
+    private List<PropertyAssignment> propertyAssignments;
+
     // Method automatically generated with DtoGenerator
     @JsonIgnore
     public DataSetTypeFetchOptions getFetchOptions()
@@ -135,6 +141,26 @@ public class DataSetType implements Serializable, ICodeHolder, IModificationDate
         this.modificationDate = modificationDate;
     }
 
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public List<PropertyAssignment> getPropertyAssignments()
+    {
+        if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments())
+        {
+            return propertyAssignments;
+        }
+        else
+        {
+            throw new NotFetchedException("Property assigments have not been fetched.");
+        }
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setPropertyAssignments(List<PropertyAssignment> propertyAssignments)
+    {
+        this.propertyAssignments = propertyAssignments;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public String toString()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/fetchoptions/DataSetTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/fetchoptions/DataSetTypeFetchOptions.java
index 1abc4317b50..29cb5687dfb 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/fetchoptions/DataSetTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/fetchoptions/DataSetTypeFetchOptions.java
@@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetType;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
@@ -30,9 +31,34 @@ public class DataSetTypeFetchOptions extends FetchOptions<DataSetType> implement
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private PropertyAssignmentFetchOptions propertyAssignments;
+
     @JsonProperty
     private DataSetTypeSortOptions sort;
 
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignments()
+    {
+        if (propertyAssignments == null)
+        {
+            propertyAssignments = new PropertyAssignmentFetchOptions();
+        }
+        return propertyAssignments;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignmentsUsing(PropertyAssignmentFetchOptions fetchOptions)
+    {
+        return propertyAssignments = fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public boolean hasPropertyAssignments()
+    {
+        return propertyAssignments != null;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public DataSetTypeSortOptions sortBy()
@@ -54,6 +80,7 @@ public class DataSetTypeFetchOptions extends FetchOptions<DataSetType> implement
     protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
     {
         FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("DataSetType", this);
+        f.addFetchOption("PropertyAssignments", propertyAssignments);
         return f;
     }
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java
index f9b2755eef6..ce9ffbab1b0 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java
@@ -15,17 +15,21 @@
  */
 package ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment;
 
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.NotFetchedException;
 import ch.systemsx.cisd.base.annotation.JsonObject;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import java.util.Date;
 
 /*
  * Class automatically generated with DtoGenerator
@@ -50,6 +54,9 @@ public class ExperimentType implements Serializable, ICodeHolder, IModificationD
     @JsonProperty
     private Date modificationDate;
 
+    @JsonProperty
+    private List<PropertyAssignment> propertyAssignments;
+
     // Method automatically generated with DtoGenerator
     @JsonIgnore
     public ExperimentTypeFetchOptions getFetchOptions()
@@ -118,6 +125,26 @@ public class ExperimentType implements Serializable, ICodeHolder, IModificationD
         this.modificationDate = modificationDate;
     }
 
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public List<PropertyAssignment> getPropertyAssignments()
+    {
+        if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments())
+        {
+            return propertyAssignments;
+        }
+        else
+        {
+            throw new NotFetchedException("Property assigments have not been fetched.");
+        }
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setPropertyAssignments(List<PropertyAssignment> propertyAssignments)
+    {
+        this.propertyAssignments = propertyAssignments;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public String toString()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentTypeFetchOptions.java
index bd7db5ba757..6ca0e6e34be 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/fetchoptions/ExperimentTypeFetchOptions.java
@@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
@@ -30,9 +31,34 @@ public class ExperimentTypeFetchOptions extends FetchOptions<ExperimentType> imp
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private PropertyAssignmentFetchOptions propertyAssignments;
+
     @JsonProperty
     private ExperimentTypeSortOptions sort;
 
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignments()
+    {
+        if (propertyAssignments == null)
+        {
+            propertyAssignments = new PropertyAssignmentFetchOptions();
+        }
+        return propertyAssignments;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignmentsUsing(PropertyAssignmentFetchOptions fetchOptions)
+    {
+        return propertyAssignments = fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public boolean hasPropertyAssignments()
+    {
+        return propertyAssignments != null;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public ExperimentTypeSortOptions sortBy()
@@ -54,6 +80,7 @@ public class ExperimentTypeFetchOptions extends FetchOptions<ExperimentType> imp
     protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
     {
         FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("ExperimentType", this);
+        f.addFetchOption("PropertyAssignments", propertyAssignments);
         return f;
     }
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java
index 53243ace6b1..8a0ca7e0f08 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java
@@ -15,17 +15,21 @@
  */
 package ch.ethz.sis.openbis.generic.asapi.v3.dto.material;
 
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.NotFetchedException;
 import ch.systemsx.cisd.base.annotation.JsonObject;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import java.util.Date;
 
 /*
  * Class automatically generated with DtoGenerator
@@ -50,6 +54,9 @@ public class MaterialType implements Serializable, ICodeHolder, IModificationDat
     @JsonProperty
     private Date modificationDate;
 
+    @JsonProperty
+    private List<PropertyAssignment> propertyAssignments;
+
     // Method automatically generated with DtoGenerator
     @JsonIgnore
     public MaterialTypeFetchOptions getFetchOptions()
@@ -118,6 +125,26 @@ public class MaterialType implements Serializable, ICodeHolder, IModificationDat
         this.modificationDate = modificationDate;
     }
 
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public List<PropertyAssignment> getPropertyAssignments()
+    {
+        if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments())
+        {
+            return propertyAssignments;
+        }
+        else
+        {
+            throw new NotFetchedException("Property assigments have not been fetched.");
+        }
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setPropertyAssignments(List<PropertyAssignment> propertyAssignments)
+    {
+        this.propertyAssignments = propertyAssignments;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public String toString()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/fetchoptions/MaterialTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/fetchoptions/MaterialTypeFetchOptions.java
index 129fd172030..7df4c0ca815 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/fetchoptions/MaterialTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/fetchoptions/MaterialTypeFetchOptions.java
@@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.MaterialType;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.io.Serializable;
@@ -30,9 +31,34 @@ public class MaterialTypeFetchOptions extends FetchOptions<MaterialType> impleme
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private PropertyAssignmentFetchOptions propertyAssignments;
+
     @JsonProperty
     private MaterialTypeSortOptions sort;
 
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignments()
+    {
+        if (propertyAssignments == null)
+        {
+            propertyAssignments = new PropertyAssignmentFetchOptions();
+        }
+        return propertyAssignments;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignmentsUsing(PropertyAssignmentFetchOptions fetchOptions)
+    {
+        return propertyAssignments = fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public boolean hasPropertyAssignments()
+    {
+        return propertyAssignments != null;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public MaterialTypeSortOptions sortBy()
@@ -54,6 +80,7 @@ public class MaterialTypeFetchOptions extends FetchOptions<MaterialType> impleme
     protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
     {
         FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("MaterialType", this);
+        f.addFetchOption("PropertyAssignments", propertyAssignments);
         return f;
     }
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/DataTypeCode.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/DataTypeCode.java
new file mode 100644
index 00000000000..f8a885c7c3b
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/DataTypeCode.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.asapi.v3.dto.property;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("as.dto.property.DataTypeCode")
+public enum DataTypeCode
+{
+    // Do not refactor names - they are stored in database.
+    INTEGER, VARCHAR, MULTILINE_VARCHAR, REAL, TIMESTAMP, BOOLEAN, CONTROLLEDVOCABULARY, MATERIAL,
+        HYPERLINK, XML;
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java
new file mode 100644
index 00000000000..6615b69ea96
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.asapi.v3.dto.property;
+
+import java.io.Serializable;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("as.dto.property.PropertyAssignment")
+public class PropertyAssignment implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    private boolean mandatory;
+    
+    private PropertyType propertyType;
+    
+    public boolean isMandatory()
+    {
+        return mandatory;
+    }
+
+    public void setMandatory(boolean mandatory)
+    {
+        this.mandatory = mandatory;
+    }
+
+    public PropertyType getPropertyType()
+    {
+        return propertyType;
+    }
+
+    public void setPropertyType(PropertyType propertyType)
+    {
+        this.propertyType = propertyType;
+    }
+
+    
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java
new file mode 100644
index 00000000000..97c4bac3137
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.asapi.v3.dto.property;
+
+import java.io.Serializable;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("as.dto.property.PropertyType")
+public class PropertyType implements ICodeHolder, Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    private String code;
+    
+    private String label;
+    
+    private String description;
+    
+    private DataTypeCode dataTypeCode;
+    
+    private boolean internalNameSpace;
+
+    @Override
+    public String getCode()
+    {
+        return code;
+    }
+
+    public void setCode(String code)
+    {
+        this.code = code;
+    }
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    public DataTypeCode getDataTypeCode()
+    {
+        return dataTypeCode;
+    }
+
+    public void setDataTypeCode(DataTypeCode dataTypeCode)
+    {
+        this.dataTypeCode = dataTypeCode;
+    }
+
+    public boolean isInternalNameSpace()
+    {
+        return internalNameSpace;
+    }
+
+    public void setInternalNameSpace(boolean internalNameSpace)
+    {
+        this.internalNameSpace = internalNameSpace;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
new file mode 100644
index 00000000000..db7f2183749
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentFetchOptions.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("as.dto.property.fetchoptions.PropertyAssignmentFetchOptions")
+public class PropertyAssignmentFetchOptions extends FetchOptions<PropertyAssignment>
+{
+
+    private static final long serialVersionUID = 1L;
+    
+    private PropertyAssignmentSortOptions sort;
+
+    @Override
+    public PropertyAssignmentSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new PropertyAssignmentSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public PropertyAssignmentSortOptions getSortBy()
+    {
+        return sort;
+    }
+    
+    @Override
+    protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
+    {
+        FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("PropertyAssignment", this);
+        return f;
+    }
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentSortOptions.java
new file mode 100644
index 00000000000..6e3cf500895
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/fetchoptions/PropertyAssignmentSortOptions.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016 ETH Zuerich, SIS
+ *
+ * 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.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.SortOptions;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.SortOrder;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+@JsonObject("as.dto.property.fetchoptions.PropertyAssignmentSortOptions")
+public class PropertyAssignmentSortOptions extends SortOptions<PropertyAssignment>
+{
+    private static final long serialVersionUID = 1L;
+    
+    @JsonIgnore
+    public static final String CODE = "CODE";
+
+    @JsonIgnore
+    public static final String LABEL = "LABEL";
+    
+    public SortOrder code()
+    {
+        return getOrCreateSorting(CODE);
+    }
+
+    public SortOrder getCode()
+    {
+        return getSorting(CODE);
+    }
+    
+    public SortOrder label()
+    {
+        return getOrCreateSorting(LABEL);
+    }
+    
+    public SortOrder getLabel()
+    {
+        return getSorting(LABEL);
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java
index 938d3a2aa4f..408dc32d19c 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java
@@ -15,17 +15,21 @@
  */
 package ch.ethz.sis.openbis.generic.asapi.v3.dto.sample;
 
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.NotFetchedException;
 import ch.systemsx.cisd.base.annotation.JsonObject;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-import java.util.Date;
 
 /*
  * Class automatically generated with DtoGenerator
@@ -65,6 +69,9 @@ public class SampleType implements Serializable, ICodeHolder, IModificationDateH
     @JsonProperty
     private Date modificationDate;
 
+    @JsonProperty
+    private List<PropertyAssignment> propertyAssignments;
+
     // Method automatically generated with DtoGenerator
     @JsonIgnore
     public SampleTypeFetchOptions getFetchOptions()
@@ -198,6 +205,26 @@ public class SampleType implements Serializable, ICodeHolder, IModificationDateH
         this.modificationDate = modificationDate;
     }
 
+    // Method automatically generated with DtoGenerator
+    @JsonIgnore
+    public List<PropertyAssignment> getPropertyAssignments()
+    {
+        if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments())
+        {
+            return propertyAssignments;
+        }
+        else
+        {
+            throw new NotFetchedException("Property assigments have not been fetched.");
+        }
+    }
+
+    // Method automatically generated with DtoGenerator
+    public void setPropertyAssignments(List<PropertyAssignment> propertyAssignments)
+    {
+        this.propertyAssignments = propertyAssignments;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public String toString()
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/fetchoptions/SampleTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/fetchoptions/SampleTypeFetchOptions.java
index 334282c709b..fbd2bbb6911 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/fetchoptions/SampleTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/fetchoptions/SampleTypeFetchOptions.java
@@ -17,6 +17,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions;
 
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.fetchoptions.FetchOptionsToStringBuilder;
+import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
 import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,9 +31,34 @@ public class SampleTypeFetchOptions extends FetchOptions<SampleType> implements
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private PropertyAssignmentFetchOptions propertyAssignments;
+
     @JsonProperty
     private SampleTypeSortOptions sort;
 
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignments()
+    {
+        if (propertyAssignments == null)
+        {
+            propertyAssignments = new PropertyAssignmentFetchOptions();
+        }
+        return propertyAssignments;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public PropertyAssignmentFetchOptions withPropertyAssignmentsUsing(PropertyAssignmentFetchOptions fetchOptions)
+    {
+        return propertyAssignments = fetchOptions;
+    }
+
+    // Method automatically generated with DtoGenerator
+    public boolean hasPropertyAssignments()
+    {
+        return propertyAssignments != null;
+    }
+
     // Method automatically generated with DtoGenerator
     @Override
     public SampleTypeSortOptions sortBy()
@@ -54,6 +80,7 @@ public class SampleTypeFetchOptions extends FetchOptions<SampleType> implements
     protected FetchOptionsToStringBuilder getFetchOptionsStringBuilder()
     {
         FetchOptionsToStringBuilder f = new FetchOptionsToStringBuilder("SampleType", this);
+        f.addFetchOption("PropertyAssignments", propertyAssignments);
         return f;
     }
 
diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt
index c4441522e01..8d4add0c175 100644
--- a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt
+++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt
@@ -1063,4 +1063,34 @@ Vocabulary Term Update
 map Vocabulary Terms
 get Replaced Id
 get Replacement Id
-Vocabulary Term Replacement
\ No newline at end of file
+Vocabulary Term Replacement
+
+BOOLEAN
+CONTROLLEDVOCABULARY
+HYPERLINK
+INTEGER
+LABEL
+MULTILINE_VARCHAR
+REAL
+TIMESTAMP
+VARCHAR
+XML
+Data Type Code
+get Data Type Code
+get Property Assignments
+get Property Type
+has Property Assignments
+is Internal Name Space
+is Mandatory
+label
+Property Assignment
+Property Assignment Fetch Options
+Property Assignment Sort Options
+Property Type
+set Data Type Code
+set Internal Name Space
+set Mandatory
+set Property Assignments
+set Property Type
+with Property Assignments
+with Property Assignments Using
-- 
GitLab