From e2e8bcf64eafd1c7e15cc750e419c5348882d5a2 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Fri, 24 Oct 2014 13:20:05 +0000
Subject: [PATCH] SSDM-1109 : V3 AS API - deleteExperiment and deleteSample
 methods

SVN: 32651
---
 .../server/api/v3/ApplicationServerApi.java   | 57 +++++++++++++++
 .../api/v3/ApplicationServerApiLogger.java    | 38 ++++++++++
 .../shared/api/v3/IApplicationServerApi.java  | 25 +++++++
 .../AbstractObjectDeletionOptions.java        | 41 +++++++++++
 ...bstractTrashableObjectDeletionOptions.java | 39 ++++++++++
 .../api/v3/dto/deletion/DeletedObject.java    | 41 +++++++++++
 .../shared/api/v3/dto/deletion/Deletion.java  | 71 +++++++++++++++++++
 .../api/v3/dto/deletion/DeletionType.java     | 32 +++++++++
 .../experiment/ExperimentDeletionOptions.java | 31 ++++++++
 .../sample/SampleDeletionOptions.java         | 31 ++++++++
 .../deletion/DeletedObjectFetchOptions.java   | 32 +++++++++
 .../deletion/DeletionFetchOptions.java        | 63 ++++++++++++++++
 .../api/v3/dto/id/deletion/DeletionId.java    | 25 +++++++
 .../api/v3/dto/id/deletion/IDeletionId.java   | 31 ++++++++
 14 files changed, 557 insertions(+)
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractObjectDeletionOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractTrashableObjectDeletionOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletedObject.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/Deletion.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletionType.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/experiment/ExperimentDeletionOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/sample/SampleDeletionOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/DeletionId.java
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/IDeletionId.java

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/ApplicationServerApi.java
index 6f365108c7c..b468a894c8b 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
@@ -43,14 +43,19 @@ import ch.ethz.sis.openbis.generic.server.api.v3.translator.search.SearchCriteri
 import ch.ethz.sis.openbis.generic.server.api.v3.translator.search.SearchTranslationContext;
 import ch.ethz.sis.openbis.generic.server.api.v3.utils.ExceptionUtils;
 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.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.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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleUpdate;
+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.sample.SampleFetchOptions;
+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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
@@ -346,6 +351,58 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
                 new SampleTranslator(new TranslationContext(session), managedPropertyEvaluatorFactory, fetchOptions).translate(samples));
     }
 
+    @Override
+    @Transactional
+    @DatabaseCreateOrDeleteModification(value = { ObjectKind.EXPERIMENT, ObjectKind.DELETION })
+    @RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("DELETE_EXPERIMENT")
+    public IDeletionId deleteExperiments(String sessionToken, List<? extends IExperimentId> experimentIds, ExperimentDeletionOptions deletionOptions)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    @Transactional
+    @DatabaseCreateOrDeleteModification(value = { ObjectKind.SAMPLE, ObjectKind.DELETION })
+    @RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("DELETE_SAMPLE")
+    public IDeletionId deleteSamples(String sessionToken, List<? extends ISampleId> sampleIds, SampleDeletionOptions deletionOptions)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    @Transactional(readOnly = true)
+    @RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    public List<Deletion> listDeletions(String sessionToken, DeletionFetchOptions fetchOptions)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    @Transactional
+    @DatabaseCreateOrDeleteModification(value = ObjectKind.DELETION)
+    @DatabaseUpdateModification(value = { ObjectKind.EXPERIMENT, ObjectKind.SAMPLE, ObjectKind.DATA_SET })
+    @RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("RESTORE")
+    public void revertDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
+    {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    @Transactional
+    @DatabaseCreateOrDeleteModification(value = { ObjectKind.DELETION, ObjectKind.EXPERIMENT, ObjectKind.SAMPLE, ObjectKind.DATA_SET })
+    @RolesAllowed({ RoleWithHierarchy.SPACE_ADMIN, RoleWithHierarchy.SPACE_ETL_SERVER })
+    @Capability("PURGE")
+    public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
+    {
+        // TODO Auto-generated method stub
+    }
+
     @Override
     public IApplicationServerApi createLogger(IInvocationLoggerContext context)
     {
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 a9750beaf8e..9123f7751b1 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
@@ -19,14 +19,19 @@ package ch.ethz.sis.openbis.generic.server.api.v3;
 import java.util.List;
 
 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.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.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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleUpdate;
+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.sample.SampleFetchOptions;
+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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
@@ -138,4 +143,37 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements
         return null;
     }
 
+    @Override
+    public IDeletionId deleteExperiments(String sessionToken, List<? extends IExperimentId> experimentIds, ExperimentDeletionOptions deletionOptions)
+    {
+        logAccess(sessionToken, "delete-experiments", "EXPERIMENT_IDS(%s) DELETION_OPTIONS(%s)", experimentIds, deletionOptions);
+        return null;
+    }
+
+    @Override
+    public IDeletionId deleteSamples(String sessionToken, List<? extends ISampleId> sampleIds, SampleDeletionOptions deletionOptions)
+    {
+        logAccess(sessionToken, "delete-samples", "SAMPLE_IDS(%s) DELETION_OPTIONS(%s)", sampleIds, deletionOptions);
+        return null;
+    }
+
+    @Override
+    public List<Deletion> listDeletions(String sessionToken, DeletionFetchOptions fetchOptions)
+    {
+        logAccess(sessionToken, "list-deletions", "FETCH_OPTIONS(%s)", fetchOptions);
+        return null;
+    }
+
+    @Override
+    public void revertDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
+    {
+        logAccess(sessionToken, "revert-deletions", "DELETION_IDS(%s)", deletionIds);
+    }
+
+    @Override
+    public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
+    {
+        logAccess(sessionToken, "confirm-deletions", "DELETION_IDS(%s)", deletionIds);
+    }
+
 }
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 758b0280f42..2fc19a78275 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
@@ -18,14 +18,19 @@ package ch.ethz.sis.openbis.generic.shared.api.v3;
 
 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.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.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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleCreation;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleUpdate;
+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.sample.SampleFetchOptions;
+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;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.sample.ISampleId;
@@ -122,6 +127,26 @@ public interface IApplicationServerApi extends IRpcService
 
     public List<Sample> searchSamples(String sessionToken, SampleSearchCriterion searchCriterion, SampleFetchOptions fetchOptions);
 
+    // REPLACES:
+    // - IGeneralInformationChangingService.deleteExperiments(List<Long>, String, DeletionType)
+    public IDeletionId deleteExperiments(String sessionToken, List<? extends IExperimentId> experimentIds, ExperimentDeletionOptions deletionOptions);
+
+    // REPLACES:
+    // - IGeneralInformationChangingService.deleteSamples(List<Long>, String, DeletionType)
+    public IDeletionId deleteSamples(String sessionToken, List<? extends ISampleId> sampleIds, SampleDeletionOptions deletionOptions);
+
+    // REPLACES:
+    // - IGeneralInformationService.listDeletions(EnumSet<DeletionFetchOption>)
+    public List<Deletion> listDeletions(String sessionToken, DeletionFetchOptions fetchOptions);
+
+    // REPLACES:
+    // - IGeneralInformationChangingService.revertDeletions(List<Long>)
+    public void revertDeletions(String sessionToken, List<? extends IDeletionId> deletionIds);
+
+    // REPLACES:
+    // - IGeneralInformationChangingService.deletePermanently(List<Long>)
+    public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds);
+
     // NOTES:
     // - initially the new API methods should operate on concrete types (not interfaces) but in the future we want to operate on interfaces only
     // - attachments should be fetched with entities they refer to (e.g. projects, experiments etc.) when appropriate fetch option is set
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/deletion/AbstractObjectDeletionOptions.java
new file mode 100644
index 00000000000..f54fac26a10
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractObjectDeletionOptions.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion;
+
+import java.io.Serializable;
+
+/**
+ * @author pkupczyk
+ */
+public class AbstractObjectDeletionOptions implements Serializable
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private String reason;
+
+    public String getReason()
+    {
+        return reason;
+    }
+
+    public void setReason(String reason)
+    {
+        this.reason = reason;
+    }
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractTrashableObjectDeletionOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractTrashableObjectDeletionOptions.java
new file mode 100644
index 00000000000..15aa9d1c0fc
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/AbstractTrashableObjectDeletionOptions.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion;
+
+/**
+ * @author pkupczyk
+ */
+public class AbstractTrashableObjectDeletionOptions extends AbstractObjectDeletionOptions
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private DeletionType deletionType = DeletionType.TRASH;
+
+    public DeletionType getDeletionType()
+    {
+        return deletionType;
+    }
+
+    public void setDeletionType(DeletionType deletionType)
+    {
+        this.deletionType = deletionType;
+    }
+
+}
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/deletion/DeletedObject.java
new file mode 100644
index 00000000000..3ecf95dff2a
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletedObject.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("DeletedObject")
+public class DeletedObject
+{
+
+    private IObjectId id;
+
+    public IObjectId getId()
+    {
+        return id;
+    }
+
+    public void setId(IObjectId id)
+    {
+        this.id = id;
+    }
+
+}
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/deletion/Deletion.java
new file mode 100644
index 00000000000..772142fb813
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/Deletion.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.deletion.IDeletionId;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("Deletion")
+public class Deletion implements Serializable
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private IDeletionId id;
+
+    private String reason;
+
+    private List<DeletedObject> deletedObjects = new ArrayList<DeletedObject>();
+
+    public IDeletionId getId()
+    {
+        return id;
+    }
+
+    public void setId(IDeletionId id)
+    {
+        this.id = id;
+    }
+
+    public String getReason()
+    {
+        return reason;
+    }
+
+    public void setReason(String reason)
+    {
+        this.reason = reason;
+    }
+
+    public List<DeletedObject> getDeletedObjects()
+    {
+        return deletedObjects;
+    }
+
+    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/deletion/DeletionType.java
new file mode 100644
index 00000000000..698cb526829
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/DeletionType.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion;
+
+import java.io.Serializable;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("DeletionType")
+public enum DeletionType implements Serializable
+{
+
+    PERMANENT, TRASH
+
+}
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/deletion/experiment/ExperimentDeletionOptions.java
new file mode 100644
index 00000000000..9d21b540b2f
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/experiment/ExperimentDeletionOptions.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion.experiment;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractTrashableObjectDeletionOptions;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("ExperimentDeletionOptions")
+public class ExperimentDeletionOptions extends AbstractTrashableObjectDeletionOptions
+{
+
+    private static final long serialVersionUID = 1L;
+
+}
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/deletion/sample/SampleDeletionOptions.java
new file mode 100644
index 00000000000..7974fdd5f1a
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/deletion/sample/SampleDeletionOptions.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.deletion.sample;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.deletion.AbstractTrashableObjectDeletionOptions;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("SampleDeletionOptions")
+public class SampleDeletionOptions extends AbstractTrashableObjectDeletionOptions
+{
+
+    private static final long serialVersionUID = 1L;
+
+}
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
new file mode 100644
index 00000000000..72db7c84a90
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletedObjectFetchOptions.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.io.Serializable;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("DeletedObjectFetchOptions")
+public class DeletedObjectFetchOptions implements Serializable
+{
+
+    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
new file mode 100644
index 00000000000..70ad5e1b63f
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionFetchOptions.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.io.Serializable;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("DeletionFetchOptions")
+public class DeletionFetchOptions implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    private DeletedObjectFetchOptions allDeletedObjects;
+
+    private DeletedObjectFetchOptions originallyDeletedObjects;
+
+    public DeletedObjectFetchOptions fetchAllDeletedObjects()
+    {
+        if (allDeletedObjects == null)
+        {
+            allDeletedObjects = new DeletedObjectFetchOptions();
+        }
+        return allDeletedObjects;
+    }
+
+    public boolean hasAllDeletedObjects()
+    {
+        return allDeletedObjects != null;
+    }
+
+    public DeletedObjectFetchOptions fetchOriginallyDeletedObjects()
+    {
+        if (originallyDeletedObjects == null)
+        {
+            originallyDeletedObjects = new DeletedObjectFetchOptions();
+        }
+        return originallyDeletedObjects;
+    }
+
+    public boolean hasOriginallyDeletedObjects()
+    {
+        return originallyDeletedObjects != null;
+    }
+
+}
\ No newline at end of file
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/DeletionId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/DeletionId.java
new file mode 100644
index 00000000000..d8831d80d8d
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/DeletionId.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2014 ETH Zuerich, Scientific IT Services
+ *
+ * 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.id.deletion;
+
+/**
+ * @author pkupczyk
+ */
+public class DeletionId
+{
+
+}
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/IDeletionId.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/IDeletionId.java
new file mode 100644
index 00000000000..a563c099d9e
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/id/deletion/IDeletionId.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2012 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.id.deletion;
+
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId;
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * Holds information that uniquely identifies a deletion in openBIS.
+ * 
+ * @author pkupczyk
+ */
+@JsonObject("IDeletionId")
+public interface IDeletionId extends IObjectId
+{
+
+}
\ No newline at end of file
-- 
GitLab