From aeeddf436302a1ebe6da7725d5a06f17e6267e71 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Wed, 19 Aug 2015 14:18:48 +0000
Subject: [PATCH] SSDM-2294 : V3 AS API - paging and sorting of search results
 - sort and page outside of translators

SVN: 34496
---
 .../server/api/v3/ApplicationServerApi.java   |  14 +-
 .../api/v3/ApplicationServerApiLogger.java    |  14 +-
 .../dataset/DeleteDataSetExecutor.java        |   2 +-
 .../dataset/IDeleteDataSetExecutor.java       |   2 +-
 .../entity/AbstractDeleteEntityExecutor.java  |   2 +-
 .../experiment/DeleteExperimentExecutor.java  |   2 +-
 .../experiment/IDeleteExperimentExecutor.java |   2 +-
 .../material/DeleteMaterialExecutor.java      |   2 +-
 .../material/IDeleteMaterialExecutor.java     |   2 +-
 .../method/DeleteDataSetMethodExecutor.java   |   2 +-
 .../DeleteExperimentMethodExecutor.java       |   2 +-
 .../method/DeleteMaterialMethodExecutor.java  |   2 +-
 .../method/DeleteProjectMethodExecutor.java   |   2 +-
 .../method/DeleteSampleMethodExecutor.java    |   2 +-
 .../method/DeleteSpaceMethodExecutor.java     |   2 +-
 .../method/IDeleteDataSetMethodExecutor.java  |   2 +-
 .../IDeleteExperimentMethodExecutor.java      |   2 +-
 .../method/IDeleteMaterialMethodExecutor.java |   2 +-
 .../method/IDeleteProjectMethodExecutor.java  |   2 +-
 .../method/IDeleteSampleMethodExecutor.java   |   2 +-
 .../method/IDeleteSpaceMethodExecutor.java    |   2 +-
 .../method/IListDeletionMethodExecutor.java   |   2 +-
 .../method/ListDeletionMethodExecutor.java    |   2 +-
 .../SearchMaterialSqlMethodExecutor.java      |  50 ++--
 .../project/DeleteProjectExecutor.java        |   2 +-
 .../project/IDeleteProjectExecutor.java       |   2 +-
 .../executor/sample/DeleteSampleExecutor.java |   2 +-
 .../sample/IDeleteSampleExecutor.java         |   2 +-
 .../executor/space/DeleteSpaceExecutor.java   |   2 +-
 .../executor/space/IDeleteSpaceExecutor.java  |   2 +-
 .../translator/AbstractCachingTranslator.java | 126 ++------
 .../api/v3/translator/TranslationCache.java   |  27 --
 .../common/sql/ObjectBaseTranslator.java      |  10 +-
 .../sql/ObjectToManyRelationTranslator.java   |   3 +-
 .../sql/ObjectToOneRelationTranslator.java    |   3 +-
 .../entity/deletion/DeletionTranslator.java   |   6 +-
 .../entity/deletion/IDeletionTranslator.java  |   2 +-
 .../material/sql/MaterialSqlTranslator.java   |  42 ---
 .../entity/tag/sql/TagSqlTranslator.java      |  31 --
 .../api/v3/AbstractDeletionTest.java          |   2 +-
 .../api/v3/ConfirmDeletionTest.java           |   4 +-
 .../systemtest/api/v3/DeleteDataSetTest.java  |   2 +-
 .../api/v3/DeleteExperimentTest.java          |   2 +-
 .../api/v3/DeleteMaterialsTest.java           |   2 +-
 .../systemtest/api/v3/DeleteProjectTest.java  |   2 +-
 .../systemtest/api/v3/DeleteSampleTest.java   |   2 +-
 .../systemtest/api/v3/DeleteSpaceTest.java    |   2 +-
 .../systemtest/api/v3/EntityDeletionTest.java |   6 +-
 .../systemtest/api/v3/ListDeletionTest.java   |   6 +-
 .../systemtest/api/v3/RevertDeletionTest.java |   4 +-
 .../shared/api/v3/IApplicationServerApi.java  |  14 +-
 .../v3/dto/entity/attachment/Attachment.java  |   2 +-
 .../api/v3/dto/entity/dataset/DataSet.java    |   2 +-
 .../v3/dto/entity/dataset/DataSetType.java    |  12 +-
 .../v3/dto/entity/dataset/FileFormatType.java |   9 +-
 .../v3/dto/entity/dataset/LocatorType.java    |   9 +-
 .../AbstractObjectDeletionOptions.java        |   2 +-
 .../{ => entity}/deletion/DeletedObject.java  |   2 +-
 .../dto/{ => entity}/deletion/Deletion.java   |  31 +-
 .../{ => entity}/deletion/DeletionType.java   |   2 +-
 .../dataset/DataSetDeletionOptions.java       |   4 +-
 .../experiment/ExperimentDeletionOptions.java |   4 +-
 .../material/MaterialDeletionOptions.java     |   4 +-
 .../project/ProjectDeletionOptions.java       |   4 +-
 .../sample/SampleDeletionOptions.java         |   4 +-
 .../deletion/space/SpaceDeletionOptions.java  |   4 +-
 .../v3/dto/entity/experiment/Experiment.java  |   2 +-
 .../dto/entity/experiment/ExperimentType.java |  11 +-
 .../v3/dto/entity/history/HistoryEntry.java   |   2 +-
 .../api/v3/dto/entity/material/Material.java  |   2 +-
 .../v3/dto/entity/material/MaterialType.java  |  11 +-
 .../api/v3/dto/entity/person/Person.java      |   2 +-
 .../api/v3/dto/entity/sample/Sample.java      |   2 +-
 .../api/v3/dto/entity/sample/SampleType.java  |  11 +-
 .../shared/api/v3/dto/entity/space/Space.java |   2 +-
 .../v3/dto/entity/vocabulary/Vocabulary.java  |   2 +-
 .../dto/entity/vocabulary/VocabularyTerm.java |   2 +-
 .../dto/fetchoptions/EmptyFetchOptions.java   |  15 +-
 .../api/v3/dto/fetchoptions/FetchOptions.java |  31 +-
 .../fetchoptions/FetchOptionsMatchType.java   |  42 +++
 .../dto/fetchoptions/FetchOptionsMatcher.java | 272 ++++++++++++++++++
 .../attachment/AttachmentFetchOptions.java    |  22 +-
 .../attachment/AttachmentSortOptions.java     |  38 +++
 .../dataset/DataSetFetchOptions.java          |  22 +-
 .../dataset/DataSetSortOptions.java           |  38 +++
 .../dataset/DataSetTypeFetchOptions.java      |  26 +-
 .../dataset/DataSetTypeSortOptions.java       |  38 +++
 .../dataset/ExternalDataFetchOptions.java     |  22 +-
 .../dataset/ExternalDataSortOptions.java      |  38 +++
 .../dataset/FileFormatTypeFetchOptions.java   |  26 +-
 .../dataset/FileFormatTypeSortOptions.java    |  38 +++
 .../dataset/LocatorTypeFetchOptions.java      |  26 +-
 .../dataset/LocatorTypeSortOptions.java       |  38 +++
 .../deletion/DeletedObjectFetchOptions.java   |   5 +-
 .../deletion/DeletionFetchOptions.java        |  50 +++-
 .../deletion/DeletionSortOptions.java         |  38 +++
 .../experiment/ExperimentFetchOptions.java    |  22 +-
 .../experiment/ExperimentSortOptions.java     |  38 +++
 .../ExperimentTypeFetchOptions.java           |  26 +-
 .../experiment/ExperimentTypeSortOptions.java |  38 +++
 .../history/HistoryEntryFetchOptions.java     |  22 +-
 .../history/HistoryEntrySortOptions.java      |  38 +++
 .../material/MaterialFetchOptions.java        |  40 +--
 .../material/MaterialSortOptions.java         |  68 +++--
 .../material/MaterialTypeFetchOptions.java    |  26 +-
 .../material/MaterialTypeSortOptions.java     |  38 +++
 .../person/PersonFetchOptions.java            |  22 +-
 .../person/PersonSortOptions.java             |  38 +++
 .../project/ProjectFetchOptions.java          |  22 +-
 .../project/ProjectSortOptions.java           |  38 +++
 .../property/PropertyFetchOptions.java        |   6 +-
 .../sample/SampleFetchOptions.java            |  22 +-
 .../sample/SampleSortOptions.java             |  38 +++
 .../sample/SampleTypeFetchOptions.java        |  26 +-
 .../sample/SampleTypeSortOptions.java         |  38 +++
 .../fetchoptions/sort/AbstractComparator.java |  50 ++++
 .../v3/dto/fetchoptions/sort/SortAndPage.java | 253 ++++++++++++++++
 .../v3/dto/fetchoptions/sort/SortOptions.java |  64 +++++
 .../fetchoptions/{ => sort}/SortOrder.java    |   2 +-
 .../api/v3/dto/fetchoptions/sort/Sorting.java |  49 ++++
 .../fetchoptions/space/SpaceFetchOptions.java |  22 +-
 .../fetchoptions/space/SpaceSortOptions.java  |  38 +++
 .../dto/fetchoptions/tag/TagFetchOptions.java |  38 +--
 .../dto/fetchoptions/tag/TagSortOptions.java  |  68 +++--
 .../vocabulary/VocabularyFetchOptions.java    |  22 +-
 .../vocabulary/VocabularySortOptions.java     |  38 +++
 .../VocabularyTermFetchOptions.java           |  22 +-
 .../vocabulary/VocabularyTermSortOptions.java |  38 +++
 .../api/v3/dto/generators/DtoGenerator.java   |  39 ++-
 .../api/v3/dto/generators/Generator.java      |  12 +
 .../fetchoptions/FetchOptionsMatcherTest.java | 233 +++++++++++++++
 .../fetchoptions/sort/SortAndPageTest.java    | 239 +++++++++++++++
 132 files changed, 2713 insertions(+), 519 deletions(-)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/AbstractObjectDeletionOptions.java (93%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/DeletedObject.java (93%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/Deletion.java (64%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/DeletionType.java (92%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/dataset/DataSetDeletionOptions.java (83%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/experiment/ExperimentDeletionOptions.java (83%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/material/MaterialDeletionOptions.java (83%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/project/ProjectDeletionOptions.java (83%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/sample/SampleDeletionOptions.java (83%)
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/{ => entity}/deletion/space/SpaceDeletionOptions.java (83%)
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatchType.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcher.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java
 rename openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/{ => sort}/SortOrder.java (99%)
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/Sorting.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java
 create mode 100644 openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcherTest.java
 create mode 100644 openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPageTest.java

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
index 004d0f4b467..c132d629db1 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
@@ -56,15 +56,15 @@ import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateProjectM
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateSampleMethodExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.method.IUpdateSpaceMethodExecutor;
 import ch.ethz.sis.openbis.generic.shared.api.v3.IApplicationServerApi;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdate;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentUpdate;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
index f5fe5a24fc1..8e048d6c1fa 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApiLogger.java
@@ -20,15 +20,15 @@ import java.util.List;
 import java.util.Map;
 
 import ch.ethz.sis.openbis.generic.shared.api.v3.IApplicationServerApi;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdate;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentUpdate;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DeleteDataSetExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DeleteDataSetExecutor.java
index 2e112b17984..f09d9dc7c20 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DeleteDataSetExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/DeleteDataSetExecutor.java
@@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IDeleteDataSetExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IDeleteDataSetExecutor.java
index 94e6299b180..33e57ee6623 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IDeleteDataSetExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/dataset/IDeleteDataSetExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/entity/AbstractDeleteEntityExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/entity/AbstractDeleteEntityExecutor.java
index fef9a61a297..1f44403e569 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/entity/AbstractDeleteEntityExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/entity/AbstractDeleteEntityExecutor.java
@@ -24,7 +24,7 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.openbis.generic.server.ComponentNames;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/DeleteExperimentExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/DeleteExperimentExecutor.java
index bb0860ba7ce..03aea653587 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/DeleteExperimentExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/DeleteExperimentExecutor.java
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/IDeleteExperimentExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/IDeleteExperimentExecutor.java
index 10c53490007..5f5115d3b5b 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/IDeleteExperimentExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/experiment/IDeleteExperimentExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/DeleteMaterialExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/DeleteMaterialExecutor.java
index 2825fbf6380..167bfdb0d92 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/DeleteMaterialExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/DeleteMaterialExecutor.java
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.IMaterialId;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.IMaterialBO;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/IDeleteMaterialExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/IDeleteMaterialExecutor.java
index 77780300bab..224b372e050 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/IDeleteMaterialExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/material/IDeleteMaterialExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.material;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.IMaterialId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteDataSetMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteDataSetMethodExecutor.java
index 2b85dc0e1d6..f69bee28d98 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteDataSetMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteDataSetMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset.IDeleteDataSetExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteExperimentMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteExperimentMethodExecutor.java
index b32ee7b1ac8..085b30c6934 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteExperimentMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteExperimentMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment.IDeleteExperimentExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteMaterialMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteMaterialMethodExecutor.java
index 2f4053203a8..0bcd39742ce 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteMaterialMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteMaterialMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.material.IDeleteMaterialExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.IMaterialId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteProjectMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteProjectMethodExecutor.java
index 93360660f3f..711363d75d0 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteProjectMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteProjectMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.project.IDeleteProjectExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.IProjectId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSampleMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSampleMethodExecutor.java
index 3512cd5b56d..81e4977fd63 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSampleMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSampleMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.sample.IDeleteSampleExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSpaceMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSpaceMethodExecutor.java
index 83e685ac6a6..5e7a09fbc42 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSpaceMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/DeleteSpaceMethodExecutor.java
@@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.space.IDeleteSpaceExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.ISpaceId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteDataSetMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteDataSetMethodExecutor.java
index a326e80d046..20e5f776aec 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteDataSetMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteDataSetMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteExperimentMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteExperimentMethodExecutor.java
index 56f59bdbeb7..ab210deba60 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteExperimentMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteExperimentMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteMaterialMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteMaterialMethodExecutor.java
index d2a1705eee8..84f576b587f 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteMaterialMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteMaterialMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.IMaterialId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteProjectMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteProjectMethodExecutor.java
index 395ce054882..fc3c771531e 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteProjectMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteProjectMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.IProjectId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSampleMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSampleMethodExecutor.java
index d3b7c2f176b..5ee5e612b40 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSampleMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSampleMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSpaceMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSpaceMethodExecutor.java
index e9e757c1f6e..02bb6344494 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSpaceMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IDeleteSpaceMethodExecutor.java
@@ -16,7 +16,7 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.ISpaceId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IListDeletionMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IListDeletionMethodExecutor.java
index 868579a6821..2e13a0835a3 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IListDeletionMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/IListDeletionMethodExecutor.java
@@ -18,7 +18,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
 import java.util.List;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ListDeletionMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ListDeletionMethodExecutor.java
index 6af2000b790..c0cd5b68b04 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ListDeletionMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/ListDeletionMethodExecutor.java
@@ -27,7 +27,7 @@ import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.deletion.IListDeletionExecutor;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.deletion.IDeletionTranslator;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchMaterialSqlMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchMaterialSqlMethodExecutor.java
index cad95debe98..e82d7a2da21 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchMaterialSqlMethodExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/SearchMaterialSqlMethodExecutor.java
@@ -17,6 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -26,11 +27,11 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.material.ISearchMaterialIdExecutor;
-import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslationContextProvider;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.material.sql.IMaterialSqlTranslator;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortAndPage;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.MaterialSearchCriterion;
 
 /**
@@ -46,9 +47,6 @@ public class SearchMaterialSqlMethodExecutor extends AbstractMethodExecutor impl
     @Autowired
     private IMaterialSqlTranslator translator;
 
-    @Autowired
-    private ITranslationContextProvider contextProvider;
-
     @Override
     public List<Material> search(final String sessionToken, final MaterialSearchCriterion criterion, final MaterialFetchOptions fetchOptions)
     {
@@ -57,50 +55,50 @@ public class SearchMaterialSqlMethodExecutor extends AbstractMethodExecutor impl
                 @Override
                 public List<Material> execute(IOperationContext context)
                 {
-                    List<Long> results = search(context, criterion, fetchOptions);
-                    return translate(context, results, fetchOptions);
+                    Collection<Material> results = searchAndTranslate(context, criterion, fetchOptions);
+                    return sortAndPage(context, results, fetchOptions);
                 }
             });
     }
 
     @SuppressWarnings("unchecked")
-    private List<Long> search(IOperationContext context, MaterialSearchCriterion criterion, MaterialFetchOptions fetchOptions)
+    private Collection<Material> searchAndTranslate(IOperationContext context, MaterialSearchCriterion criterion, MaterialFetchOptions fetchOptions)
     {
         if (fetchOptions.getCacheMode() != null)
         {
-            List<Long> ids = (List<Long>) context.getSession().getAttributes().get(getClass().getName() + "_ids");
+            Collection<Material> results = (Collection<Material>) context.getSession().getAttributes().get(getClass().getName() + "_results");
 
-            if (ids == null)
+            if (results == null)
             {
-                ids = searchExecutor.search(context, criterion);
-                context.getSession().getAttributes().put(getClass().getName() + "_ids", ids);
+                results = doSearchAndTranslate(context, criterion, fetchOptions);
+                context.getSession().getAttributes().put(getClass().getName() + "_results", results);
             }
 
-            return ids;
+            return results;
         } else
         {
-            return searchExecutor.search(context, criterion);
+            return doSearchAndTranslate(context, criterion, fetchOptions);
         }
     }
 
-    private List<Material> translate(IOperationContext context, List<Long> peList, MaterialFetchOptions fetchOptions)
+    private Collection<Material> doSearchAndTranslate(IOperationContext context, MaterialSearchCriterion criterion, MaterialFetchOptions fetchOptions)
     {
-        if (peList == null || peList.isEmpty())
-        {
-            return Collections.emptyList();
-        }
-
-        Integer cacheMode = fetchOptions.getCacheMode();
-        cacheMode = cacheMode == null ? 0 : cacheMode;
+        List<Long> ids = searchExecutor.search(context, criterion);
+        TranslationContext translationContext = new TranslationContext(context.getSession());
+        Map<Long, Material> idToObjectMap = translator.translate(translationContext, ids, fetchOptions);
+        return idToObjectMap.values();
+    }
 
-        if (cacheMode == 999) // TODO
+    private List<Material> sortAndPage(IOperationContext context, Collection<Material> results, MaterialFetchOptions fetchOptions)
+    {
+        if (results == null || results.isEmpty())
         {
-            contextProvider.discardTranslationContext(context.getSession());
+            return Collections.emptyList();
         }
 
-        TranslationContext translationContext = contextProvider.getTranslationContext(context.getSession(), cacheMode > 0);
+        SortAndPage sap = new SortAndPage();
+        Collection<Material> objects = sap.sortAndPage(results, fetchOptions);
 
-        Map<Long, Material> peToObjectMap = translator.translate(translationContext, peList, fetchOptions);
-        return new ArrayList<Material>(peToObjectMap.values());
+        return new ArrayList<Material>(objects);
     }
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/DeleteProjectExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/DeleteProjectExecutor.java
index 061452ae55d..9b21eb67c29 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/DeleteProjectExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/DeleteProjectExecutor.java
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.IProjectId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.UnauthorizedObjectAccessException;
 import ch.systemsx.cisd.openbis.generic.server.authorization.validator.ProjectByIdentiferValidator;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/IDeleteProjectExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/IDeleteProjectExecutor.java
index b5dae2e7b6a..1dbf4881c45 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/IDeleteProjectExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/project/IDeleteProjectExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.project;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.IProjectId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/DeleteSampleExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/DeleteSampleExecutor.java
index b512f727d64..bed37204c44 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/DeleteSampleExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/DeleteSampleExecutor.java
@@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/IDeleteSampleExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/IDeleteSampleExecutor.java
index 24722abf745..b55a066a66c 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/IDeleteSampleExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/sample/IDeleteSampleExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.sample;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/DeleteSpaceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/DeleteSpaceExecutor.java
index b3727db56ac..1c23dcf78c8 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/DeleteSpaceExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/DeleteSpaceExecutor.java
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.ISpaceId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.UnauthorizedObjectAccessException;
 import ch.systemsx.cisd.openbis.generic.server.authorization.validator.SimpleSpaceValidator;
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/IDeleteSpaceExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/IDeleteSpaceExecutor.java
index 6b33b8ffb13..53f455a05db 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/IDeleteSpaceExecutor.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/space/IDeleteSpaceExecutor.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.executor.space;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.IDeleteEntityExecutor;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.space.ISpaceId;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/AbstractCachingTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/AbstractCachingTranslator.java
index 881f6772987..e19814a1a42 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/AbstractCachingTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/AbstractCachingTranslator.java
@@ -16,14 +16,11 @@
 
 package ch.ethz.sis.openbis.generic.server.api.v3.translator;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -39,7 +36,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
 /**
  * @author pkupczyk
  */
-public abstract class AbstractCachingTranslator<I, O, F> extends AbstractTranslator<I, O, F>
+public abstract class AbstractCachingTranslator<I, O, F extends FetchOptions<?>> extends AbstractTranslator<I, O, F>
 {
 
     private final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, getClass());
@@ -60,123 +57,37 @@ public abstract class AbstractCachingTranslator<I, O, F> extends AbstractTransla
         }
     }
 
-    @SuppressWarnings("unchecked")
     @Override
     protected final Map<I, O> doTranslate(TranslationContext context, Collection<I> allInputs, F fetchOptions)
     {
-        Map<I, Long> idsMap = new HashMap<>();
-        for (I input : allInputs)
-        {
-            idsMap.put(input, getId(input));
-        }
+        Map<I, O> translated = new LinkedHashMap<I, O>();
+        Map<I, O> updated = new HashMap<I, O>();
+        TranslationCache cache = context.getTranslationCache();
 
-        Map<I, O> translated = null;
+        Collection<I> inputs = doShouldTranslate(context, allInputs, fetchOptions);
 
-        if (context.getTranslationCache().hasTranslatedCollection(getClass().getName(), idsMap.values(), fetchOptions))
-        {
-            translated = (Map<I, O>) context.getTranslationCache().getTranslatedCollection(getClass().getName(), idsMap.values(), fetchOptions);
-        } else
+        for (I input : inputs)
         {
-            translated = new LinkedHashMap<I, O>();
-            Map<I, O> updated = new HashMap<I, O>();
-            TranslationCache cache = context.getTranslationCache();
-
-            Collection<I> inputs = doShouldTranslate(context, allInputs, fetchOptions);
-
-            for (I input : inputs)
+            if (cache.hasTranslatedObject(getClass().getName(), getId(input)))
             {
-                if (cache.hasTranslatedObject(getClass().getName(), getId(input)))
-                {
-                    handleAlreadyTranslatedInput(context, input, translated, updated, fetchOptions);
-                } else
-                {
-                    handleNewInput(context, input, translated, updated, fetchOptions);
-                }
-            }
-
-            if (false == updated.isEmpty())
+                handleAlreadyTranslatedInput(context, input, translated, updated, fetchOptions);
+            } else
             {
-                Object relations = getObjectsRelations(context, updated.keySet(), fetchOptions);
-
-                for (Map.Entry<I, O> updatedEntry : updated.entrySet())
-                {
-                    updateObject(context, updatedEntry.getKey(), updatedEntry.getValue(), relations, fetchOptions);
-                }
+                handleNewInput(context, input, translated, updated, fetchOptions);
             }
-
-            context.getTranslationCache().putTranslatedCollection(getClass().getName(), idsMap.values(), fetchOptions,
-                    (Map<Object, Object>) translated);
         }
 
-        translated = sort(context, translated, fetchOptions);
-        translated = page(context, translated, fetchOptions);
-
-        return translated;
-    }
-
-    private Map<I, O> sort(TranslationContext context, final Map<I, O> map, F fetchOptions)
-    {
-        final Comparator<O> comparator = getObjectComparator(context, fetchOptions);
-
-        if (comparator != null)
+        if (false == updated.isEmpty())
         {
-            Map<O, I> reversedMap = new HashMap<O, I>();
-            for (Map.Entry<I, O> entry : map.entrySet())
-            {
-                reversedMap.put(entry.getValue(), entry.getKey());
-            }
-
-            List<O> sortedList = new ArrayList<O>(map.values());
-            Collections.sort(sortedList, comparator);
+            Object relations = getObjectsRelations(context, updated.keySet(), fetchOptions);
 
-            Map<I, O> sortedMap = new LinkedHashMap<I, O>();
-
-            for (O item : sortedList)
+            for (Map.Entry<I, O> updatedEntry : updated.entrySet())
             {
-                sortedMap.put(reversedMap.get(item), item);
+                updateObject(context, updatedEntry.getKey(), updatedEntry.getValue(), relations, fetchOptions);
             }
-
-            return sortedMap;
-        } else
-        {
-            return map;
         }
-    }
-
-    private Map<I, O> page(TranslationContext context, final Map<I, O> map, F fetchOptions)
-    {
-        // TODO make all fetch options classes extends FetchOptions
-        if (fetchOptions instanceof FetchOptions)
-        {
-            Integer pageIndex = ((FetchOptions) fetchOptions).getPageIndex();
-            Integer pageSize = ((FetchOptions) fetchOptions).getPageSize();
-
-            if (pageIndex != null && pageSize != null)
-            {
-
-                Map<I, O> pagedMap = new LinkedHashMap<I, O>();
 
-                int index = 0;
-                for (Map.Entry<I, O> entry : map.entrySet())
-                {
-                    // TODO break is index > pageIndex + pageSize
-                    if (index >= pageIndex && index < pageIndex + pageSize)
-                    {
-                        pagedMap.put(entry.getKey(), entry.getValue());
-                    }
-
-                    index++;
-                }
-
-                return pagedMap;
-            } else
-            {
-                return map;
-            }
-        } else
-        {
-            return map;
-        }
+        return translated;
     }
 
     @SuppressWarnings("unchecked")
@@ -345,7 +256,7 @@ public abstract class AbstractCachingTranslator<I, O, F> extends AbstractTransla
     /**
      * Implementation of this method should create a translated version of the input object. Only basic attributes of the input object should be
      * translated here. Parts that have a corresponding fetch option should be translated in the
-     * {@link AbstractCachingTranslator#updateObject(TranslationContext, Object, Object, Object, Object)} method.
+     * {@link AbstractCachingTranslator#updateObject(TranslationContext, Object, Object, Object, FetchOptions)} method.
      */
     protected abstract O createObject(TranslationContext context, I input, F fetchOptions);
 
@@ -358,11 +269,6 @@ public abstract class AbstractCachingTranslator<I, O, F> extends AbstractTransla
         return new Object();
     }
 
-    protected Comparator<O> getObjectComparator(TranslationContext context, F fetchOptions)
-    {
-        return null;
-    }
-
     /**
      * Implementation of this method should update the translated version of the input object to meet the fetch options.
      */
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/TranslationCache.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/TranslationCache.java
index ae1309d33f9..872be0654aa 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/TranslationCache.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/TranslationCache.java
@@ -1,6 +1,5 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.translator;
 
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
@@ -25,11 +24,6 @@ public class TranslationCache
      */
     private Map<String, Object> translatedObjects = new HashMap<String, Object>();
 
-    /**
-     * Map storing already translated collections (value) for the given namespace, object ids (key) and fetchOptions
-     */
-    private Map<String, Map<Object, Object>> translatedCollections = new HashMap<String, Map<Object, Object>>();
-
     public boolean hasShouldTranslateObject(String namespace, Long objectId)
     {
         return shouldTranslateObjects.containsKey(getObjectKey(namespace, objectId));
@@ -45,21 +39,6 @@ public class TranslationCache
         shouldTranslateObjects.put(getObjectKey(namespace, objectId), shouldTranslate);
     }
 
-    public boolean hasTranslatedCollection(String namespace, Collection<Long> objectIds, Object fetchOptions)
-    {
-        return translatedCollections.containsKey(getObjectsKey(namespace, objectIds, fetchOptions));
-    }
-
-    public Map<Object, Object> getTranslatedCollection(String namespace, Collection<Long> objectIds, Object fetchOptions)
-    {
-        return translatedCollections.get(getObjectsKey(namespace, objectIds, fetchOptions));
-    }
-
-    public void putTranslatedCollection(String namespace, Collection<Long> objectIds, Object fetchOptions, Map<Object, Object> objects)
-    {
-        translatedCollections.put(getObjectsKey(namespace, objectIds, fetchOptions), objects);
-    }
-
     public boolean hasTranslatedObject(String namespace, Long objectId)
     {
         return translatedObjects.containsKey(getObjectKey(namespace, objectId));
@@ -94,10 +73,4 @@ public class TranslationCache
         return namespace + "." + objectId;
     }
 
-    private String getObjectsKey(String namespace, Collection<Long> objectIds, Object fetchOptions)
-    {
-        // TODO compare fetch options
-        return namespace + "." + objectIds.toString();
-    }
-
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java
index b61d4751acc..fc8c5a6cf47 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectBaseTranslator.java
@@ -25,22 +25,23 @@ import java.util.Map;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.EmptyFetchOptions;
 
 /**
  * @author pkupczyk
  */
 public abstract class ObjectBaseTranslator<RECORD extends ObjectBaseRecord> extends
-        AbstractCachingTranslator<Long, ObjectHolder<RECORD>, Void>
+        AbstractCachingTranslator<Long, ObjectHolder<RECORD>, EmptyFetchOptions>
 {
 
     @Override
-    protected ObjectHolder<RECORD> createObject(TranslationContext context, Long input, Void fetchOptions)
+    protected ObjectHolder<RECORD> createObject(TranslationContext context, Long input, EmptyFetchOptions fetchOptions)
     {
         return new ObjectHolder<RECORD>();
     }
 
     @Override
-    protected Object getObjectsRelations(TranslationContext context, Collection<Long> materialIds, Void fetchOptions)
+    protected Object getObjectsRelations(TranslationContext context, Collection<Long> materialIds, EmptyFetchOptions fetchOptions)
     {
         List<RECORD> records = loadRecords(new LongOpenHashSet(materialIds));
 
@@ -55,7 +56,8 @@ public abstract class ObjectBaseTranslator<RECORD extends ObjectBaseRecord> exte
 
     @SuppressWarnings("unchecked")
     @Override
-    protected void updateObject(TranslationContext context, Long materialId, ObjectHolder<RECORD> result, Object relations, Void fetchOptions)
+    protected void updateObject(TranslationContext context, Long materialId, ObjectHolder<RECORD> result, Object relations,
+            EmptyFetchOptions fetchOptions)
     {
         Map<Long, RECORD> recordMap = (Map<Long, RECORD>) relations;
         RECORD record = recordMap.get(materialId);
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToManyRelationTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToManyRelationTranslator.java
index 7ace56084a4..c7c5e2d99e2 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToManyRelationTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToManyRelationTranslator.java
@@ -26,11 +26,12 @@ import java.util.Map;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 
 /**
  * @author pkupczyk
  */
-public abstract class ObjectToManyRelationTranslator<RELATED_OBJECT, RELATED_FETCH_OPTIONS> extends
+public abstract class ObjectToManyRelationTranslator<RELATED_OBJECT, RELATED_FETCH_OPTIONS extends FetchOptions<?>> extends
         AbstractCachingTranslator<Long, ObjectHolder<Collection<RELATED_OBJECT>>, RELATED_FETCH_OPTIONS>
 {
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToOneRelationTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToOneRelationTranslator.java
index 58c0f696330..16238278048 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToOneRelationTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/common/sql/ObjectToOneRelationTranslator.java
@@ -26,11 +26,12 @@ import java.util.Map;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 
 /**
  * @author pkupczyk
  */
-public abstract class ObjectToOneRelationTranslator<RELATED_OBJECT, RELATED_FETCH_OPTIONS> extends
+public abstract class ObjectToOneRelationTranslator<RELATED_OBJECT, RELATED_FETCH_OPTIONS extends FetchOptions<?>> extends
         AbstractCachingTranslator<Long, ObjectHolder<RELATED_OBJECT>, RELATED_FETCH_OPTIONS>
 {
 
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/DeletionTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/DeletionTranslator.java
index 059e453cdf8..3ed1a6b78fd 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/DeletionTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/DeletionTranslator.java
@@ -24,8 +24,8 @@ import org.springframework.stereotype.Component;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.AbstractCachingTranslator;
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.TranslationContext;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.DeletedObject;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.DeletedObject;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
@@ -75,7 +75,7 @@ public class DeletionTranslator extends
     {
         if (fetchOptions.hasDeletedObjects())
         {
-            output.getFetchOptions().fetchDeletedObjects();
+            output.getFetchOptions().withDeletedObjects();
 
             if (input.getDeletedEntities() != null)
             {
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/IDeletionTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/IDeletionTranslator.java
index 4a69cae303f..7dabde213ae 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/IDeletionTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/deletion/IDeletionTranslator.java
@@ -17,7 +17,7 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.deletion;
 
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.ITranslator;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 
 /**
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/material/sql/MaterialSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/material/sql/MaterialSqlTranslator.java
index 26eb3a2c44e..61bb21ed63d 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/material/sql/MaterialSqlTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/material/sql/MaterialSqlTranslator.java
@@ -17,7 +17,6 @@
 package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.material.sql;
 
 import java.util.Collection;
-import java.util.Comparator;
 import java.util.Set;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -159,45 +158,4 @@ public class MaterialSqlTranslator extends AbstractCachingTranslator<Long, Mater
 
     }
 
-    @Override
-    protected Comparator<Material> getObjectComparator(TranslationContext context, final MaterialFetchOptions fetchOptions)
-    {
-        if (fetchOptions.getSortBy() == null)
-        {
-            return null;
-        }
-
-        if (fetchOptions.getSortBy().isCode())
-        {
-            return new Comparator<Material>()
-                {
-                    @Override
-                    public int compare(Material o1, Material o2)
-                    {
-                        if (fetchOptions.getSortBy().code().isAsc())
-                        {
-                            return o1.getCode().compareTo(o2.getCode());
-                        } else
-                        {
-                            return -o1.getCode().compareTo(o2.getCode());
-                        }
-                    }
-                };
-        }
-
-        if (fetchOptions.getSortBy().isRegistrationDate())
-        {
-            return new Comparator<Material>()
-                {
-                    @Override
-                    public int compare(Material o1, Material o2)
-                    {
-                        return -o1.getRegistrationDate().compareTo(o2.getRegistrationDate());
-                    }
-                };
-        }
-
-        return null;
-    }
-
 }
diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/tag/sql/TagSqlTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/tag/sql/TagSqlTranslator.java
index b22046cacc6..9fb90393e69 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/tag/sql/TagSqlTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/entity/tag/sql/TagSqlTranslator.java
@@ -19,7 +19,6 @@ package ch.ethz.sis.openbis.generic.server.api.v3.translator.entity.tag.sql;
 import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
 
 import java.util.Collection;
-import java.util.Comparator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -108,34 +107,4 @@ public class TagSqlTranslator extends AbstractCachingTranslator<Long, Tag, TagFe
         }
     }
 
-    @Override
-    protected Comparator<Tag> getObjectComparator(TranslationContext context, final TagFetchOptions fetchOptions)
-    {
-        if (fetchOptions.getSortBy() == null)
-        {
-            return null;
-        }
-
-        if (fetchOptions.getSortBy().isCode())
-        {
-            return new Comparator<Tag>()
-                {
-                    @Override
-                    public int compare(Tag o1, Tag o2)
-                    {
-                        if (fetchOptions.getSortBy().code().isAsc())
-                        {
-                            return o1.getCode().compareTo(o2.getCode());
-                        } else
-                        {
-                            return -o1.getCode().compareTo(o2.getCode());
-                        }
-                    }
-                };
-        }
-
-        return null;
-
-    }
-
 }
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/AbstractDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/AbstractDeletionTest.java
index 6b6ff412d36..69c09799135 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/AbstractDeletionTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/AbstractDeletionTest.java
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import junit.framework.Assert;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ConfirmDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ConfirmDeletionTest.java
index 88253fa4883..1fdf58c9236 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ConfirmDeletionTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ConfirmDeletionTest.java
@@ -20,8 +20,8 @@ import java.util.Collections;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteDataSetTest.java
index 0b88128f864..b1ce9714e17 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteDataSetTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteDataSetTest.java
@@ -22,7 +22,7 @@ import junit.framework.Assert;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteExperimentTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteExperimentTest.java
index b766c68c9e0..8f32ed116b9 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteExperimentTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteExperimentTest.java
@@ -22,7 +22,7 @@ import junit.framework.Assert;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteMaterialsTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteMaterialsTest.java
index 814d1085095..7af012fc441 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteMaterialsTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteMaterialsTest.java
@@ -20,7 +20,7 @@ import java.util.Collections;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.MaterialPermId;
 import ch.systemsx.cisd.common.action.IDelegatedAction;
 
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteProjectTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteProjectTest.java
index 9ac66960d4f..b9a2b45efab 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteProjectTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteProjectTest.java
@@ -20,7 +20,7 @@ import java.util.Collections;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.ProjectPermId;
 import ch.systemsx.cisd.common.action.IDelegatedAction;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSampleTest.java
index b9a266c544e..be56eb5ccfa 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSampleTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSampleTest.java
@@ -22,7 +22,7 @@ import junit.framework.Assert;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSpaceTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSpaceTest.java
index 36ccb4a3fba..4ccb435337a 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSpaceTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/DeleteSpaceTest.java
@@ -24,7 +24,7 @@ import java.util.Map;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.Space;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.SpaceCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space.SpaceFetchOptions;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/EntityDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/EntityDeletionTest.java
index aa0ab22c5a0..745abee6d86 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/EntityDeletionTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/EntityDeletionTest.java
@@ -23,9 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.testng.annotations.Test;
 
 import ch.ethz.sis.openbis.generic.shared.api.v3.IApplicationServerApi;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.SamplePermId;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ListDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ListDeletionTest.java
index fcbb82bdaa0..3c8be1643de 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ListDeletionTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/ListDeletionTest.java
@@ -23,8 +23,8 @@ import junit.framework.Assert;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId;
@@ -76,7 +76,7 @@ public class ListDeletionTest extends AbstractDeletionTest
         String sessionToken = v3api.login(TEST_USER, PASSWORD);
 
         DeletionFetchOptions fetchOptions = new DeletionFetchOptions();
-        fetchOptions.fetchDeletedObjects();
+        fetchOptions.withDeletedObjects();
         List<Deletion> beforeDeletions = v3api.listDeletions(sessionToken, fetchOptions);
 
         ExperimentPermId experimentId = createCisdExperiment();
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/RevertDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/RevertDeletionTest.java
index 19b28ee6045..b5969ac5ffd 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/RevertDeletionTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/RevertDeletionTest.java
@@ -20,8 +20,8 @@ import java.util.Collections;
 
 import org.testng.annotations.Test;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.DeletionTechId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/IApplicationServerApi.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/IApplicationServerApi.java
index c7899d07ee0..ded9320b353 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/IApplicationServerApi.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/IApplicationServerApi.java
@@ -19,15 +19,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3;
 import java.util.List;
 import java.util.Map;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.Deletion;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset.DataSetDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment.ExperimentDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material.MaterialDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project.ProjectDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample.SampleDeletionOptions;
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdate;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset.DataSetDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment.ExperimentDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material.MaterialDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project.ProjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample.SampleDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space.SpaceDeletionOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentUpdate;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/attachment/Attachment.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/attachment/Attachment.java
index 7eba14a357b..f3e39e16778 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/attachment/Attachment.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/attachment/Attachment.java
@@ -31,7 +31,7 @@ import java.util.Date;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.attachment.Attachment")
-public class Attachment implements Serializable, IRegistratorHolder, IRegistrationDateHolder
+public class Attachment implements Serializable, IRegistrationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java
index d014d5c8425..5787b31f18c 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java
@@ -46,7 +46,7 @@ import java.util.Set;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.dataset.DataSet")
-public class DataSet implements Serializable, IParentChildrenHolder<DataSet>, IModifierHolder, IModificationDateHolder, IRegistratorHolder, IPropertiesHolder, IRegistrationDateHolder, ITagsHolder
+public class DataSet implements Serializable, ITagsHolder, IRegistrationDateHolder, IPropertiesHolder, IModifierHolder, IParentChildrenHolder<DataSet>, IModificationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java
index f897cc64fb7..184df422fc9 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java
@@ -15,16 +15,16 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetKind;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.shared.api.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 {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java
index 2ef9d74714e..009bae1bc49 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java
@@ -15,13 +15,12 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset;
 
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.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;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java
index 92059a9a84e..b5a4b949def 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java
@@ -15,13 +15,12 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset;
 
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.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;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractObjectDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/AbstractObjectDeletionOptions.java
similarity index 93%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractObjectDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/AbstractObjectDeletionOptions.java
index b27774046bf..d90f459d64b 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractObjectDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/AbstractObjectDeletionOptions.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion;
 
 import java.io.Serializable;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletedObject.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletedObject.java
similarity index 93%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletedObject.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletedObject.java
index eacc3f60558..b031e7aa1f8 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletedObject.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletedObject.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion;
 
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId;
 import ch.systemsx.cisd.base.annotation.JsonObject;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/Deletion.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/Deletion.java
similarity index 64%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/Deletion.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/Deletion.java
index 2f29bce3716..cd6dfa99310 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/Deletion.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/Deletion.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 ETH Zuerich, Scientific IT Services
+ * Copyright 2014 ETH Zuerich, CISD
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,28 +13,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion;
 
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.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.List;
 
 /**
- * @author pkupczyk
+ * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
-@JsonObject("dto.deletion.Deletion")
+@JsonObject("dto.entity.deletion.Deletion")
 public class Deletion implements Serializable
 {
-
     private static final long serialVersionUID = 1L;
 
     @JsonProperty
@@ -47,41 +42,48 @@ public class Deletion implements Serializable
     private String reason;
 
     @JsonProperty
-    private List<DeletedObject> deletedObjects = new ArrayList<DeletedObject>();
+    private List<DeletedObject> deletedObjects;
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     @JsonIgnore
     public DeletionFetchOptions getFetchOptions()
     {
         return fetchOptions;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public void setFetchOptions(DeletionFetchOptions fetchOptions)
     {
         this.fetchOptions = fetchOptions;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     @JsonIgnore
     public IDeletionId getId()
     {
         return id;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public void setId(IDeletionId id)
     {
         this.id = id;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     @JsonIgnore
     public String getReason()
     {
         return reason;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public void setReason(String reason)
     {
         this.reason = reason;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     @JsonIgnore
     public List<DeletedObject> getDeletedObjects()
     {
@@ -95,6 +97,7 @@ public class Deletion implements Serializable
         }
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public void setDeletedObjects(List<DeletedObject> deletedObjects)
     {
         this.deletedObjects = deletedObjects;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletionType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletionType.java
similarity index 92%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletionType.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletionType.java
index c9840ce7aae..4e4cfb3d3e5 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletionType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/DeletionType.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion;
 
 import java.io.Serializable;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/dataset/DataSetDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/dataset/DataSetDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/dataset/DataSetDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/dataset/DataSetDeletionOptions.java
index 8df07b53ddb..689a053fd1a 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/dataset/DataSetDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/dataset/DataSetDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.dataset;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.dataset;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/experiment/ExperimentDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/experiment/ExperimentDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/experiment/ExperimentDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/experiment/ExperimentDeletionOptions.java
index a300ecf0477..ad0b4447872 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/experiment/ExperimentDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/experiment/ExperimentDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.experiment;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.experiment;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/material/MaterialDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/material/MaterialDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/material/MaterialDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/material/MaterialDeletionOptions.java
index 90dae4dd8cf..e1ed58037da 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/material/MaterialDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/material/MaterialDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.material;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.material;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/project/ProjectDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/project/ProjectDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/project/ProjectDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/project/ProjectDeletionOptions.java
index 708a21fba43..097a4405144 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/project/ProjectDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/project/ProjectDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.project;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.project;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/sample/SampleDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/sample/SampleDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/sample/SampleDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/sample/SampleDeletionOptions.java
index 73e91081e94..e8f206728c0 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/sample/SampleDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/sample/SampleDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.sample;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.sample;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/space/SpaceDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/space/SpaceDeletionOptions.java
similarity index 83%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/space/SpaceDeletionOptions.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/space/SpaceDeletionOptions.java
index 579f7fde331..ad3ce574d71 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/space/SpaceDeletionOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/deletion/space/SpaceDeletionOptions.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.space;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.space;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractObjectDeletionOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.AbstractObjectDeletionOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java
index 29b05519fb1..ba33e30ea44 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java
@@ -48,7 +48,7 @@ import java.util.Set;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.experiment.Experiment")
-public class Experiment implements Serializable, IModifierHolder, IModificationDateHolder, IAttachmentsHolder, IRegistratorHolder, IPropertiesHolder, IRegistrationDateHolder, ITagsHolder
+public class Experiment implements Serializable, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPropertiesHolder, IModifierHolder, IModificationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java
index 76a781b9610..15626352f01 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java
@@ -15,16 +15,15 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.shared.api.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 {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/history/HistoryEntry.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/history/HistoryEntry.java
index c4f575ab6a1..ac88c8256e4 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/history/HistoryEntry.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/history/HistoryEntry.java
@@ -28,7 +28,7 @@ import java.util.Date;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.history.HistoryEntry")
-public abstract class HistoryEntry implements Serializable
+public class HistoryEntry implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java
index 93679d016ad..e35e63d6b2b 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java
@@ -41,7 +41,7 @@ import java.util.Set;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.material.Material")
-public class Material implements Serializable, IModificationDateHolder, IRegistratorHolder, IPropertiesHolder, IRegistrationDateHolder, ITagsHolder
+public class Material implements Serializable, ITagsHolder, IRegistrationDateHolder, IPropertiesHolder, IModificationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java
index 2bc9242a7ac..124e888b59b 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java
@@ -15,16 +15,15 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.shared.api.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 {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java
index 7abda7cec68..2b2d8f71471 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java
@@ -33,7 +33,7 @@ import java.util.Date;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.person.Person")
-public class Person implements Serializable, ISpaceHolder, IRegistratorHolder, IRegistrationDateHolder
+public class Person implements Serializable, IRegistrationDateHolder, ISpaceHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java
index 14177541979..e6aa3967df4 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java
@@ -51,7 +51,7 @@ import java.util.Set;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.sample.Sample")
-public class Sample implements Serializable, ISpaceHolder, IModifierHolder, IModificationDateHolder, IAttachmentsHolder, IRegistratorHolder, IPropertiesHolder, IRegistrationDateHolder, ITagsHolder, IParentChildrenHolder<Sample>
+public class Sample implements Serializable, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPropertiesHolder, ISpaceHolder, IModifierHolder, IModificationDateHolder, IParentChildrenHolder<Sample>, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java
index bf58714e14c..8eda4563302 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java
@@ -15,16 +15,15 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample;
 
-import java.io.Serializable;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample.SampleTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId;
+import ch.ethz.sis.openbis.generic.shared.api.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 {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java
index 3455de54527..e408e165032 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java
@@ -34,7 +34,7 @@ import java.util.List;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.space.Space")
-public class Space implements Serializable, IRegistratorHolder, IRegistrationDateHolder
+public class Space implements Serializable, IRegistrationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java
index 68282f1a00a..092e381364e 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java
@@ -31,7 +31,7 @@ import java.util.Date;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.vocabulary.Vocabulary")
-public class Vocabulary implements Serializable, IModificationDateHolder, IRegistratorHolder, IRegistrationDateHolder
+public class Vocabulary implements Serializable, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java
index b6c78b61e3e..ab6b6883667 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java
@@ -32,7 +32,7 @@ import java.util.Date;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.entity.vocabulary.VocabularyTerm")
-public class VocabularyTerm implements Serializable, IModificationDateHolder, IRegistratorHolder, IRegistrationDateHolder
+public class VocabularyTerm implements Serializable, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder
 {
     private static final long serialVersionUID = 1L;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/EmptyFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/EmptyFetchOptions.java
index e100bdac659..1747fa93fc8 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/EmptyFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/EmptyFetchOptions.java
@@ -1,11 +1,24 @@
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 @JsonObject("dto.fetchoptions.EmptyFetchOptions")
-public class EmptyFetchOptions extends FetchOptions
+public class EmptyFetchOptions extends FetchOptions<Void>
 {
 
     private static final long serialVersionUID = 1L;
 
+    @Override
+    public SortOptions<Void> sortBy()
+    {
+        return null;
+    }
+
+    @Override
+    public SortOptions<Void> getSortBy()
+    {
+        return null;
+    }
+
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptions.java
index 0e2e8bc91f0..01ef5fe2449 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptions.java
@@ -2,43 +2,46 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
 
 import java.io.Serializable;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 @JsonObject("dto.fetchoptions.FetchOptions")
-public abstract class FetchOptions implements Serializable
+public abstract class FetchOptions<OBJECT> implements Serializable
 {
 
     private static final long serialVersionUID = 1L;
 
-    private Integer pageSize;
+    private Integer count;
 
-    private Integer pageIndex;
+    private Integer from;
 
     private Integer cacheMode;
 
-    public FetchOptions count(Integer size)
+    @SuppressWarnings("hiding")
+    public FetchOptions<OBJECT> count(Integer count)
     {
-        this.pageSize = size;
+        this.count = count;
         return this;
     }
 
-    public Integer getPageSize()
+    public Integer getCount()
     {
-        return pageSize;
+        return count;
     }
 
-    public FetchOptions from(Integer index)
+    @SuppressWarnings("hiding")
+    public FetchOptions<OBJECT> from(Integer from)
     {
-        this.pageIndex = index;
+        this.from = from;
         return this;
     }
 
-    public Integer getPageIndex()
+    public Integer getFrom()
     {
-        return pageIndex;
+        return from;
     }
 
-    public FetchOptions cacheMode(Integer mode)
+    public FetchOptions<OBJECT> cacheMode(Integer mode)
     {
         this.cacheMode = mode;
         return this;
@@ -49,4 +52,8 @@ public abstract class FetchOptions implements Serializable
         return cacheMode;
     }
 
+    public abstract SortOptions<OBJECT> sortBy();
+
+    public abstract SortOptions<OBJECT> getSortBy();
+
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatchType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatchType.java
new file mode 100644
index 00000000000..eca4466e71e
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatchType.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
+
+public enum FetchOptionsMatchType
+{
+
+    ALL_PARTS_AND_ALL_PAGING_AND_SORTING
+    {
+        @Override
+        public boolean isBetterThan(FetchOptionsMatchType matchType)
+        {
+            return matchType == ALL_PARTS_AND_SUB_PAGING_AND_SORTING;
+        }
+
+    },
+    ALL_PARTS_AND_SUB_PAGING_AND_SORTING
+    {
+        @Override
+        public boolean isBetterThan(FetchOptionsMatchType matchType)
+        {
+            return false;
+        }
+    };
+
+    public abstract boolean isBetterThan(FetchOptionsMatchType matchType);
+
+}
\ No newline at end of file
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcher.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcher.java
new file mode 100644
index 00000000000..41029031f9b
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcher.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author pkupczyk
+ */
+public class FetchOptionsMatcher
+{
+
+    public static FetchOptionsMatchType match(Object fo1, Object fo2)
+    {
+        if (fo1 == fo2)
+        {
+            return FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING;
+        }
+        if (fo1 == null || fo2 == null)
+        {
+            return null;
+        }
+        if (false == fo1.getClass().equals(fo2.getClass()))
+        {
+            return null;
+        }
+
+        if (arePartsEqual(fo1, fo2) && areSubLevelPagingAndSortingEqual(fo1, fo2))
+        {
+            if (areTopLevelPagingAndSortingEqual(fo1, fo2))
+            {
+                return FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING;
+            } else
+            {
+                return FetchOptionsMatchType.ALL_PARTS_AND_SUB_PAGING_AND_SORTING;
+            }
+        } else
+        {
+            return null;
+        }
+    }
+
+    private static boolean arePartsEqual(Object o1, Object o2)
+    {
+        return areEqual(o1, o2, new PartsMatcher());
+    }
+
+    private static boolean areTopLevelPagingAndSortingEqual(Object o1, Object o2)
+    {
+        return areEqual(o1, o2, new TopLevelPagingAndSortingMatcher());
+    }
+
+    private static boolean areSubLevelPagingAndSortingEqual(Object o1, Object o2)
+    {
+        return areEqual(o1, o2, new SubLevelPagingAndSortingMatcher());
+    }
+
+    private static boolean areEqual(Object o1, Object o2, Matcher matcher)
+    {
+        return areEqual(o1, o2, matcher, 0, new HashSet<Pair>());
+    }
+
+    private static boolean areEqual(Object o1, Object o2, Matcher matcher, int level, Set<Pair> checked)
+    {
+        Pair pair = new Pair(o1, o2);
+
+        if (checked.contains(pair))
+        {
+            return true;
+        } else
+        {
+            checked.add(pair);
+        }
+
+        try
+        {
+            Class<?> clazz = o1.getClass();
+
+            for (Method method : clazz.getMethods())
+            {
+                if (method.getName().startsWith("has") && false == method.getName().equals("hashCode"))
+                {
+                    boolean has1 = (boolean) method.invoke(o1);
+                    boolean has2 = (boolean) method.invoke(o2);
+
+                    Method withMethod = clazz.getMethod("with" + method.getName().substring(3));
+
+                    Object with1 = null;
+                    Object with2 = null;
+
+                    if (has1)
+                    {
+                        with1 = withMethod.invoke(o1);
+                    }
+
+                    if (has2)
+                    {
+                        with2 = withMethod.invoke(o2);
+                    }
+
+                    if (matcher.shouldMatch(level))
+                    {
+                        if (false == matcher.match(o1, o2, has1, has2, with1, with2))
+                        {
+                            return false;
+                        }
+                    }
+
+                    if (with1 != null && with2 != null)
+                    {
+                        if (false == areEqual(with1, with2, matcher, level + 1, checked))
+                        {
+                            return false;
+                        }
+                    }
+
+                }
+            }
+        } catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+
+        return true;
+    }
+
+    private static interface Matcher
+    {
+
+        public boolean shouldMatch(int level);
+
+        public boolean match(Object o1, Object o2, boolean has1, boolean has2, Object with1, Object with2);
+
+    }
+
+    private static class PartsMatcher implements Matcher
+    {
+
+        @Override
+        public boolean shouldMatch(int level)
+        {
+            return true;
+        }
+
+        @Override
+        public boolean match(Object o1, Object o2, boolean has1, boolean has2, Object with1, Object with2)
+        {
+            return has1 == has2;
+        }
+
+    }
+
+    private static abstract class PagingAndSortingMatcher implements Matcher
+    {
+
+        @Override
+        public boolean match(Object o1, Object o2, boolean has1, boolean has2, Object with1, Object with2)
+        {
+            FetchOptions<?> fo1 = o1 instanceof FetchOptions ? (FetchOptions<?>) o1 : null;
+            FetchOptions<?> fo2 = o2 instanceof FetchOptions ? (FetchOptions<?>) o2 : null;
+
+            if (fo1 == null ^ fo2 == null)
+            {
+                return false;
+            }
+
+            if (fo1 != null && fo2 != null)
+            {
+                // TODO compare sorting
+                return areEqual(fo1.getFrom(), fo2.getFrom()) && areEqual(fo1.getCount(), fo2.getCount());
+            } else
+            {
+                return true;
+            }
+        }
+
+        private boolean areEqual(Object o1, Object o2)
+        {
+            return o1 == null ? o2 == null : o1.equals(o2);
+        }
+
+    }
+
+    private static class TopLevelPagingAndSortingMatcher extends PagingAndSortingMatcher
+    {
+
+        @Override
+        public boolean shouldMatch(int level)
+        {
+            return level == 0;
+        }
+
+    }
+
+    private static class SubLevelPagingAndSortingMatcher extends PagingAndSortingMatcher
+    {
+
+        @Override
+        public boolean shouldMatch(int level)
+        {
+            return level > 0;
+        }
+
+    }
+
+    private static class Pair
+    {
+
+        public Object object1;
+
+        public Object object2;
+
+        public Pair(Object object1, Object object2)
+        {
+            this.object1 = object1;
+            this.object2 = object2;
+        }
+
+        @Override
+        public int hashCode()
+        {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((object1 == null) ? 0 : object1.hashCode());
+            result = prime * result + ((object2 == null) ? 0 : object2.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj)
+        {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            Pair other = (Pair) obj;
+            if (object1 == null)
+            {
+                if (other.object1 != null)
+                    return false;
+            } else if (!object1.equals(other.object1))
+                return false;
+            if (object2 == null)
+            {
+                if (other.object2 != null)
+                    return false;
+            } else if (!object2.equals(other.object2))
+                return false;
+            return true;
+        }
+
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentFetchOptions.java
index 28fc45f70ee..4d8d0660da0 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentFetchOptions.java
@@ -15,7 +15,9 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.EmptyFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment.AttachmentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
@@ -26,7 +28,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.attachment.AttachmentFetchOptions")
-public class AttachmentFetchOptions implements Serializable
+public class AttachmentFetchOptions extends FetchOptions<Attachment> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -39,6 +41,9 @@ public class AttachmentFetchOptions implements Serializable
     @JsonProperty
     private EmptyFetchOptions content;
 
+    @JsonProperty
+    private AttachmentSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public PersonFetchOptions withRegistrator()
     {
@@ -105,4 +110,19 @@ public class AttachmentFetchOptions implements Serializable
         return content != null;
     }
 
+    @Override
+    public AttachmentSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new AttachmentSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public AttachmentSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java
new file mode 100644
index 00000000000..5246cafb6d2
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class AttachmentSortOptions extends SortOptions<Attachment>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Attachment> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetFetchOptions.java
index 36e26059e21..5584a6c84d5 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions;
@@ -33,7 +35,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.dataset.DataSetFetchOptions")
-public class DataSetFetchOptions implements Serializable
+public class DataSetFetchOptions extends FetchOptions<DataSet> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -79,6 +81,9 @@ public class DataSetFetchOptions implements Serializable
     @JsonProperty
     private MaterialFetchOptions materialProperties;
 
+    @JsonProperty
+    private DataSetSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public DataSetFetchOptions withParents()
     {
@@ -387,4 +392,19 @@ public class DataSetFetchOptions implements Serializable
         return materialProperties != null;
     }
 
+    @Override
+    public DataSetSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new DataSetSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public DataSetSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java
new file mode 100644
index 00000000000..14685162d70
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class DataSetSortOptions extends SortOptions<DataSet>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<DataSet> getComparator(String field)
+    {
+        return null;
+    }
+
+}
\ No newline at end of file
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeFetchOptions.java
index c5e5f1824a4..92fc37869ee 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.dataset.DataSetTypeFetchOptions")
-public class DataSetTypeFetchOptions implements Serializable
+public class DataSetTypeFetchOptions extends FetchOptions<DataSetType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private DataSetTypeSortOptions sort;
+
+    @Override
+    public DataSetTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new DataSetTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public DataSetTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java
new file mode 100644
index 00000000000..414253140d9
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class DataSetTypeSortOptions extends SortOptions<DataSetType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<DataSetType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataFetchOptions.java
index 7d722dc2257..d9505c4117b 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyTermFetchOptions;
@@ -26,7 +28,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.dataset.ExternalDataFetchOptions")
-public class ExternalDataFetchOptions implements Serializable
+public class ExternalDataFetchOptions extends FetchOptions<ExternalData> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -39,6 +41,9 @@ public class ExternalDataFetchOptions implements Serializable
     @JsonProperty
     private LocatorTypeFetchOptions locatorType;
 
+    @JsonProperty
+    private ExternalDataSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public VocabularyTermFetchOptions withStorageFormat()
     {
@@ -105,4 +110,19 @@ public class ExternalDataFetchOptions implements Serializable
         return locatorType != null;
     }
 
+    @Override
+    public ExternalDataSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new ExternalDataSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public ExternalDataSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java
new file mode 100644
index 00000000000..e770bc5a6fb
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class ExternalDataSortOptions extends SortOptions<ExternalData>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<ExternalData> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeFetchOptions.java
index 670c1c08241..4aaade427ca 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.dataset.FileFormatTypeFetchOptions")
-public class FileFormatTypeFetchOptions implements Serializable
+public class FileFormatTypeFetchOptions extends FetchOptions<FileFormatType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private FileFormatTypeSortOptions sort;
+
+    @Override
+    public FileFormatTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new FileFormatTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public FileFormatTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java
new file mode 100644
index 00000000000..ccd5be8675b
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class FileFormatTypeSortOptions extends SortOptions<FileFormatType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<FileFormatType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeFetchOptions.java
index 6156667918c..cd82e9c7ff1 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.dataset.LocatorTypeFetchOptions")
-public class LocatorTypeFetchOptions implements Serializable
+public class LocatorTypeFetchOptions extends FetchOptions<LocatorType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private LocatorTypeSortOptions sort;
+
+    @Override
+    public LocatorTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new LocatorTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public LocatorTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java
new file mode 100644
index 00000000000..c139479e2ba
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class LocatorTypeSortOptions extends SortOptions<LocatorType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<LocatorType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java
index 6388e580e47..12ee14bfd74 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java
@@ -16,15 +16,14 @@
 
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.EmptyFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
  * @author pkupczyk
  */
 @JsonObject("dto.fetchoptions.deletion.DeletedObjectFetchOptions")
-public class DeletedObjectFetchOptions implements Serializable
+public class DeletedObjectFetchOptions extends EmptyFetchOptions
 {
 
     private static final long serialVersionUID = 1L;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java
index 1cd5eb5a05e..0e886c8a2d8 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 ETH Zuerich, Scientific IT Services
+ * Copyright 2014 ETH Zuerich, CISD
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,38 +13,64 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion;
 
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
- * @author pkupczyk
+ * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.deletion.DeletionFetchOptions")
-public class DeletionFetchOptions implements Serializable
+public class DeletionFetchOptions extends FetchOptions<Deletion> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
     @JsonProperty
-    private DeletedObjectFetchOptions deletedObjects;
+    private DeletionFetchOptions deletedObjects;
 
-    public DeletedObjectFetchOptions fetchDeletedObjects()
+    @JsonProperty
+    private DeletionSortOptions sort;
+
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
+    public DeletionFetchOptions withDeletedObjects()
     {
         if (deletedObjects == null)
         {
-            deletedObjects = new DeletedObjectFetchOptions();
+            deletedObjects = new DeletionFetchOptions();
         }
         return deletedObjects;
     }
 
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
+    public DeletionFetchOptions withDeletedObjectsUsing(DeletionFetchOptions fetchOptions)
+    {
+        return deletedObjects = fetchOptions;
+    }
+
+    // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public boolean hasDeletedObjects()
     {
         return deletedObjects != null;
     }
 
-}
\ No newline at end of file
+    @Override
+    public DeletionSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new DeletionSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public DeletionSortOptions getSortBy()
+    {
+        return sort;
+    }
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java
new file mode 100644
index 00000000000..46a240d6fbe
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class DeletionSortOptions extends SortOptions<Deletion>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Deletion> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentFetchOptions.java
index 25030d35108..9013afc65da 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment.AttachmentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentTypeFetchOptions;
@@ -33,7 +35,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.experiment.ExperimentFetchOptions")
-public class ExperimentFetchOptions implements Serializable
+public class ExperimentFetchOptions extends FetchOptions<Experiment> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -70,6 +72,9 @@ public class ExperimentFetchOptions implements Serializable
     @JsonProperty
     private AttachmentFetchOptions attachments;
 
+    @JsonProperty
+    private ExperimentSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public ExperimentTypeFetchOptions withType()
     {
@@ -312,4 +317,19 @@ public class ExperimentFetchOptions implements Serializable
         return attachments != null;
     }
 
+    @Override
+    public ExperimentSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new ExperimentSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public ExperimentSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java
new file mode 100644
index 00000000000..839f916dce8
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class ExperimentSortOptions extends SortOptions<Experiment>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Experiment> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeFetchOptions.java
index 8d10720a642..a462ff1246d 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.experiment.ExperimentTypeFetchOptions")
-public class ExperimentTypeFetchOptions implements Serializable
+public class ExperimentTypeFetchOptions extends FetchOptions<ExperimentType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private ExperimentTypeSortOptions sort;
+
+    @Override
+    public ExperimentTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new ExperimentTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public ExperimentTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java
new file mode 100644
index 00000000000..6b552db0b81
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class ExperimentTypeSortOptions extends SortOptions<ExperimentType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<ExperimentType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntryFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntryFetchOptions.java
index 0092da64bb3..2171b006779 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntryFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntryFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -24,13 +26,16 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.history.HistoryEntryFetchOptions")
-public class HistoryEntryFetchOptions implements Serializable
+public class HistoryEntryFetchOptions extends FetchOptions<HistoryEntry> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
     @JsonProperty
     private PersonFetchOptions author;
 
+    @JsonProperty
+    private HistoryEntrySortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public PersonFetchOptions withAuthor()
     {
@@ -53,4 +58,19 @@ public class HistoryEntryFetchOptions implements Serializable
         return author != null;
     }
 
+    @Override
+    public HistoryEntrySortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new HistoryEntrySortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public HistoryEntrySortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java
new file mode 100644
index 00000000000..0fa7f134c16
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class HistoryEntrySortOptions extends SortOptions<HistoryEntry>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<HistoryEntry> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialFetchOptions.java
index 6d9ed841626..a7ad2a8c7b2 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialFetchOptions.java
@@ -15,20 +15,23 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history.HistoryEntryFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.property.PropertyFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag.TagFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.material.MaterialFetchOptions")
-public class MaterialFetchOptions extends FetchOptions
+public class MaterialFetchOptions extends FetchOptions<Material> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -51,21 +54,7 @@ public class MaterialFetchOptions extends FetchOptions
     private TagFetchOptions tags;
 
     @JsonProperty
-    private MaterialSortOptions sortBy;
-
-    public MaterialSortOptions sortBy()
-    {
-        if (sortBy == null)
-        {
-            sortBy = new MaterialSortOptions();
-        }
-        return sortBy;
-    }
-
-    public MaterialSortOptions getSortBy()
-    {
-        return sortBy;
-    }
+    private MaterialSortOptions sort;
 
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public MaterialTypeFetchOptions withType()
@@ -199,4 +188,19 @@ public class MaterialFetchOptions extends FetchOptions
         return tags != null;
     }
 
+    @Override
+    public MaterialSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new MaterialSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public MaterialSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java
index 7edb895c1c1..97cb3048be3 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java
@@ -16,48 +16,82 @@
 
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material;
 
-import java.io.Serializable;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.SortOrder;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.AbstractComparator;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOrder;
 
 /**
  * @author pkupczyk
  */
-public class MaterialSortOptions implements Serializable
+public class MaterialSortOptions extends SortOptions<Material>
 {
 
     private static final long serialVersionUID = 1L;
 
-    private SortOrder code;
+    private static final String CODE = "CODE";
 
-    private SortOrder registrationDate;
+    private static final String REGISTRATION_DATE = "REGISTRATION_DATE";
+
+    private static final Map<String, Comparator<Material>> comparators = new HashMap<>();
+
+    static
+    {
+        comparators.put(CODE, new CodeComparator());
+        comparators.put(REGISTRATION_DATE, new RegistrationDateComparator());
+    }
 
     public SortOrder code()
     {
-        if (code == null)
-        {
-            code = new SortOrder();
-        }
-        return code;
+        return getOrCreateSorting(CODE);
     }
 
-    public boolean isCode()
+    public SortOrder getCode()
     {
-        return code != null;
+        return getSorting(CODE);
     }
 
     public SortOrder registrationDate()
     {
-        if (registrationDate == null)
+        return getOrCreateSorting(REGISTRATION_DATE);
+    }
+
+    public SortOrder getRegistrationDate()
+    {
+        return getSorting(REGISTRATION_DATE);
+    }
+
+    private static class CodeComparator extends AbstractComparator<Material, String>
+    {
+
+        @Override
+        protected String getValue(Material o)
+        {
+            return o.getCode();
+        }
+
+    }
+
+    private static class RegistrationDateComparator extends AbstractComparator<Material, Date>
+    {
+
+        @Override
+        protected Date getValue(Material o)
         {
-            registrationDate = new SortOrder();
+            return o.getRegistrationDate();
         }
-        return registrationDate;
+
     }
 
-    public boolean isRegistrationDate()
+    @Override
+    public Comparator<Material> getComparator(String field)
     {
-        return registrationDate != null;
+        return comparators.get(field);
     }
 
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeFetchOptions.java
index 53b39409eeb..76e8f31439c 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.MaterialType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.material.MaterialTypeFetchOptions")
-public class MaterialTypeFetchOptions implements Serializable
+public class MaterialTypeFetchOptions extends FetchOptions<MaterialType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private MaterialTypeSortOptions sort;
+
+    @Override
+    public MaterialTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new MaterialTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public MaterialTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java
new file mode 100644
index 00000000000..aa5593f5bdd
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.MaterialType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class MaterialTypeSortOptions extends SortOptions<MaterialType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<MaterialType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonFetchOptions.java
index 62f5bb5fadb..39ec641cadc 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space.SpaceFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
@@ -25,7 +27,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.person.PersonFetchOptions")
-public class PersonFetchOptions implements Serializable
+public class PersonFetchOptions extends FetchOptions<Person> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -35,6 +37,9 @@ public class PersonFetchOptions implements Serializable
     @JsonProperty
     private PersonFetchOptions registrator;
 
+    @JsonProperty
+    private PersonSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public SpaceFetchOptions withSpace()
     {
@@ -79,4 +84,19 @@ public class PersonFetchOptions implements Serializable
         return registrator != null;
     }
 
+    @Override
+    public PersonSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new PersonSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public PersonSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java
new file mode 100644
index 00000000000..337b95db8df
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class PersonSortOptions extends SortOptions<Person>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Person> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectFetchOptions.java
index cd0e337b9c2..aecb394be45 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.project;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.project.Project;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment.AttachmentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history.HistoryEntryFetchOptions;
@@ -28,7 +30,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.project.ProjectFetchOptions")
-public class ProjectFetchOptions implements Serializable
+public class ProjectFetchOptions extends FetchOptions<Project> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -53,6 +55,9 @@ public class ProjectFetchOptions implements Serializable
     @JsonProperty
     private AttachmentFetchOptions attachments;
 
+    @JsonProperty
+    private ProjectSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public ExperimentFetchOptions withExperiments()
     {
@@ -207,4 +212,19 @@ public class ProjectFetchOptions implements Serializable
         return attachments != null;
     }
 
+    @Override
+    public ProjectSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new ProjectSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public ProjectSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java
new file mode 100644
index 00000000000..d804307d145
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.project;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.project.Project;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class ProjectSortOptions extends SortOptions<Project>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Project> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/property/PropertyFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/property/PropertyFetchOptions.java
index baa179c8bf9..b2197736ee8 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/property/PropertyFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/property/PropertyFetchOptions.java
@@ -16,16 +16,16 @@
 
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.property;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.EmptyFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
 /**
  * @author pkupczyk
  */
 @JsonObject("dto.fetchoptions.property.PropertyFetchOptions")
-public class PropertyFetchOptions implements Serializable
+public class PropertyFetchOptions extends EmptyFetchOptions
 {
+
     private static final long serialVersionUID = 1L;
 
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java
index 42bd728e740..8ccbdb45efc 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment.AttachmentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentFetchOptions;
@@ -34,7 +36,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.sample.SampleFetchOptions")
-public class SampleFetchOptions implements Serializable
+public class SampleFetchOptions extends FetchOptions<Sample> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -83,6 +85,9 @@ public class SampleFetchOptions implements Serializable
     @JsonProperty
     private AttachmentFetchOptions attachments;
 
+    @JsonProperty
+    private SampleSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public SampleTypeFetchOptions withType()
     {
@@ -413,4 +418,19 @@ public class SampleFetchOptions implements Serializable
         return attachments != null;
     }
 
+    @Override
+    public SampleSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new SampleSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public SampleSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java
new file mode 100644
index 00000000000..05322bc5348
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class SampleSortOptions extends SortOptions<Sample>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Sample> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeFetchOptions.java
index 09330948082..50a7d0d9096 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeFetchOptions.java
@@ -15,16 +15,36 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample;
 
-import java.io.Serializable;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.sample.SampleTypeFetchOptions")
-public class SampleTypeFetchOptions implements Serializable
+public class SampleTypeFetchOptions extends FetchOptions<SampleType> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
+    @JsonProperty
+    private SampleTypeSortOptions sort;
+
+    @Override
+    public SampleTypeSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new SampleTypeSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public SampleTypeSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java
new file mode 100644
index 00000000000..9a230c639e6
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleType;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class SampleTypeSortOptions extends SortOptions<SampleType>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<SampleType> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java
new file mode 100644
index 00000000000..ebf18ba0233
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
+
+import java.util.Comparator;
+
+/**
+ * @author pkupczyk
+ */
+public abstract class AbstractComparator<OBJECT, VALUE extends Comparable<VALUE>> implements Comparator<OBJECT>
+{
+
+    @Override
+    public int compare(OBJECT o1, OBJECT o2)
+    {
+        VALUE value1 = getValue(o1);
+        VALUE value2 = getValue(o2);
+
+        if (value1 != null && value2 != null)
+        {
+            return value1.compareTo(value2);
+        } else if (value1 != null)
+        {
+            return 1;
+        } else if (value2 != null)
+        {
+            return -1;
+        } else
+        {
+            return 0;
+        }
+    }
+
+    protected abstract VALUE getValue(OBJECT o);
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
new file mode 100644
index 00000000000..93184b90175
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
+
+/**
+ * @author pkupczyk
+ */
+@SuppressWarnings({ "rawtypes", "unchecked", "cast" })
+public class SortAndPage
+{
+
+    private Set processed = new HashSet();
+
+    public <T, C extends Collection<T>> C sortAndPage(C objects, FetchOptions fo)
+    {
+        C newObjects = objects;
+        newObjects = (C) sort(newObjects, fo);
+        newObjects = (C) page(newObjects, fo);
+        nest(newObjects, fo);
+
+        return newObjects;
+    }
+
+    private Collection sort(Collection objects, FetchOptions fo)
+    {
+        if (objects == null || objects.isEmpty())
+        {
+            return objects;
+        }
+
+        boolean hasSorting = fo.getSortBy() != null && false == fo.getSortBy().getSortings().isEmpty();
+
+        if (hasSorting)
+        {
+            Comparator comparator = getComparator(fo);
+            Collection sorted = null;
+
+            if (objects instanceof List)
+            {
+                sorted = new ArrayList();
+                sorted.addAll(objects);
+                Collections.sort((List) sorted, comparator);
+            } else if (objects instanceof Set)
+            {
+                sorted = new TreeSet(comparator);
+                sorted.addAll(objects);
+            } else if (objects instanceof Collection)
+            {
+                sorted = new ArrayList();
+                sorted.addAll(objects);
+                Collections.sort((List) sorted, comparator);
+            }
+
+            return sorted;
+        } else
+        {
+            return objects;
+        }
+    }
+
+    private Collection page(Collection objects, FetchOptions fo)
+    {
+        if (objects == null || objects.isEmpty())
+        {
+            return objects;
+        }
+
+        boolean hasPaging = fo.getFrom() != null || fo.getCount() != null;
+
+        if (hasPaging)
+        {
+            Collection paged = null;
+
+            if (objects instanceof List)
+            {
+                paged = new ArrayList();
+            } else if (objects instanceof Set)
+            {
+                paged = new LinkedHashSet();
+            } else
+            {
+                throw new IllegalArgumentException("Unsupported collection: " + objects.getClass());
+            }
+
+            Integer from = fo.getFrom();
+            Integer count = fo.getCount();
+
+            if (from != null && count != null)
+            {
+                int index = 0;
+                for (Object item : objects)
+                {
+                    if (index >= from && index < from + count)
+                    {
+                        paged.add(item);
+                    }
+                    index++;
+                }
+            }
+
+            return paged;
+        } else
+        {
+            return objects;
+        }
+    }
+
+    private void nest(Collection objects, FetchOptions fo)
+    {
+        if (objects == null || objects.isEmpty())
+        {
+            return;
+        }
+
+        try
+        {
+            for (Object object : objects)
+            {
+                if (processed.contains(object))
+                {
+                    continue;
+                } else
+                {
+                    processed.add(object);
+                }
+
+                // TODO find the methods only once for given class instead of doing it for each object
+                for (Method method : fo.getClass().getMethods())
+                {
+                    if (method.getName().startsWith("has") && false == method.getName().equals("hashCode"))
+                    {
+                        String field = method.getName().substring(3);
+                        boolean has = (Boolean) method.invoke(fo);
+
+                        if (has)
+                        {
+                            Method withMethod = fo.getClass().getMethod("with" + field);
+                            FetchOptions subFo = (FetchOptions) withMethod.invoke(fo);
+
+                            Method getMethod = object.getClass().getMethod("get" + field);
+                            Method setMethod = object.getClass().getMethod("set" + field, getMethod.getReturnType());
+
+                            Object value = getMethod.invoke(object);
+
+                            if (value != null)
+                            {
+                                if (value instanceof Collection)
+                                {
+                                    Collection newValue = sortAndPage((Collection) value, subFo);
+                                    setMethod.invoke(object, newValue);
+                                } else if (value instanceof Map)
+                                {
+                                    sortAndPage(((Map) value).values(), subFo);
+                                } else
+                                {
+                                    Collection newValue = sortAndPage(Collections.singleton(value), subFo);
+                                    setMethod.invoke(object, newValue.iterator().next());
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected Comparator getComparator(FetchOptions fetchOptions)
+    {
+        if (fetchOptions == null)
+        {
+            return null;
+        }
+
+        SortOptions sortBy = (SortOptions) fetchOptions.getSortBy();
+
+        if (sortBy != null)
+        {
+            final List<Sorting> sortings = sortBy.getSortings();
+            if (sortings != null && sortings.size() > 0)
+            {
+                final Comparator[] comparators = new Comparator[sortings.size()];
+                final int[] directions = new int[sortings.size()];
+
+                int index = 0;
+                for (Sorting sorting : sortings)
+                {
+                    Comparator aComparator = sortBy.getComparator(sorting.getField());
+                    if (aComparator == null)
+                    {
+                        throw new IllegalArgumentException("Comparator for field " + sorting.getField() + " not found");
+                    }
+
+                    comparators[index] = aComparator;
+                    directions[index] = sorting.getOrder().isAsc() ? 1 : -1;
+                    index++;
+                }
+
+                return new Comparator()
+                    {
+                        @Override
+                        public int compare(Object o1, Object o2)
+                        {
+                            for (int i = 0; i < sortings.size(); i++)
+                            {
+                                Comparator c = comparators[i];
+                                int d = directions[i];
+
+                                int result = d * c.compare(o1, o2);
+                                if (result != 0)
+                                {
+                                    return result;
+                                }
+                            }
+                            return 0;
+                        }
+                    };
+            }
+        }
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java
new file mode 100644
index 00000000000..dda6ef69d81
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author pkupczyk
+ */
+public abstract class SortOptions<OBJECT> implements Serializable
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private List<Sorting> sortings = new LinkedList<>();
+
+    public abstract Comparator<OBJECT> getComparator(String field);
+
+    protected SortOrder getOrCreateSorting(String field)
+    {
+        SortOrder order = getSorting(field);
+        if (order == null)
+        {
+            order = new SortOrder();
+            sortings.add(new Sorting(field, order));
+        }
+        return order;
+    }
+
+    protected SortOrder getSorting(String field)
+    {
+        for (Sorting sorting : sortings)
+        {
+            if (field.equals(sorting.getField()))
+            {
+                return sorting.getOrder();
+            }
+        }
+        return null;
+    }
+
+    public List<Sorting> getSortings()
+    {
+        return sortings;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/SortOrder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOrder.java
similarity index 99%
rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/SortOrder.java
rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOrder.java
index 9d5fadfc6de..bdc6383d815 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/SortOrder.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOrder.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
 
 import java.io.Serializable;
 
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/Sorting.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/Sorting.java
new file mode 100644
index 00000000000..5da09c6006f
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/Sorting.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
+
+import java.io.Serializable;
+
+/**
+ * @author pkupczyk
+ */
+public class Sorting implements Serializable
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private String field;
+
+    private SortOrder order;
+
+    public Sorting(String field, SortOrder order)
+    {
+        this.field = field;
+        this.order = order;
+    }
+
+    public String getField()
+    {
+        return field;
+    }
+
+    public SortOrder getOrder()
+    {
+        return order;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceFetchOptions.java
index 43d70160d20..8982c2ab4b4 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.Space;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.project.ProjectFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample.SampleFetchOptions;
@@ -26,7 +28,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.space.SpaceFetchOptions")
-public class SpaceFetchOptions implements Serializable
+public class SpaceFetchOptions extends FetchOptions<Space> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -39,6 +41,9 @@ public class SpaceFetchOptions implements Serializable
     @JsonProperty
     private ProjectFetchOptions projects;
 
+    @JsonProperty
+    private SpaceSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public PersonFetchOptions withRegistrator()
     {
@@ -105,4 +110,19 @@ public class SpaceFetchOptions implements Serializable
         return projects != null;
     }
 
+    @Override
+    public SpaceSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new SpaceSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public SpaceSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java
new file mode 100644
index 00000000000..68d29b97f87
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.Space;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class SpaceSortOptions extends SortOptions<Space>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Space> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagFetchOptions.java
index 8a327f5bfe0..36d089db7aa 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagFetchOptions.java
@@ -15,17 +15,18 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag.Tag;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
 
 /**
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.tag.TagFetchOptions")
-public class TagFetchOptions extends FetchOptions
+public class TagFetchOptions extends FetchOptions<Tag> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -33,21 +34,7 @@ public class TagFetchOptions extends FetchOptions
     private PersonFetchOptions owner;
 
     @JsonProperty
-    private TagSortOptions sortBy;
-
-    public TagSortOptions sortBy()
-    {
-        if (sortBy == null)
-        {
-            sortBy = new TagSortOptions();
-        }
-        return sortBy;
-    }
-
-    public TagSortOptions getSortBy()
-    {
-        return sortBy;
-    }
+    private TagSortOptions sort;
 
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public PersonFetchOptions withOwner()
@@ -71,4 +58,19 @@ public class TagFetchOptions extends FetchOptions
         return owner != null;
     }
 
+    @Override
+    public TagSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new TagSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public TagSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java
index 4842d160b61..bc8626ca79d 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java
@@ -16,48 +16,82 @@
 
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag;
 
-import java.io.Serializable;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
-import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.SortOrder;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag.Tag;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.AbstractComparator;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOrder;
 
 /**
  * @author pkupczyk
  */
-public class TagSortOptions implements Serializable
+public class TagSortOptions extends SortOptions<Tag>
 {
 
     private static final long serialVersionUID = 1L;
 
-    private SortOrder code;
+    private static final String CODE = "CODE";
 
-    private SortOrder registrationDate;
+    private static final String REGISTRATION_DATE = "REGISTRATION_DATE";
+
+    private static final Map<String, Comparator<Tag>> comparators = new HashMap<>();
+
+    static
+    {
+        comparators.put(CODE, new CodeComparator());
+        comparators.put(REGISTRATION_DATE, new RegistrationDateComparator());
+    }
 
     public SortOrder code()
     {
-        if (code == null)
-        {
-            code = new SortOrder();
-        }
-        return code;
+        return getOrCreateSorting(CODE);
     }
 
-    public boolean isCode()
+    public SortOrder getCode()
     {
-        return code != null;
+        return getSorting(CODE);
     }
 
     public SortOrder registrationDate()
     {
-        if (registrationDate == null)
+        return getOrCreateSorting(REGISTRATION_DATE);
+    }
+
+    public SortOrder getRegistrationDate()
+    {
+        return getSorting(REGISTRATION_DATE);
+    }
+
+    private static class CodeComparator extends AbstractComparator<Tag, String>
+    {
+
+        @Override
+        protected String getValue(Tag o)
+        {
+            return o.getCode();
+        }
+
+    }
+
+    private static class RegistrationDateComparator extends AbstractComparator<Tag, Date>
+    {
+
+        @Override
+        protected Date getValue(Tag o)
         {
-            registrationDate = new SortOrder();
+            return o.getRegistrationDate();
         }
-        return registrationDate;
+
     }
 
-    public boolean isRegistrationDate()
+    @Override
+    public Comparator<Tag> getComparator(String field)
     {
-        return registrationDate != null;
+        return comparators.get(field);
     }
 
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyFetchOptions.java
index 095cdf1f8b2..c3d38aac289 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.Vocabulary;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -24,13 +26,16 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.vocabulary.VocabularyFetchOptions")
-public class VocabularyFetchOptions implements Serializable
+public class VocabularyFetchOptions extends FetchOptions<Vocabulary> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
     @JsonProperty
     private PersonFetchOptions registrator;
 
+    @JsonProperty
+    private VocabularySortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public PersonFetchOptions withRegistrator()
     {
@@ -53,4 +58,19 @@ public class VocabularyFetchOptions implements Serializable
         return registrator != null;
     }
 
+    @Override
+    public VocabularySortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new VocabularySortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public VocabularySortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java
new file mode 100644
index 00000000000..48b97848473
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.Vocabulary;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class VocabularySortOptions extends SortOptions<Vocabulary>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<Vocabulary> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermFetchOptions.java
index 6b4971f2b67..cc718179637 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermFetchOptions.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermFetchOptions.java
@@ -15,6 +15,8 @@
  */
 package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.VocabularyTerm;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyFetchOptions;
 import ch.systemsx.cisd.base.annotation.JsonObject;
@@ -25,7 +27,7 @@ import java.io.Serializable;
  * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
  */
 @JsonObject("dto.fetchoptions.vocabulary.VocabularyTermFetchOptions")
-public class VocabularyTermFetchOptions implements Serializable
+public class VocabularyTermFetchOptions extends FetchOptions<VocabularyTerm> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -35,6 +37,9 @@ public class VocabularyTermFetchOptions implements Serializable
     @JsonProperty
     private PersonFetchOptions registrator;
 
+    @JsonProperty
+    private VocabularyTermSortOptions sort;
+
     // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator}
     public VocabularyFetchOptions withVocabulary()
     {
@@ -79,4 +84,19 @@ public class VocabularyTermFetchOptions implements Serializable
         return registrator != null;
     }
 
+    @Override
+    public VocabularyTermSortOptions sortBy()
+    {
+        if (sort == null)
+        {
+            sort = new VocabularyTermSortOptions();
+        }
+        return sort;
+    }
+
+    @Override
+    public VocabularyTermSortOptions getSortBy()
+    {
+        return sort;
+    }
 }
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java
new file mode 100644
index 00000000000..258388987d4
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary;
+
+import java.util.Comparator;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.VocabularyTerm;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions;
+
+/**
+ * @author pkupczyk
+ */
+public class VocabularyTermSortOptions extends SortOptions<VocabularyTerm>
+{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public Comparator<VocabularyTerm> getComparator(String field)
+    {
+        return null;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java
index 805d3cff6d2..0fdb3b01ecf 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java
@@ -15,6 +15,7 @@ import java.util.TreeSet;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException;
 import ch.systemsx.cisd.base.annotation.JsonObject;
 
@@ -291,7 +292,7 @@ public class DtoGenerator
         printPackage("entity." + subPackage);
         printImports();
 
-        printClassHeader(className, "entity." + subPackage, implementedInterfaces);
+        printClassHeader(className, "entity." + subPackage, null, implementedInterfaces);
         startBlock();
         printFields();
 
@@ -355,7 +356,7 @@ public class DtoGenerator
         printPackage("fetchoptions." + subPackage);
         printImportsForFetchOptions();
 
-        printClassHeader(fetchOptionsClass.getSimpleName(), "fetchoptions." + subPackage, null);
+        printClassHeader(fetchOptionsClass.getSimpleName(), "fetchoptions." + subPackage, "FetchOptions<" + className + ">", null);
         startBlock();
 
         printFetchOptionsFields();
@@ -447,6 +448,23 @@ public class DtoGenerator
                 printFetchOptionsAccessors(field);
             }
         }
+
+        print("@Override");
+        print("public " + className + "SortOptions sortBy()");
+        startBlock();
+        print("if (sort == null)");
+        startBlock();
+        print("sort = new " + className + "SortOptions();");
+        endBlock();
+        print("return sort;");
+        endBlock();
+
+        print("");
+        print("@Override");
+        print("public " + className + "SortOptions getSortBy()");
+        startBlock();
+        print("return sort;");
+        endBlock();
     }
 
     private void printFetchOptionsAccessorsJS()
@@ -624,12 +642,19 @@ public class DtoGenerator
         print("");
     }
 
-    private void printClassHeader(String className, String jsonPackage, Collection<String> implementedInterfaces)
+    private void printClassHeader(String className, String jsonPackage, String extendsClass, Collection<String> implementedInterfaces)
     {
         print("/**");
         print(" * Class automatically generated with {@link %s}", this.getClass().getName());
         print(" */");
         print("@JsonObject(\"dto.%s.%s\")", jsonPackage, className);
+
+        String extendsStr = "";
+        if (extendsClass != null)
+        {
+            extendsStr = " extends " + extendsClass;
+        }
+
         StringBuilder interfaces = new StringBuilder();
         if (implementedInterfaces != null)
         {
@@ -639,7 +664,7 @@ public class DtoGenerator
                 interfaces.append(i);
             }
         }
-        print("public class %s implements Serializable%s", className, interfaces.toString());
+        print("public class %s%s implements Serializable%s", className, extendsStr, interfaces.toString());
     }
 
     private void printMethodJavaDoc()
@@ -685,6 +710,10 @@ public class DtoGenerator
                 printFetchOptionField(field);
             }
         }
+
+        print("@JsonProperty");
+        print("private " + className + "SortOptions sort;");
+        print("");
     }
 
     private void printFetchOptionField(DTOField field)
@@ -736,6 +765,8 @@ public class DtoGenerator
         imports.add(JsonObject.class.getName());
         imports.add(JsonProperty.class.getName());
         imports.add(Serializable.class.getName());
+        imports.add(FetchOptions.class.getName());
+        imports.add("ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity." + subPackage + "." + className);
 
         for (DTOField field : fields)
         {
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java
index 9fb5687f3d7..04fab4b7fe1 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java
@@ -32,6 +32,7 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSe
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.ExternalDataFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion.DeletionFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentTypeFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history.HistoryEntryFetchOptions;
@@ -46,6 +47,7 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag.TagFetchOp
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary.VocabularyTermFetchOptions;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.DataSetPermId;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentIdentifier;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.ExperimentPermId;
@@ -288,6 +290,15 @@ public class Generator extends AbstractGenerator
         return gen;
     }
 
+    private static DtoGenerator createDeletion()
+    {
+        DtoGenerator gen = new DtoGenerator("deletion", "Deletion", DeletionFetchOptions.class);
+        gen.addSimpleField(IDeletionId.class, "id");
+        gen.addStringField("reason");
+        gen.addPluralFetchedField("List<DeletedObject>", List.class.getName(), "deletedObjects", "Deleted objects", DeletionFetchOptions.class);
+        return gen;
+    }
+
     private static DtoGenerator createVocabulary()
     {
         DtoGenerator gen = new DtoGenerator("vocabulary", "Vocabulary", VocabularyFetchOptions.class);
@@ -453,6 +464,7 @@ public class Generator extends AbstractGenerator
         list.add(createFileFormatType());
         list.add(createExternalDataGenerator());
         list.add(createHistoryEntryGenerator());
+        list.add(createDeletion());
 
         for (DtoGenerator gen : list)
         {
diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcherTest.java b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcherTest.java
new file mode 100644
index 00000000000..2e31db57a00
--- /dev/null
+++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/FetchOptionsMatcherTest.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2014 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialFetchOptions;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample.SampleFetchOptions;
+
+public class FetchOptionsMatcherTest
+{
+
+    @Test
+    public void testMatchTheSameObjects()
+    {
+        SampleFetchOptions fo = new SampleFetchOptions();
+        assertMatch(fo, fo, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchEmptyObjects()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsOfDifferentTypes()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        DataSetFetchOptions fo2 = new DataSetFetchOptions();
+        assertMatch(fo1, fo2, null);
+    }
+
+    @Test
+    public void testMatchObjectsWithTheSameParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withExperiment();
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+        fo2.withExperiment();
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withExperiment();
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+
+        assertMatch(fo1, fo2, null);
+    }
+
+    @Test
+    public void testMatchObjectsWithSameTopLevelRecursiveParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withChildrenUsing(fo1);
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+        fo2.withChildrenUsing(fo2);
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentTopLevelRecursiveParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withChildrenUsing(fo1);
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+        fo2.withExperiment();
+        fo2.withChildrenUsing(fo2);
+
+        assertMatch(fo1, fo2, null);
+    }
+
+    @Test
+    public void testMatchObjectsWithSameSubLevelRecursiveParts()
+    {
+        SampleFetchOptions fo1Children = new SampleFetchOptions();
+        fo1Children.withExperiment();
+        fo1Children.withChildrenUsing(fo1Children);
+
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withChildrenUsing(fo1Children);
+
+        SampleFetchOptions fo2Children = new SampleFetchOptions();
+        fo2Children.withExperiment();
+        fo2Children.withChildrenUsing(fo2Children);
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+        fo2.withChildrenUsing(fo2Children);
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentSubLevelRecursiveParts()
+    {
+        SampleFetchOptions fo1Children = new SampleFetchOptions();
+        fo1Children.withExperiment();
+        fo1Children.withChildrenUsing(fo1Children);
+
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace();
+        fo1.withChildrenUsing(fo1Children);
+
+        SampleFetchOptions fo2Children = new SampleFetchOptions();
+        fo2Children.withContainer();
+        fo2Children.withChildrenUsing(fo2Children);
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace();
+        fo2.withChildrenUsing(fo2Children);
+
+        assertMatch(fo1, fo2, null);
+    }
+
+    @Test
+    public void testMatchObjectsWithSameMultiLevelParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace().withProjects().withAttachments();
+        fo1.withChildren().withDataSets().withHistory();
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace().withProjects().withAttachments();
+        fo2.withChildren().withDataSets().withHistory();
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentMultiLevelParts()
+    {
+        SampleFetchOptions fo1 = new SampleFetchOptions();
+        fo1.withSpace().withProjects().withAttachments();
+        fo1.withChildren().withDataSets().withHistory();
+
+        SampleFetchOptions fo2 = new SampleFetchOptions();
+        fo2.withSpace().withProjects().withAttachments();
+        fo2.withChildren().withDataSets();
+
+        assertMatch(fo1, fo2, null);
+    }
+
+    @Test
+    public void testMatchObjectsWithSameTopLevelPaging()
+    {
+        MaterialFetchOptions fo1 = new MaterialFetchOptions();
+        fo1.from(10).count(5);
+
+        MaterialFetchOptions fo2 = new MaterialFetchOptions();
+        fo2.count(5).from(10);
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentTopLevelPaging()
+    {
+        MaterialFetchOptions fo1 = new MaterialFetchOptions();
+        fo1.from(10).count(5);
+
+        MaterialFetchOptions fo2 = new MaterialFetchOptions();
+        fo2.from(3).count(7);
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_SUB_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithSameSubLevelPaging()
+    {
+        MaterialFetchOptions fo1 = new MaterialFetchOptions();
+        fo1.withTags().from(1).count(5);
+
+        MaterialFetchOptions fo2 = new MaterialFetchOptions();
+        fo2.withTags().from(1).count(5);
+
+        assertMatch(fo1, fo2, FetchOptionsMatchType.ALL_PARTS_AND_ALL_PAGING_AND_SORTING);
+    }
+
+    @Test
+    public void testMatchObjectsWithDifferentSubLevelPaging()
+    {
+        MaterialFetchOptions fo1 = new MaterialFetchOptions();
+        fo1.withTags().from(1).count(5);
+
+        MaterialFetchOptions fo2 = new MaterialFetchOptions();
+        fo2.withTags().from(2).count(6);
+
+        assertMatch(fo1, fo2, null);
+    }
+
+    private void assertMatch(Object o1, Object o2, FetchOptionsMatchType matchType)
+    {
+        Assert.assertEquals(FetchOptionsMatcher.match(o1, o2), matchType);
+    }
+
+}
diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPageTest.java b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPageTest.java
new file mode 100644
index 00000000000..0fbd5dfbaf1
--- /dev/null
+++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPageTest.java
@@ -0,0 +1,239 @@
+package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort;
+
+import java.sql.Date;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.project.Project;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.Space;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag.Tag;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialFetchOptions;
+
+public class SortAndPageTest
+{
+    @Test
+    public void testSortAndPageTopLevel()
+    {
+        MaterialFetchOptions fo = new MaterialFetchOptions();
+        fo.sortBy().code().desc();
+        fo.from(1).count(2);
+
+        Material m1 = new Material();
+        m1.setCode("S1");
+        m1.setFetchOptions(fo);
+
+        Material m2 = new Material();
+        m2.setCode("S2");
+        m2.setFetchOptions(fo);
+
+        Material m3 = new Material();
+        m3.setCode("S3");
+        m3.setFetchOptions(fo);
+
+        List<Material> materials = new ArrayList<Material>();
+        materials.add(m1);
+        materials.add(m2);
+        materials.add(m3);
+
+        Collection<Material> results = new SortAndPage().sortAndPage(materials, fo);
+
+        assertMaterials(results, Arrays.asList("S2", "S1"));
+    }
+
+    @Test
+    public void testSortAndPageSubLevel()
+    {
+        MaterialFetchOptions fo = new MaterialFetchOptions();
+        fo.sortBy().code().desc();
+        fo.withTags().from(1).count(1);
+
+        Tag t1 = new Tag();
+        t1.setCode("T1");
+        Tag t2 = new Tag();
+        t2.setCode("T2");
+        Tag t3 = new Tag();
+        t3.setCode("T3");
+
+        Material m1 = new Material();
+        m1.setCode("S1");
+        m1.setTags(new LinkedHashSet<Tag>(Arrays.asList(t1, t2)));
+        m1.setFetchOptions(fo);
+
+        Material m2 = new Material();
+        m2.setCode("S2");
+        m2.setTags(new LinkedHashSet<Tag>(Arrays.asList(t2, t3)));
+        m2.setFetchOptions(fo);
+
+        List<Material> materials = new ArrayList<Material>();
+        materials.add(m1);
+        materials.add(m2);
+
+        List<Material> results = new SortAndPage().sortAndPage(materials, fo);
+
+        assertMaterials(results, Arrays.asList("S2", "S1"));
+        assertTags(results.get(0).getTags(), Arrays.asList("T3"));
+        assertTags(results.get(1).getTags(), Arrays.asList("T2"));
+    }
+
+    @Test
+    public void testSortAndPageSubLevelThroughSingleRelation()
+    {
+        MaterialFetchOptions fo = new MaterialFetchOptions();
+        fo.sortBy().code().desc();
+        fo.withTags().from(1).count(1);
+        fo.withRegistrator().withSpace().withProjects().from(1).count(1);
+        fo.withMaterialProperties().withTags();
+
+        Project project1 = new Project();
+        project1.setCode("P1");
+        project1.setFetchOptions(fo.withRegistrator().withSpace().withProjects());
+
+        Project project2 = new Project();
+        project2.setCode("P2");
+        project2.setFetchOptions(fo.withRegistrator().withSpace().withProjects());
+
+        Space space1 = new Space();
+        space1.setProjects(Arrays.asList(project1, project2));
+        space1.setFetchOptions(fo.withRegistrator().withSpace());
+
+        Person person1 = new Person();
+        person1.setLastName("Foo");
+        person1.setSpace(space1);
+        person1.setFetchOptions(fo.withRegistrator());
+
+        Tag t1 = new Tag();
+        t1.setCode("T1");
+        Tag t2 = new Tag();
+        t2.setCode("T2");
+        Tag t3 = new Tag();
+        t3.setCode("T3");
+
+        Material m1 = new Material();
+        m1.setCode("M1");
+        m1.setTags(new LinkedHashSet<Tag>(Arrays.asList(t1, t2)));
+        m1.setRegistrator(person1);
+        m1.setFetchOptions(fo);
+
+        Material m2 = new Material();
+        m2.setCode("M2");
+        m2.setTags(new LinkedHashSet<Tag>(Arrays.asList(t2, t3)));
+        m2.setRegistrator(person1);
+        m2.setFetchOptions(fo);
+
+        Material m3 = new Material();
+        m3.setCode("M3");
+        m3.setTags(new LinkedHashSet<Tag>(Arrays.asList(t1, t3)));
+        m3.setFetchOptions(fo);
+
+        Map<String, Material> properties1 = new HashMap<String, Material>();
+        properties1.put("PROPERTY_1", m1);
+        properties1.put("PROPERTY_3", m3);
+        m1.setMaterialProperties(properties1);
+
+        Map<String, Material> properties2 = new HashMap<String, Material>();
+        properties2.put("PROPERTY_2", m2);
+        properties2.put("PROPERTY_3", m3);
+        m2.setMaterialProperties(properties2);
+
+        List<Material> materials = new ArrayList<Material>();
+        materials.add(m1);
+        materials.add(m2);
+
+        List<Material> results = new SortAndPage().sortAndPage(materials, fo);
+
+        assertMaterials(results, Arrays.asList("M2", "M1"));
+
+        Material m1Result = results.get(1);
+        Material m2Result = results.get(0);
+
+        assertTags(m1Result.getTags(), Arrays.asList("T2"));
+        assertTags(m1Result.getTags(), Arrays.asList("T2"));
+        assertTags(m2Result.getTags(), Arrays.asList("T3"));
+
+        assertProjects(m1Result.getRegistrator().getSpace().getProjects(), Arrays.asList("P2"));
+        assertProjects(m2Result.getRegistrator().getSpace().getProjects(), Arrays.asList("P2"));
+
+        assertTags(m2Result.getMaterialProperties().get("PROPERTY_3").getTags(), Arrays.asList("T1", "T3"));
+    }
+
+    @Test
+    public void testSortByMultipleFields()
+    {
+        MaterialFetchOptions fo = new MaterialFetchOptions();
+        fo.sortBy().code().desc();
+        fo.sortBy().registrationDate().asc();
+
+        Material m1 = new Material();
+        m1.setCode("S1");
+        m1.setRegistrationDate(new Date(3));
+        m1.setFetchOptions(fo);
+
+        Material m2 = new Material();
+        m2.setCode("S1");
+        m2.setRegistrationDate(new Date(2));
+        m2.setFetchOptions(fo);
+
+        Material m3 = new Material();
+        m3.setCode("S3");
+        m3.setRegistrationDate(new Date(1));
+        m3.setFetchOptions(fo);
+
+        List<Material> materials = new ArrayList<Material>();
+        materials.add(m1);
+        materials.add(m2);
+        materials.add(m3);
+
+        List<Material> results = new SortAndPage().sortAndPage(materials, fo);
+
+        Assert.assertEquals(results.get(0), m3);
+        Assert.assertEquals(results.get(1), m2);
+        Assert.assertEquals(results.get(2), m1);
+    }
+
+    private void assertMaterials(Collection<Material> results, Collection<String> codes)
+    {
+        Collection<String> actualCodes = new ArrayList<String>();
+
+        for (Material result : results)
+        {
+            actualCodes.add(result.getCode());
+        }
+
+        Assert.assertEquals(actualCodes, codes);
+    }
+
+    private void assertTags(Collection<Tag> results, Collection<String> codes)
+    {
+        Collection<String> actualCodes = new ArrayList<String>();
+
+        for (Tag result : results)
+        {
+            actualCodes.add(result.getCode());
+        }
+
+        Assert.assertEquals(actualCodes, codes);
+    }
+
+    private void assertProjects(Collection<Project> results, Collection<String> codes)
+    {
+        Collection<String> actualCodes = new ArrayList<String>();
+
+        for (Project result : results)
+        {
+            actualCodes.add(result.getCode());
+        }
+
+        Assert.assertEquals(actualCodes, codes);
+    }
+
+}
-- 
GitLab