From 9e91613331e7a6668140c5a54c8a88c4d54fb08e Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Tue, 1 Sep 2015 12:42:51 +0000
Subject: [PATCH] SSDM-2437 : V3 AS API - make it possible to search for
 samples without an experiment - dataset withoutExperiment and withoutSample

SVN: 34563
---
 .../SampleSearchCriterionTranslator.java      | 17 ++++-
 .../openbis/generic/shared/dto/DataPE.java    |  5 +-
 .../systemtest/api/v3/SearchDataSetTest.java  | 17 +++++
 .../sql/postgresql/146/008=data_all.tsv       | 74 +++++++++----------
 .../v3/dto/search/DataSetSearchCriterion.java | 16 +++-
 .../NoSampleContainerSearchCriterion.java     |  2 +-
 .../dto/search/NoSampleSearchCriterion.java   | 30 ++++++++
 7 files changed, 116 insertions(+), 45 deletions(-)
 create mode 100644 openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleSearchCriterion.java

diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/search/SampleSearchCriterionTranslator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/search/SampleSearchCriterionTranslator.java
index 5a928b52202..e504ddedb9b 100644
--- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/search/SampleSearchCriterionTranslator.java
+++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/translator/search/SampleSearchCriterionTranslator.java
@@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.translator.search;
 
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.ISearchCriterion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.NoSampleContainerSearchCriterion;
+import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.NoSampleSearchCriterion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.SampleChildrenSearchCriterion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.SampleContainerSearchCriterion;
 import ch.ethz.sis.openbis.generic.shared.api.v3.dto.search.SampleParentsSearchCriterion;
@@ -41,15 +42,25 @@ public class SampleSearchCriterionTranslator extends AbstractCompositeSearchCrit
     @Override
     protected boolean doAccepts(ISearchCriterion criterion)
     {
-        return criterion instanceof SampleSearchCriterion || criterion instanceof NoSampleContainerSearchCriterion;
+        return criterion instanceof SampleSearchCriterion || criterion instanceof NoSampleSearchCriterion;
     }
 
     @Override
     protected SearchCriterionTranslationResult doTranslate(SearchTranslationContext context, ISearchCriterion criterion)
     {
-        if (criterion instanceof NoSampleContainerSearchCriterion)
+        if (criterion instanceof NoSampleSearchCriterion)
         {
-            return new SearchCriterionTranslationResult(new DetailedSearchSubCriteria(AssociatedEntityKind.SAMPLE_CONTAINER, null));
+            AssociatedEntityKind entityKind;
+
+            if (criterion instanceof NoSampleContainerSearchCriterion)
+            {
+                entityKind = AssociatedEntityKind.SAMPLE_CONTAINER;
+            } else
+            {
+                entityKind = AssociatedEntityKind.SAMPLE;
+            }
+
+            return new SearchCriterionTranslationResult(new DetailedSearchSubCriteria(entityKind, null));
         } else
         {
             context.pushEntityKind(EntityKind.SAMPLE);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java
index 94bedb76ac7..dc83a7f16ba 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java
@@ -69,6 +69,7 @@ import ch.systemsx.cisd.common.collection.UnmodifiableSetDecorator;
 import ch.systemsx.cisd.openbis.generic.shared.IServer;
 import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant;
 import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifierHolder;
+import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.NullBridge;
 import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.SearchFieldConstants;
 import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
 import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
@@ -478,7 +479,7 @@ public class DataPE extends AbstractIdAndCodeHolder<DataPE> implements
     @SuppressWarnings("unused")
     @Transient
     @Field(index = Index.YES, store = Store.YES, name = SearchFieldConstants.SAMPLE_ID)
-    @FieldBridge(impl = org.hibernate.search.bridge.builtin.LongBridge.class)
+    @FieldBridge(impl = NullBridge.class)
     private Long getSampleId()
     {
         Long result = null;
@@ -679,7 +680,7 @@ public class DataPE extends AbstractIdAndCodeHolder<DataPE> implements
     @SuppressWarnings("unused")
     @Transient
     @Field(index = Index.YES, store = Store.YES, name = SearchFieldConstants.EXPERIMENT_ID)
-    @FieldBridge(impl = org.hibernate.search.bridge.builtin.LongBridge.class)
+    @FieldBridge(impl = NullBridge.class)
     private Long getExperimentId()
     {
         Long result = null;
diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/SearchDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/SearchDataSetTest.java
index c5440b1cf67..31ef6dbee4e 100644
--- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/SearchDataSetTest.java
+++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/api/v3/SearchDataSetTest.java
@@ -142,6 +142,23 @@ public class SearchDataSetTest extends AbstractDataSetTest
         testSearch(TEST_USER, criterion, "20081105092259000-9");
     }
 
+    @Test
+    public void testSearchWithExperiment()
+    {
+        DataSetSearchCriterion criterion = new DataSetSearchCriterion();
+        criterion.withCode().thatStartsWith("20120628092259000");
+        criterion.withExperiment();
+        testSearch(TEST_USER, criterion, "20120628092259000-24", "20120628092259000-25");
+    }
+
+    @Test
+    public void testSearchWithoutExperiment()
+    {
+        DataSetSearchCriterion criterion = new DataSetSearchCriterion();
+        criterion.withoutExperiment();
+        testSearch(TEST_USER, criterion, "20120628092259000-23");
+    }
+
     @Test
     public void testSearchWithExperimentWithPermIdThatEquals()
     {
diff --git a/openbis/sourceTest/sql/postgresql/146/008=data_all.tsv b/openbis/sourceTest/sql/postgresql/146/008=data_all.tsv
index f3ff8485b8d..5670028b641 100644
--- a/openbis/sourceTest/sql/postgresql/146/008=data_all.tsv
+++ b/openbis/sourceTest/sql/postgresql/146/008=data_all.tsv
@@ -1,37 +1,37 @@
-2	20081105092158673-1	2	\N	2008-11-05 09:21:58.688+01	2008-11-05 09:21:58.798+01	f	t	2009-03-23 15:34:44.462776+01	2	1	f	982	\N	1	2	0	\N	2011-04-01 09:56:25.410678+02
-4	20081105092159188-3	2	\N	2008-11-05 09:21:59.203+01	2008-11-05 09:21:59.313+01	f	t	2009-03-23 15:34:44.462776+01	2	1	t	\N	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
-5	20081105092159111-1	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:20:21.646654+01	f	t	2009-03-23 15:34:44.462776+01	18	1	f	1042	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
-6	20081105092159222-2	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:11.479816+01	f	t	2009-03-23 15:34:44.462776+01	19	1	f	1043	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
-7	20081105092159333-3	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:47.815468+01	f	t	2009-03-23 15:34:44.462776+01	20	1	f	1044	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
-8	20081105092259000-8	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-9	20081105092259000-9	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-10	20081105092259900-0	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-11	20081105092259900-1	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-12	20081105092359990-2	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-13	20110509092359990-10	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-14	20110509092359990-11	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-15	20110509092359990-12	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-17	20110805092359990-17	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:47.815468+01	f	t	2009-03-23 15:34:44.462776+01	20	1	f	1044	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-18	20081105092259000-18	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-19	20081105092259000-19	4	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-20	20081105092259000-20	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-21	20081105092259000-21	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-22	20120619092259000-22	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-23	20120628092259000-23	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-24	20120628092259000-24	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-25	20120628092259000-25	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-26	VALIDATIONS_CNTNR-26	6	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-27	VALIDATIONS_IMPOS-27	7	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-28	VALIDATIONS_PARENT-28	8	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-29	ROOT_CONTAINER	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-30	CONTAINER_1	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-31	CONTAINER_2	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-32	COMPONENT_1A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-33	COMPONENT_2A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-34	COMPONENT_1B	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-35	DATASET-TO-DELETE	1	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-36	CONTAINER_3A	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-37	CONTAINER_3B	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-38	COMPONENT_3A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-39	COMPONENT_3AB	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
-40	COMPONENT_3Ax	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	23	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+2	20081105092158673-1	2	\N	2008-11-05 09:21:58.688+01	2008-11-05 09:21:58.798+01	f	t	2009-03-23 15:34:44.462776+01	2	1	f	982	\N	1	2	0	\N	2011-04-01 09:56:25.410678+02
+4	20081105092159188-3	2	\N	2008-11-05 09:21:59.203+01	2008-11-05 09:21:59.313+01	f	t	2009-03-23 15:34:44.462776+01	2	1	t	\N	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
+5	20081105092159111-1	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:20:21.646654+01	f	t	2009-03-23 15:34:44.462776+01	18	1	f	1042	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
+6	20081105092159222-2	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:11.479816+01	f	t	2009-03-23 15:34:44.462776+01	19	1	f	1043	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
+7	20081105092159333-3	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:47.815468+01	f	t	2009-03-23 15:34:44.462776+01	20	1	f	1044	\N	\N	2	0	\N	2011-04-01 09:56:25.410678+02
+8	20081105092259000-8	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+9	20081105092259000-9	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+10	20081105092259900-0	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+11	20081105092259900-1	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+12	20081105092359990-2	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+13	20110509092359990-10	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+14	20110509092359990-11	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+15	20110509092359990-12	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+17	20110805092359990-17	2	\N	2008-11-05 09:21:59.203+01	2009-02-09 12:21:47.815468+01	f	t	2009-03-23 15:34:44.462776+01	20	1	f	1044	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+18	20081105092259000-18	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+19	20081105092259000-19	4	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+20	20081105092259000-20	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+21	20081105092259000-21	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	8	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+22	20120619092259000-22	2	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+23	20120628092259000-23	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	\N	1	t	325	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+24	20120628092259000-24	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+25	20120628092259000-25	5	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+26	VALIDATIONS_CNTNR-26	6	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+27	VALIDATIONS_IMPOS-27	7	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+28	VALIDATIONS_PARENT-28	8	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+29	ROOT_CONTAINER	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+30	CONTAINER_1	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+31	CONTAINER_2	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+32	COMPONENT_1A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+33	COMPONENT_2A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+34	COMPONENT_1B	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+35	DATASET-TO-DELETE	1	\N	2008-11-05 09:22:59.203+01	2008-11-05 09:22:59.313+01	f	t	2009-03-23 15:34:44.462776+01	23	1	t	\N	2	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+36	CONTAINER_3A	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+37	CONTAINER_3B	4	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+38	COMPONENT_3A	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+39	COMPONENT_3AB	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	8	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
+40	COMPONENT_3Ax	2	\N	2011-05-09 10:22:59.203+02	2011-05-09 10:22:59.313+02	f	t	2011-05-09 16:34:44.462776+02	23	1	t	\N	\N	\N	2	0	\N	2014-04-01 09:56:25.410678+02
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/DataSetSearchCriterion.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/DataSetSearchCriterion.java
index 05530dc034f..c1ef8f4d26e 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/DataSetSearchCriterion.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/DataSetSearchCriterion.java
@@ -59,12 +59,24 @@ public class DataSetSearchCriterion extends AbstractEntitySearchCriterion<IDataS
     {
         return with(new ExperimentSearchCriterion());
     }
-    
+
+    public DataSetSearchCriterion withoutExperiment()
+    {
+        with(new NoExperimentSearchCriterion());
+        return this;
+    }
+
     public SampleSearchCriterion withSample()
     {
         return with(new SampleSearchCriterion());
     }
-    
+
+    public DataSetSearchCriterion withoutSample()
+    {
+        with(new NoSampleSearchCriterion());
+        return this;
+    }
+
     public DataSetSearchCriterion withOrOperator()
     {
         return (DataSetSearchCriterion) withOperator(SearchOperator.OR);
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleContainerSearchCriterion.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleContainerSearchCriterion.java
index 83540cac9de..46de327a40c 100644
--- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleContainerSearchCriterion.java
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleContainerSearchCriterion.java
@@ -22,7 +22,7 @@ import ch.systemsx.cisd.base.annotation.JsonObject;
  * @author pkupczyk
  */
 @JsonObject("dto.search.NoSampleContainerSearchCriterion")
-public class NoSampleContainerSearchCriterion implements ISearchCriterion
+public class NoSampleContainerSearchCriterion extends NoSampleSearchCriterion
 {
 
     private static final long serialVersionUID = 1L;
diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleSearchCriterion.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleSearchCriterion.java
new file mode 100644
index 00000000000..7c269b9e745
--- /dev/null
+++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/search/NoSampleSearchCriterion.java
@@ -0,0 +1,30 @@
+/*
+ * 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.search;
+
+import ch.systemsx.cisd.base.annotation.JsonObject;
+
+/**
+ * @author pkupczyk
+ */
+@JsonObject("dto.search.NoSampleSearchCriterion")
+public class NoSampleSearchCriterion implements ISearchCriterion
+{
+
+    private static final long serialVersionUID = 1L;
+
+}
-- 
GitLab