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 004d0f4b467e943b133ea5c8cb1d6e8c57f86838..c132d629db1578cd4e0c1f75b912de0c393e7abc 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 f5fe5a24fc19c4ced27b779b8d4bbe9962d009b4..8e048d6c1fa3dcd6a0d90288f713208d2e7d702a 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 2e112b179842266201803135699a3689a7b38629..f09d9dc7c20530bd9eb04380f895d1c426a43126 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 94e6299b1808ce3dff79728b37ce33864d5e5b97..33e57ee6623dafaed71f162c5476266457d06f43 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 fef9a61a297d43e469e764a39ab41b2e405a358b..1f44403e569c9033f7708011cde44f5106ebc3bd 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 bb0860ba7ce77b51d2e18b8f9475040c237e7b29..03aea653587cbb16711ede505cfbfb110081f5b1 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 10c53490007565bd4818fdc4a2255d455fc98424..5f5115d3b5b4bf4705b7142b5b7bb059863c705e 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 2825fbf638099d61dbaacc825f33866772904936..167bfdb0d922ffbc9bfaea777b7e90cd8f2e1539 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 77780300bab7dc6ea9104ef618359c8e82e83a0c..224b372e050b58fe8c5902d8eef7d58d9831707c 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 2b85dc0e1d61ea508f0837220c90c6a61cca70b6..f69bee28d98e504245b0173dcd08ddbe3356f535 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 b32ee7b1ac87cee9c35f92d013ca68dfe7d9ce37..085b30c6934afbc9706e9c03349d0472e2a97269 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 2f4053203a8a7b2b2a464f77a7e6fc23ddc7f5e4..0bcd39742ced39809fc8b2b16e676c6b5a55524d 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 93360660f3f124a9cdb57c95c30bf244e92d0466..711363d75d03f514c31cd9f52be2f9f417887509 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 3512cd5b56d7a994958c425d8d599947f3f60f6e..81e4977fd6347f47e5257e7c6124cccd2c89a2fa 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 83e685ac6a645aeb11de3108822a467d787906c4..5e7a09fbc42c2efeabc6867c819a69a9753ca785 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 a326e80d046ff2dfae6eccedc7c3f274a2b84fcb..20e5f776aec08e97be9d478cfbacdd055a97dec7 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 56f59bdbeb7df6efeb84ae2814929faaea32548e..ab210deba60dc82bf659ac2efdf7accd71a312f4 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 d2a1705eee82bb767a6d36f666cb7df1f38c2394..84f576b587f8ead7a284fea1c7c24eb8dbe1cb35 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 395ce0548822e6b6ba99458c7ffb7338617e1bc9..fc3c771531e73e8347685bed6e933d06a7ab074f 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 d3b7c2f176b726d62ea2b8fca7975732a4a486b0..5ee5e612b408be05249eaf387bf977b9db10ab84 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 e9e757c1f6ed536e4c5ca41382cdfa975c8932ea..02bb6344494fe1dae5aee271947b3ed19091f4ee 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 868579a6821f26c7c16a4f47b1f290b76f64b080..2e13a0835a35cad9b9d35171cb137e2e4ab9b4c1 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 6af2000b790e079801dc5f678c16a0f83178a6df..c0cd5b68b0437325acaa5ad9080fc050794db319 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 cad95debe984fd597346bc0f2bec274cc63832ba..e82d7a2da21344694ee8045b0abc2de23b6b9209 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 061452ae55d99771bd0dbc4f6474d75657bd70e0..9b21eb67c2956b2eb9bd0ba623ccffde2346cab8 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 b5dae2e7b6adaef3d933ca2b66f5707ef05bb1e5..1dbf4881c452e66be795b66203e02d7faaf9a6f4 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 b512f727d6431b628a928d5519a264ae757d80c7..bed37204c44b2a2987d8a1e190a2ef752d1cbf04 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 24722abf745c336fd60be1089794725ae294c8ec..b55a066a66c9d074085ed05c43292b96bd227227 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 b3727db56acaa98406a8e9804a53ebb1e7e21519..1c23dcf78c8d3d963e25bdff0c72c1edb780abec 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 6b33b8ffb1373a60dece5147eadf4c2f0e6f1ad1..53f455a05db0c1c4952dd9d1b84e344cbb4fec57 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 881f6772987a2e7a8451e9aaf7b43e98cca86210..e19814a1a4264e87d135d5d4045f6a4613eaa3c2 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 ae1309d33f976537ba246882041d792a9a3afe61..872be0654aa9914e120064b6eb9509e3f0aae3cf 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 b61d4751acc1ebf5729ecc4203f055fc015f0a34..fc8c5a6cf47f68670f22758b804b13dd3ada666b 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 7ace56084a42f5f7c3dc73f713197f478143b377..c7c5e2d99e2422cfb6fee67fc57da7ffa94ac96f 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 58c0f69633092ae658cda95d48295735dbeb26aa..162382780487b2301335b9871a2554ecc53136a0 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 059e453cdf8dcaede8eedaf15df2e9c314c84e40..3ed1a6b78fdd13c5c5969ee80d51056d71554061 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 4a69cae303fc8b4dfac3077a9de3b163bbe94041..7dabde213aefff4ff9b75645a0abc0d16b81ff97 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 26eb3a2c44ebf5a39c968306243caf79e6a4b261..61bb21ed63d2d401d98d81a173eb0997fb86a546 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 b22046cacc69ff70557fb69981d2928cc1d453de..9fb90393e69faaeb0410b848ae5ee6a31021d22d 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 6b6ff412d36beec0577e8c2a10d6e27817213dfe..69c097991359d761dcf7874dba3f6b5954a45333 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 88253fa488363bb1391dec846645290dedba5d5e..1fdf58c9236d96c6df496bef902a5b00470786ef 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 0b88128f86442793d04ee9fa3b653cfa18e2ea41..b1ce9714e173496bfff65ab002c4ab1d9c5be80a 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 b766c68c9e0494b0e59972f13962797a5377216c..8f32ed116b9e8ee3c8e1ffb56de32536d911b173 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 814d1085095838113e452f9e97de8ed320af821a..7af012fc4415b02718de1d3a81202e80ee090501 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 9ac66960d4f6588b3b7c1c878f1652b1ef095239..b9a2b45efab37cac66d1d100352ef0fc086e5e52 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 b9a266c544edf990c9f8595fe0ca6d108a66c480..be56eb5ccfada8a85ff4784ae664f283e63cdb62 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 36ccb4a3fbab6972f5a9cf0a4b8cd231e77f78ea..4ccb435337aabcc33ee2bde38b892f122ef99906 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 aa0ab22c5a087f35ba2d094e463680deef56417e..745abee6d86405bec15c4d7ed9cbdbe95028a719 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 fcbb82bdaa01df6064f929b3bf7d09ce98f18f3c..3c8be1643dec18c22c6a4382d39e1db41528e53d 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 19b28ee6045d9874cf464aff7f0fcbf0a2b800e8..b5969ac5ffd4d739f01033e5ad77b22732119fdb 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 c7899d07ee0d4f48f1847178b4468f87fc3f0952..ded9320b353bb196d55e0f1b894796c32bc70703 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 7eba14a357bfbc1125ee6839b56af128a7a053d4..f3e39e16778c619e3eff75eac0d9224af07a0877 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 d014d5c8425e84e1fd3f225a2b6a2b84edebde02..5787b31f18c36926eb58dac1c8d995e95f5884fb 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 f897cc64fb7023a5097ace4864fcafe575b3bfd3..184df422fc98322c3696025c3dc47ba14f1a92d6 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 2ef9d74714e3b6601ef788ad877903c10328860b..009bae1bc49b413ced97cdfbad374013bdb06820 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 92059a9a84ed42d663aa992cd905d6a4d64f86ad..b5a4b949deff7a5b84ce753f7654d59aa4184d09 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 b27774046bfaab93a1b665d592b94875bebc2c9b..d90f459d64b94fd6cd12531c140caa53d6412aec 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 eacc3f6055827164fb1a736e24dd94992b037b41..b031e7aa1f8bd0ccc864756f8bdddc9820ac0c5e 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 2f29bce37162141a7181e50acd749fe860e50a51..cd6dfa9931065c40124dc881aa26dbcd2ded54c0 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 c9840ce7aae1beffe5c37fd22170c3222b9e677f..4e4cfb3d3e55b06b25bccd4efc511b7ae5fa3a01 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 8df07b53ddbf8fe24a3c494c3929e668bc0d01a1..689a053fd1adb0e58cf74f814701c9c0e1a00511 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 a300ecf04779063610dde5f86cd9c0505ae295e5..ad0b4447872d068b5880e801f4344512d521bcba 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 90dae4dd8cf3f644716d1d89ebd647ce035f009e..e1ed58037daaf4eefcc82c70918e442400326439 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 708a21fba4362a5afdc3a958b40d66d40d2becea..097a44051442621907dd1f728da13a4dbf3b4510 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 73e91081e94dffce945abe80a2ceeb254cf7c3ef..e8f206728c094eb15bbfe06a967508cd91c0dc3a 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 579f7fde331b578f5555178531ba63b87d9cffa5..ad3ce574d7138b01f26aea8373e16bb9ade3d316 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 29b05519fb17c5e4e39d743dd3cf7b9af03aaba4..ba33e30ea448bbd8152fe50318c56aac7cad0e50 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 76a781b96101ef289cfb9cda773aad2e83d86376..15626352f01265252e416519749ef2fe0c0a7110 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 c4f575ab6a175ec98b5cc47b8735b12449aa7912..ac88c8256e451499c263775127f0052f1824ddba 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 93679d016add65fb51afc340493122cb21928300..e35e63d6b2b4d4b2c6f153a03885b1733c846d92 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 2bc9242a7ac6c0d9b664cd02976733aa551fbcb1..124e888b59bb5ac2d47469db0a620e1b0ad6011e 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 7abda7cec683aa6626e99f3da57d915b29388db6..2b2d8f71471cc5a36f3040a336ee7e4d7a20892c 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 14177541979074713197b0ebde5ef6e4d03acd0f..e6aa3967df440e45ab3c3346208998bbc3ee1414 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 bf58714e14cd23d092c88b3b4bffd33c0e3ea1af..8eda45633025a98393b481684d28548e7b7b2a46 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 3455de54527626ebf3ed0fed9fd7851f15a7ce9a..e408e165032c03613e1b9b3bdb26e0b60acec68a 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 68282f1a00acb0bc7ea0257d64ebe309b368a3dd..092e381364ebfdd32d68c46e8c8142aef04d1aaa 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 b6c78b61e3e873ad1d27b4811e827bd29f70d64a..ab6b688366738cbb3da58e822ea2755dfbaafb0b 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 e100bdac65917d0f30597375f0768667fd016f12..1747fa93fc824b6b5953954f4774301d04984d53 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 0e2e8bc91f0cfee86eed8ba12f12dad35e417703..01ef5fe2449c5433937ff2567202d1b14a21aaa3 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 0000000000000000000000000000000000000000..eca4466e71e836f8e16a522ee5a3dd90ace2ff46
--- /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 0000000000000000000000000000000000000000..41029031f9bb2ecdc65636f3cf7d9ae0c2f61a5c
--- /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 28fc45f70eee0ec9fecd9383d1c92fc9a544c9bc..4d8d0660da0ba8263a8f0822b77ef4f5d1d770e5 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 0000000000000000000000000000000000000000..5246cafb6d24da01697350530290256dde189a46
--- /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 36e26059e21a12c930a87d842cc6af3e25ed3f16..5584a6c84d5976eb49db539447e35c15dbe0af95 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 0000000000000000000000000000000000000000..14685162d7098f8b43d679c57fe5d5f87d96c6be
--- /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 c5e5f1824a4442f3fafd106da9499823358b93b2..92fc37869ee1655ea1582e06943b5d0c0c842d7b 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 0000000000000000000000000000000000000000..414253140d96a9941fa6b872fec3257456a63e5f
--- /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 7d722dc2257f8346f157ed7d856a1650503ba275..d9505c4117bd0b1ad8d9cbc3d79f1ea3c77f6ab1 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 0000000000000000000000000000000000000000..e770bc5a6fbede402f0e8bdbc99d007fcd5d8998
--- /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 670c1c082418fd5ec81069ea6fc98bf79a6fff62..4aaade427ca37a3b977a190a073e1c71fb7b56c8 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 0000000000000000000000000000000000000000..ccd5be8675b4a411594483908de85df5e7dc8109
--- /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 6156667918c4f4aad740f08c32fb8f0d7b21a80c..cd82e9c7ff1a236147ae45523639f28cc32b9667 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 0000000000000000000000000000000000000000..c139479e2baf5c8a1f2c15850cd76b00c4321074
--- /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 6388e580e4769653f311b16d5845931e20496deb..12ee14bfd747757d4de2ba9345937fa83dc39f09 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 1cd5eb5a05e3388e8878c3cd57f8d7b740673073..0e886c8a2d87107734d11232a9ef7fe176dc4d29 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 0000000000000000000000000000000000000000..46a240d6fbe36b0899e427c334c0fee1a8033dfd
--- /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 25030d35108061d5b6c893224125e2e7e99662fb..9013afc65da7ffc5cd098fcc66d2d48bce4f3b65 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 0000000000000000000000000000000000000000..839f916dce8d7c36cb0f72ffff46b777c25c1953
--- /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 8d10720a642a3fc202b336eef1dabff44a6eff24..a462ff1246d7d2716a7ddf3e9d5b0e8d91f0db1a 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 0000000000000000000000000000000000000000..6b552db0b8187f983709e11dc3a4a0bde41239b0
--- /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 0092da64bb3cbe771772daf18fffe9a7678eab36..2171b0067794f91d889716caec176c127df4ad06 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 0000000000000000000000000000000000000000..0fa7f134c163c6c87b82062de45172d9e9507d69
--- /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 6d9ed841626358119904764665ef32adc9c06e41..a7ad2a8c7b2827d84bf351b07477f0fcf1422abe 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 7edb895c1c1f63c5a4f853c98a4a29e01dda0468..97cb3048be37f76c5bb1a9dacd491134030ede12 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 53b39409eeb6fc61c905c3c66754d11391870a3a..76e8f31439c8e8d0c71097ff55309ba2281f8323 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 0000000000000000000000000000000000000000..aa5593f5bdd4565da648d5837b6e5c3fdb093033
--- /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 62f5bb5fadb3c17cf5531841cc0def62ac1d9b6f..39ec641cadce8b00f0576f7ceab105966a32c964 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 0000000000000000000000000000000000000000..337b95db8df3770d4bc17bbaadd7e2e8d231e060
--- /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 cd0e337b9c212348d236e0f80ba0a1c6ed2bd06d..aecb394be4594007e26b37b3aa2b0251a60d807e 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 0000000000000000000000000000000000000000..d804307d145c93f264457d0e8809e4229e2389d4
--- /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 baa179c8bf90ed155f020a277a59769829df3955..b2197736ee89e5e56e649fb2317b9765af7d48bc 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 42bd728e740771acf1964e6789ffb50fc484bd57..8ccbdb45efc34186b8804b3d72c901e1882e09ab 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 0000000000000000000000000000000000000000..05322bc53480fc7a57b053cbbf7f6295b3d5a7ac
--- /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 09330948082f94b785d68fcc026b166892301c8a..50a7d0d9096392475cb0927549b87627a7fd9056 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 0000000000000000000000000000000000000000..9a230c639e693e9c2574c18b83a5c002fff3a8b3
--- /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 0000000000000000000000000000000000000000..ebf18ba023370da6077069d2233c3e920d9467f0
--- /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 0000000000000000000000000000000000000000..93184b901751723693a6350fc2fa5c9f12e12604
--- /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 0000000000000000000000000000000000000000..dda6ef69d81fbd48053c470f820597dba94c19e7
--- /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 9d5fadfc6de3549302605b71aa24382b17121d2f..bdc6383d815c251b928be754d66c4176b08c137d 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 0000000000000000000000000000000000000000..5da09c6006fbfa5784f9c052d3a5598556065525
--- /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 43d70160d2004726e9ec8b986e22ce115b1a9d9e..8982c2ab4b4f689a567d246b061e5199288280bf 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 0000000000000000000000000000000000000000..68d29b97f8751de9c9d1680ac4fea91434601d41
--- /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 8a327f5bfe0b9793076af7b953ae1b5be0add297..36d089db7aa206f25e1066693a5381ef008632a3 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 4842d160b61f91055b6a3379362f18651aacfa29..bc8626ca79dce2773028d99df182f70a46749d12 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 095cdf1f8b2369cda091b79bbe36e25375b3e86a..c3d38aac289dfee910bfac5653f114286b58cc9a 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 0000000000000000000000000000000000000000..48b9784847395d6ee1979204bbf3301635a9ec59
--- /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 6b4971f2b678b45c02addee9615f3e0c4688e0f8..cc718179637d5490fc36a9ad40e2374f9eeb735e 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 0000000000000000000000000000000000000000..258388987d4e5c607604cf50c141479e59359e26
--- /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 805d3cff6d2456ccb1c8a1cc86bac0953bc888ff..0fdb3b01ecff437b1d54036fde0fccd54cd7fcb8 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 9fb5687f3d7d9e661a898c4e28ae67639f05c797..04fab4b7fe1bddc17b26efb56b70c4bf21d57332 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 0000000000000000000000000000000000000000..2e31db57a003f8144b24503cee796565cc2fce13
--- /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 0000000000000000000000000000000000000000..0fbd5dfbaf191bd96725ea123cc51f4a8ba27c64
--- /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);
+    }
+
+}