From 64acc85f3525957624603adecf01bf2f3dddf7c8 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Thu, 19 Mar 2015 12:33:33 +0000
Subject: [PATCH] SSDM-1621: Adding DataSetTypeWithoutExperimentChecker to
 AbstractBusinessObject.

SVN: 33695
---
 .../server/CommonBusinessObjectFactory.java   | 73 ++++++++++++-------
 .../business/bo/AbstractBusinessObject.java   | 42 +++++++++--
 .../bo/AbstractDataSetBusinessObject.java     |  8 +-
 .../bo/AbstractMaterialBusinessObject.java    | 12 ++-
 .../bo/AbstractSampleBusinessObject.java      | 17 +++--
 ...bstractSampleIdentifierBusinessObject.java | 11 ++-
 .../server/business/bo/AttachmentBO.java      |  6 +-
 .../business/bo/AuthorizationGroupBO.java     | 11 ++-
 .../server/business/bo/CorePluginTable.java   |  6 +-
 .../server/business/bo/DeletionTable.java     |  6 +-
 .../server/business/bo/EntityTypeBO.java      |  6 +-
 .../business/bo/EntityTypePropertyTypeBO.java | 11 ++-
 .../server/business/bo/ExperimentBO.java      | 13 ++--
 .../server/business/bo/ExperimentTable.java   | 11 ++-
 .../business/bo/GridCustomColumnBO.java       |  6 +-
 .../business/bo/GridCustomFilterBO.java       |  6 +-
 .../server/business/bo/MaterialBO.java        |  6 +-
 .../server/business/bo/MaterialTable.java     | 12 ++-
 .../server/business/bo/MetaprojectBO.java     |  6 +-
 .../generic/server/business/bo/ProjectBO.java |  6 +-
 .../server/business/bo/PropertyTypeBO.java    |  6 +-
 .../server/business/bo/PropertyTypeTable.java |  6 +-
 .../business/bo/RoleAssignmentTable.java      |  6 +-
 .../generic/server/business/bo/SampleBO.java  | 22 +++---
 .../server/business/bo/SampleTable.java       |  6 +-
 .../generic/server/business/bo/ScriptBO.java  | 12 ++-
 .../business/bo/SearchDomainSearcher.java     |  6 +-
 .../generic/server/business/bo/SpaceBO.java   |  6 +-
 .../generic/server/business/bo/TrashBO.java   |  6 +-
 .../server/business/bo/VocabularyBO.java      | 11 ++-
 .../server/business/bo/VocabularyTermBO.java  |  6 +-
 .../server/business/bo/util/SampleUtils.java  | 20 -----
 .../business/bo/AuthorizationGroupBOTest.java |  2 +-
 .../business/bo/CorePluginTableTest.java      |  2 +-
 .../server/business/bo/EntityTypeBOTest.java  |  2 +-
 .../bo/EntityTypePropertyTypeBOTest.java      |  2 +-
 .../server/business/bo/ExperimentBOTest.java  | 18 ++---
 .../business/bo/ExperimentTableTest.java      |  2 +-
 .../business/bo/GridCustomFilterBOTest.java   |  2 +-
 .../server/business/bo/MaterialTableTest.java |  2 +-
 .../server/business/bo/ProjectBOTest.java     |  2 +-
 .../business/bo/PropertyTypeBOTest.java       |  2 +-
 .../business/bo/RoleAssignmentTableTest.java  |  2 +-
 .../server/business/bo/SampleBOTest.java      |  2 +-
 .../server/business/bo/SampleTableTest.java   |  2 +-
 .../server/business/bo/ScriptBOTest.java      |  2 +-
 .../business/bo/SearchDomainSearcherTest.java |  2 +-
 .../server/business/bo/SpaceBOTest.java       |  2 +-
 .../server/business/bo/TrashBOTest.java       |  2 +-
 .../server/business/bo/VocabularyBOTest.java  |  4 +-
 50 files changed, 268 insertions(+), 174 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
index f99f12df9d9..f6a0a4a0181 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java
@@ -120,33 +120,37 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
     @Override
     public final IAttachmentBO createAttachmentBO(final Session session)
     {
-        return new AttachmentBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new AttachmentBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final ISpaceBO createSpaceBO(final Session session)
     {
-        return new SpaceBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new SpaceBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IScriptBO createScriptBO(final Session session)
     {
-        return new ScriptBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), jythonEvaluatorPool);
+        return new ScriptBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker, jythonEvaluatorPool);
     }
 
     @Override
     public final IRoleAssignmentTable createRoleAssignmentTable(final Session session)
     {
         return new RoleAssignmentTable(getDaoFactory(), session,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final ISampleTable createSampleTable(final Session session)
     {
         return new SampleTable(getDaoFactory(), session, getRelationshipService(),
-                getEntityOperationChecker(), getManagedPropertyEvaluatorFactory());
+                getEntityOperationChecker(), getManagedPropertyEvaluatorFactory(),
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
@@ -186,7 +190,8 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
     public final ISampleBO createSampleBO(final Session session)
     {
         return new SampleBO(getDaoFactory(), session, getRelationshipService(),
-                getEntityOperationChecker(), getManagedPropertyEvaluatorFactory());
+                getEntityOperationChecker(), getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
@@ -210,7 +215,7 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
     public ISearchDomainSearcher createSearchDomainSearcher(Session session)
     {
         return new SearchDomainSearcher(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
-                getDSSFactory());
+                dataSetTypeWithoutExperimentChecker, getDSSFactory());
     }
 
     @Override
@@ -225,44 +230,51 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
     public IExperimentTable createExperimentTable(final Session session)
     {
         return new ExperimentTable(getDaoFactory(), session, getRelationshipService(),
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IMaterialTable createMaterialTable(final Session session)
     {
-        return new MaterialTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new MaterialTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IExperimentBO createExperimentBO(final Session session)
     {
         return new ExperimentBO(getDaoFactory(), session, getRelationshipService(),
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IPropertyTypeTable createPropertyTypeTable(final Session session)
     {
-        return new PropertyTypeTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new PropertyTypeTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IPropertyTypeBO createPropertyTypeBO(final Session session)
     {
-        return new PropertyTypeBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new PropertyTypeBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IVocabularyBO createVocabularyBO(Session session)
     {
-        return new VocabularyBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new VocabularyBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public final IVocabularyTermBO createVocabularyTermBO(Session session)
     {
-        return new VocabularyTermBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new VocabularyTermBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
@@ -270,59 +282,68 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
             EntityKind entityKind)
     {
         return new EntityTypePropertyTypeBO(getDaoFactory(), session, entityKind,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IProjectBO createProjectBO(Session session)
     {
         return new ProjectBO(getDaoFactory(), session, getRelationshipService(),
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IEntityTypeBO createEntityTypeBO(Session session)
     {
-        return new EntityTypeBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new EntityTypeBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IMaterialBO createMaterialBO(Session session)
     {
-        return new MaterialBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new MaterialBO(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IAuthorizationGroupBO createAuthorizationGroupBO(Session session)
     {
         return new AuthorizationGroupBO(getDaoFactory(), session,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IGridCustomFilterOrColumnBO createGridCustomFilterBO(Session session)
     {
         return new GridCustomFilterBO(getDaoFactory(), session,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IGridCustomFilterOrColumnBO createGridCustomColumnBO(Session session)
     {
         return new GridCustomColumnBO(getDaoFactory(), session,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public ITrashBO createTrashBO(Session session)
     {
-        return new TrashBO(getDaoFactory(), this, session, getManagedPropertyEvaluatorFactory());
+        return new TrashBO(getDaoFactory(), this, session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
     public IDeletionTable createDeletionTable(Session session)
     {
-        return new DeletionTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory());
+        return new DeletionTable(getDaoFactory(), session, getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
@@ -330,7 +351,8 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
             IMasterDataScriptRegistrationRunner masterDataScriptRunner)
     {
         return new CorePluginTable(getDaoFactory(), session, masterDataScriptRunner,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
     @Override
@@ -344,7 +366,8 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac
     {
         return new MetaprojectBO(getDaoFactory(), createExperimentBO(session),
                 createSampleBO(session), createDataBO(session), createMaterialBO(session), session,
-                getManagedPropertyEvaluatorFactory());
+                getManagedPropertyEvaluatorFactory(), 
+                dataSetTypeWithoutExperimentChecker);
     }
 
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java
index d4b768b5e05..423ca746236 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java
@@ -31,6 +31,7 @@ import org.springframework.dao.DataAccessException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IDataStoreServiceFactory;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.EntityPropertiesConverter;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IAttachmentDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IAuthorizationGroupDAO;
@@ -79,6 +80,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Identifier;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment;
 import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE;
@@ -89,6 +91,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.RelationshipTypePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier;
@@ -111,28 +114,34 @@ abstract class AbstractBusinessObject implements IDAOFactory
 
     protected final IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory;
 
+    protected final DataSetTypeWithoutExperimentChecker dataSetTypeChecker;
+    
     protected Map<String, List<AttachmentPE>> attachmentHolderPermIdToAttachmentsMap;
 
     AbstractBusinessObject(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory,
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
         this(daoFactory, session, (IEntityPropertiesConverter) null,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     AbstractBusinessObject(final IDAOFactory daoFactory, final Session session,
             EntityKind entityKindOrNull,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory,
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
         this(daoFactory, session, entityKindOrNull == null ? null : new EntityPropertiesConverter(
                 entityKindOrNull, daoFactory, managedPropertyEvaluatorFactory),
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     AbstractBusinessObject(final IDAOFactory daoFactory, final Session session,
             IEntityPropertiesConverter converter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory,
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
+        this.dataSetTypeChecker = dataSetTypeChecker;
         assert daoFactory != null : "Given DAO factory can not be null.";
         assert session != null : "Given session can not be null.";
 
@@ -721,4 +730,27 @@ abstract class AbstractBusinessObject implements IDAOFactory
             }
         }
     }
+    
+    protected void checkSampleWithoutDatasets(IDataDAO dataDAO, SamplePE sample)
+    {
+        List<DataPE> dataSets = getDataDAO().listDataSets(sample);
+        for (DataPE dataSet : dataSets)
+        {
+        }
+        if (hasDatasets2(dataDAO, sample))
+        {
+            throw UserFailureException
+                    .fromTemplate(
+                            "Operation cannot be performed, because some datasets have been already produced for the sample '%s'.",
+                            sample.getSampleIdentifier());
+        }
+    }
+    
+    protected boolean hasDatasets2(IDataDAO dataDAO, SamplePE sample)
+    {
+        assert sample != null;
+
+        return dataDAO.hasDataSet(sample);
+    }
+
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java
index 4f2dbe501cc..9ce7234da73 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java
@@ -59,8 +59,6 @@ public abstract class AbstractDataSetBusinessObject extends AbstractSampleIdenti
 
     protected IRelationshipService relationshipService;
 
-    protected DataSetTypeWithoutExperimentChecker dataSetTypeChecker;
-    
     private IServiceConversationClientManagerLocal conversationClient;
 
     public AbstractDataSetBusinessObject(IDAOFactory daoFactory, Session session,
@@ -69,10 +67,9 @@ public abstract class AbstractDataSetBusinessObject extends AbstractSampleIdenti
             IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
             DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, EntityKind.DATA_SET, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, EntityKind.DATA_SET, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
         this.conversationClient = conversationClient;
-        this.dataSetTypeChecker = dataSetTypeChecker;
     }
 
     public AbstractDataSetBusinessObject(IDAOFactory daoFactory, Session session,
@@ -82,10 +79,9 @@ public abstract class AbstractDataSetBusinessObject extends AbstractSampleIdenti
             IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
             DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
         this.conversationClient = conversationClient;
-        this.dataSetTypeChecker = dataSetTypeChecker;
     }
 
     protected void enrichWithParentsAndExperiment(DataPE dataPE)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java
index 7b926f9a712..04a502f0703 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java
@@ -17,6 +17,7 @@
 package ch.systemsx.cisd.openbis.generic.server.business.bo;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -33,16 +34,19 @@ import ch.systemsx.cisd.openbis.generic.shared.managed_property.IManagedProperty
 public class AbstractMaterialBusinessObject extends AbstractBusinessObject
 {
     protected AbstractMaterialBusinessObject(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, EntityKind.MATERIAL, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, EntityKind.MATERIAL, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     protected AbstractMaterialBusinessObject(final IDAOFactory daoFactory, final Session session,
             final IEntityPropertiesConverter entityPropertiesConverter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, 
+                dataSetTypeChecker);
     }
 
     private static final String PROPERTY_TYPES = "materialType.materialTypePropertyTypesInternal";
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
index e36018ed286..5c3aebf7949 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
@@ -30,8 +30,8 @@ import java.util.Stack;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IEntityOperationChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwner;
-import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleUtils;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
@@ -81,9 +81,10 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
     AbstractSampleBusinessObject(final IDAOFactory daoFactory, final Session session,
             IRelationshipService relationshipService,
             IEntityOperationChecker entityOperationChecker,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, EntityKind.SAMPLE, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, EntityKind.SAMPLE, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
         this.entityOperationChecker = entityOperationChecker;
     }
@@ -92,9 +93,10 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
             final IEntityPropertiesConverter entityPropertiesConverter,
             IRelationshipService relationshipService,
             IEntityOperationChecker entityOperationChecker,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
         this.entityOperationChecker = entityOperationChecker;
     }
@@ -422,7 +424,6 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
     {
         String spaceCode = projectIdentifier.getSpaceCode();
         String projectCode = projectIdentifier.getProjectCode();
-        String databaseInstanceCode = projectIdentifier.getDatabaseInstanceCode();
         ProjectPE project =
                 getProjectDAO().tryFindProject(spaceCode, projectCode);
         if (project == null)
@@ -495,11 +496,11 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
         SampleGenericBusinessRules.assertValidComponents(sample);
     }
 
-    protected boolean hasDatasets(IDataDAO dataDAO, SamplePE sample)
+    private boolean hasDatasets(IDataDAO dataDAO, SamplePE sample)
     {
         // If we just added new data sets in this BO, they won't have data sets, so no need to
         // check.
-        return (onlyNewSamples == false) && SampleUtils.hasDatasets(dataDAO, sample);
+        return (onlyNewSamples == false) && hasDatasets2(dataDAO, sample);
     }
 
     protected boolean updateSpace(SamplePE sample, SampleIdentifier sampleOwnerIdentifier,
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java
index bd478d6a32d..c33fdb71e9d 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java
@@ -20,6 +20,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwner;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwnerFinder;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
@@ -46,17 +47,19 @@ abstract class AbstractSampleIdentifierBusinessObject extends AbstractBusinessOb
     private final SampleOwnerFinder sampleOwnerFinder;
 
     AbstractSampleIdentifierBusinessObject(final IDAOFactory daoFactory, final Session session,
-            EntityKind entityKind, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            EntityKind entityKind, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityKind, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityKind, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         sampleOwnerFinder = new SampleOwnerFinder(daoFactory, findPerson());
     }
 
     public AbstractSampleIdentifierBusinessObject(IDAOFactory daoFactory, Session session,
             IEntityPropertiesConverter converter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, converter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, converter, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         sampleOwnerFinder = new SampleOwnerFinder(daoFactory, findPerson());
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java
index e59b75e951b..01499d11aab 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java
@@ -22,6 +22,7 @@ import java.util.List;
 import org.springframework.dao.DataAccessException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment;
 import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE;
@@ -45,9 +46,10 @@ public final class AttachmentBO extends AbstractBusinessObject implements IAttac
     private boolean dataChanged;
 
     public AttachmentBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java
index b188f618678..26c4ba64dc7 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java
@@ -25,6 +25,7 @@ import org.springframework.dao.DataRetrievalFailureException;
 
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroupUpdates;
@@ -55,16 +56,18 @@ public class AuthorizationGroupBO extends AbstractBusinessObject implements IAut
     @Private
     AuthorizationGroupBO(IDAOFactory daoFactory, Session session,
             IAuthorizationGroupFactory factory,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.groupFactory = factory;
     }
 
     public AuthorizationGroupBO(IDAOFactory daoFactory, Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        this(daoFactory, session, new AuthorizationGroupFactory(), managedPropertyEvaluatorFactory);
+        this(daoFactory, session, new AuthorizationGroupFactory(), managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     interface IAuthorizationGroupFactory
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java
index e8fb744947b..33a08aa6719 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java
@@ -28,6 +28,7 @@ import ch.systemsx.cisd.common.logging.Log4jSimpleLogger;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.common.logging.LogLevel;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.coreplugin.AsCorePluginPaths;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl.IMasterDataScriptRegistrationRunner;
@@ -50,9 +51,10 @@ public final class CorePluginTable extends AbstractBusinessObject implements ICo
 
     public CorePluginTable(IDAOFactory daoFactory, Session session,
             IMasterDataScriptRegistrationRunner masterDataScriptRunner,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.masterDataScriptRunner = masterDataScriptRunner;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java
index 3e71dd1f2a2..923509011be 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDeletionDAO;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -42,9 +43,10 @@ public class DeletionTable extends AbstractBusinessObject implements IDeletionTa
     private List<Deletion> deletions;
 
     public DeletionTable(IDAOFactory daoFactory, Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java
index 2a7b24c3a5b..f7989811c36 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java
@@ -23,6 +23,7 @@ import java.util.regex.PatternSyntaxException;
 import org.springframework.dao.DataAccessException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType;
@@ -67,9 +68,10 @@ public final class EntityTypeBO extends AbstractBusinessObject implements IEntit
     private EntityKind entityKind;
 
     public EntityTypeBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     private ScriptPE getValidationScriptPE(EntityType entityType)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
index a9a260681b9..e8b46d20d6c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java
@@ -26,6 +26,7 @@ import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.EntityPropertiesConverter;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
@@ -63,17 +64,19 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements
     @Private
     EntityTypePropertyTypeBO(IDAOFactory daoFactory, Session session, EntityKind entityKind,
             IEntityPropertiesConverter converter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         propertiesConverter = converter;
         this.entityKind = entityKind;
     }
 
     public EntityTypePropertyTypeBO(IDAOFactory daoFactory, Session session, EntityKind entityKind,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         propertiesConverter =
                 new EntityPropertiesConverter(entityKind, daoFactory,
                         managedPropertyEvaluatorFactory);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java
index ed21dc02822..ccafafc89c1 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java
@@ -29,6 +29,7 @@ import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.collection.CollectionUtils;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleUtils;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
@@ -90,17 +91,19 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper
 
     public ExperimentBO(final IDAOFactory daoFactory, final Session session,
             IRelationshipService relationshipService,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
     }
 
     ExperimentBO(final IDAOFactory daoFactory, final Session session,
             final IEntityPropertiesConverter entityPropertiesConverter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @SuppressWarnings("unused")
@@ -514,7 +517,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper
     {
         for (SamplePE sample : samples)
         {
-            SampleUtils.checkSampleWithoutDatasets(getDataDAO(), sample);
+            checkSampleWithoutDatasets(getDataDAO(), sample);
 
             relationshipService.unassignSampleFromExperiment(session, sample);
         }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java
index 20f3c1c8911..1d88c349ac9 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java
@@ -30,6 +30,7 @@ import org.springframework.dao.DataAccessException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExperimentDAO;
@@ -71,16 +72,18 @@ public final class ExperimentTable extends AbstractBusinessObject implements IEx
 
     ExperimentTable(final IDAOFactory daoFactory, final Session session,
             IEntityPropertiesConverter converter,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, converter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, converter, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     public ExperimentTable(final IDAOFactory daoFactory, final Session session,
             IRelationshipService relationshipService,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java
index adca9deacdd..c991341463b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java
@@ -23,6 +23,7 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.dao.DataRetrievalFailureException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.ExpressionUtil;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -45,9 +46,10 @@ public class GridCustomColumnBO extends AbstractBusinessObject implements
     private GridCustomColumnPE column;
 
     public GridCustomColumnBO(IDAOFactory daoFactory, Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java
index e0f4f271c04..ee8c5ab9bfb 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java
@@ -20,6 +20,7 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.dao.DataRetrievalFailureException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IExpressionUpdates;
@@ -39,9 +40,10 @@ public class GridCustomFilterBO extends AbstractBusinessObject implements
     private GridCustomFilterPE filter;
 
     public GridCustomFilterBO(IDAOFactory daoFactory, Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java
index 50eb712633a..9be0d686f6c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java
@@ -23,6 +23,7 @@ import java.util.Set;
 import org.springframework.dao.DataAccessException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
@@ -56,9 +57,10 @@ public final class MaterialBO extends AbstractMaterialBusinessObject implements
     private boolean dataChanged;
 
     public MaterialBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java
index cff900e8527..7c1512ba497 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java
@@ -28,6 +28,7 @@ import org.springframework.dao.DataIntegrityViolationException;
 
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -57,18 +58,21 @@ public final class MaterialTable extends AbstractMaterialBusinessObject implemen
     private boolean dataChanged;
 
     public MaterialTable(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Private
     // for tests only
     MaterialTable(final IDAOFactory daoFactory, final Session session,
             final IEntityPropertiesConverter entityPropertiesConverter, List<MaterialPE> materials,
-            boolean dataChanged, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            boolean dataChanged, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, 
+                dataSetTypeChecker);
         this.materials = materials;
         this.dataChanged = dataChanged;
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java
index 6d76278f6c3..5c74ccd51d0 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java
@@ -27,6 +27,7 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.orm.ObjectRetrievalFailureException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.IFullTextIndexUpdateScheduler;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.IndexUpdateOperation;
@@ -81,9 +82,10 @@ public class MetaprojectBO extends AbstractBusinessObject implements IMetaprojec
 
     public MetaprojectBO(final IDAOFactory daoFactory, IExperimentBO experimentBO,
             ISampleBO sampleBO, IDataBO dataBO, IMaterialBO materialBO, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
 
         this.experimentBO = experimentBO;
         this.sampleBO = sampleBO;
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java
index ffb47dbe4dc..b8eaf3f7e0c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java
@@ -27,6 +27,7 @@ import org.springframework.orm.ObjectRetrievalFailureException;
 import ch.systemsx.cisd.common.collection.CollectionUtils;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDeletionDAO;
 import ch.systemsx.cisd.openbis.generic.server.util.SpaceIdentifierHelper;
@@ -78,9 +79,10 @@ public final class ProjectBO extends AbstractBusinessObject implements IProjectB
 
     public ProjectBO(final IDAOFactory daoFactory, final Session session,
             IRelationshipService relationshipService,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.relationshipService = relationshipService;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java
index 0f526a5dd45..ffcba298ef0 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java
@@ -28,6 +28,7 @@ import org.w3c.dom.Document;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.common.shared.basic.string.StringUtils;
 import ch.systemsx.cisd.common.xml.XMLInfraStructure;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.CodeConverter;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -61,9 +62,10 @@ public final class PropertyTypeBO extends VocabularyBO implements IPropertyTypeB
     private PropertyTypePE propertyTypePE;
 
     public PropertyTypeBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     //
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java
index 012d7784716..02e2c0720a4 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java
@@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo;
 
 import java.util.List;
 
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
@@ -34,9 +35,10 @@ public final class PropertyTypeTable extends AbstractBusinessObject implements I
     private List<PropertyTypePE> propertyTypes;
 
     public PropertyTypeTable(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTable.java
index 81a5a6434ea..4fb95f84254 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTable.java
@@ -23,6 +23,7 @@ import org.springframework.dao.DataIntegrityViolationException;
 
 import ch.systemsx.cisd.common.collection.TableMap;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.util.KeyExtractorFactory;
 import ch.systemsx.cisd.openbis.generic.server.util.SpaceIdentifierHelper;
@@ -52,9 +53,10 @@ public final class RoleAssignmentTable extends AbstractBusinessObject implements
     private TableMap<String, AuthorizationGroupPE> authorizationGroupsByCode;
 
     public RoleAssignmentTable(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     private final PersonPE getPerson(final String userId)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java
index 4acceba5b3b..7706876db03 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java
@@ -27,6 +27,7 @@ import org.springframework.dao.DataIntegrityViolationException;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IEntityOperationChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleUtils;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertiesConverter;
@@ -69,20 +70,22 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
     public SampleBO(final IDAOFactory daoFactory, final Session session,
             final IRelationshipService relationshipService,
             final IEntityOperationChecker entityOperationChecker,
-            final IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            final IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
         super(daoFactory, session, relationshipService, entityOperationChecker,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     SampleBO(final IDAOFactory daoFactory, final Session session,
             final IEntityPropertiesConverter entityPropertiesConverter,
             IRelationshipService relationshipService,
             final IEntityOperationChecker entityOperationChecker,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
         super(daoFactory, session, entityPropertiesConverter, relationshipService,
-                entityOperationChecker, managedPropertyEvaluatorFactory);
+                entityOperationChecker, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     //
@@ -234,9 +237,9 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
         assert sample != null : "Sample not loaded.";
 
         checkAvailable(sample);
-        checkSampleInGroup(sample);
+        checkSpaceSample(sample);
         checkSampleUnused(sample);
-        checkSampleWithoutDatasets();
+        checkSampleWithoutDatasets(getDataDAO(), sample);
 
         this.relationshipService.assignSampleToExperiment(session, sample, experiment);
         try
@@ -260,11 +263,6 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
         }
     }
 
-    private final void checkSampleWithoutDatasets()
-    {
-        SampleUtils.checkSampleWithoutDatasets(getDataDAO(), sample);
-    }
-
     private final static void checkSampleUnused(final SamplePE sample)
     {
         ExperimentPE experiment = sample.getExperiment();
@@ -277,7 +275,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
         }
     }
 
-    private final static void checkSampleInGroup(final SamplePE sample)
+    private final static void checkSpaceSample(final SamplePE sample)
     {
         if (sample.getSpace() == null)
         {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java
index a7121ffe29f..37bc0dd5f7b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java
@@ -30,6 +30,7 @@ import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.business.IEntityOperationChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.IRelationshipService;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwner;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -75,10 +76,11 @@ public final class SampleTable extends AbstractSampleBusinessObject implements I
     public SampleTable(final IDAOFactory daoFactory, final Session session,
             IRelationshipService relationshipService,
             IEntityOperationChecker entityOperationChecker,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
         super(daoFactory, session, relationshipService, entityOperationChecker,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java
index cb92bf0c406..f43d831621e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java
@@ -22,6 +22,7 @@ import org.springframework.dao.DataRetrievalFailureException;
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.common.jython.evaluator.EvaluatorException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IScriptDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.dynamic_property.calculator.JythonDynamicPropertyCalculator;
@@ -53,19 +54,22 @@ public final class ScriptBO extends AbstractBusinessObject implements IScriptBO
     private final IJythonEvaluatorPool jythonEvaluatorPool;
 
     public ScriptBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory,
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker,
             IJythonEvaluatorPool jythonEvaluationPool)
     {
-        this(daoFactory, session, new ScriptFactory(), managedPropertyEvaluatorFactory, jythonEvaluationPool);
+        this(daoFactory, session, new ScriptFactory(), managedPropertyEvaluatorFactory, dataSetTypeChecker,
+                jythonEvaluationPool);
     }
 
     @Private
     // for testing
     ScriptBO(final IDAOFactory daoFactory, final Session session, IScriptFactory scriptFactory,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory,
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker,
             IJythonEvaluatorPool jythonEvaluationPool)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.scriptFactory = scriptFactory;
         this.jythonEvaluatorPool = jythonEvaluationPool;
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java
index 657bf27963a..c65fdeada09 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java
@@ -28,6 +28,7 @@ import java.util.Set;
 import ch.systemsx.cisd.common.collection.IKeyExtractor;
 import ch.systemsx.cisd.common.collection.TableMap;
 import ch.systemsx.cisd.openbis.generic.server.business.IDataStoreServiceFactory;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.IDataStoreService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.AbstractEntitySearchResultLocation;
@@ -71,9 +72,10 @@ public class SearchDomainSearcher extends AbstractBusinessObject implements ISea
     private final IDataStoreServiceFactory dssFactory;
 
     public SearchDomainSearcher(IDAOFactory daoFactory, Session session, 
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, IDataStoreServiceFactory dssFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IDataStoreServiceFactory dssFactory)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.dssFactory = dssFactory;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBO.java
index 889d42a1246..6b6d3a4d4c2 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBO.java
@@ -22,6 +22,7 @@ import org.springframework.dao.DataAccessException;
 import org.springframework.dao.DataRetrievalFailureException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.util.SpaceIdentifierHelper;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -48,9 +49,10 @@ public final class SpaceBO extends AbstractBusinessObject implements ISpaceBO
     private SpacePE space;
 
     public SpaceBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     //
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java
index 1c715104319..69472ee23b8 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java
@@ -32,6 +32,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.openbis.generic.server.batch.BatchOperationExecutor;
 import ch.systemsx.cisd.openbis.generic.server.batch.IBatchOperation;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetUtils;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDeletionDAO;
@@ -61,9 +62,10 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO
     private DeletionPE deletion;
 
     public TrashBO(IDAOFactory daoFactory, ICommonBusinessObjectFactory boFactory, Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         this.boFactory = boFactory;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java
index 5dce68f7d96..8aeb93dd53c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java
@@ -35,6 +35,7 @@ import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.collection.IKeyExtractor;
 import ch.systemsx.cisd.common.collection.TableMap;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertyTypeDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.util.KeyExtractorFactory;
@@ -81,17 +82,19 @@ public class VocabularyBO extends AbstractBusinessObject implements IVocabularyB
     private boolean allowChangingInternallyManaged = false;
 
     public VocabularyBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     // For tests only
     @Private
     VocabularyBO(final IDAOFactory daoFactory, final Session session, VocabularyPE vocabulary,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
         vocabularyPE = vocabulary;
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java
index 0ddd7313a43..519278f6dfb 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java
@@ -21,6 +21,7 @@ import java.util.List;
 import org.springframework.dao.DataRetrievalFailureException;
 
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
+import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetTypeWithoutExperimentChecker;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IVocabularyTermUpdates;
@@ -39,9 +40,10 @@ public final class VocabularyTermBO extends AbstractBusinessObject implements IV
     private VocabularyTermPE vocabularyTermPE;
 
     public VocabularyTermBO(final IDAOFactory daoFactory, final Session session,
-            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory)
+            IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, 
+            DataSetTypeWithoutExperimentChecker dataSetTypeChecker)
     {
-        super(daoFactory, session, managedPropertyEvaluatorFactory);
+        super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker);
     }
 
     //
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/SampleUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/SampleUtils.java
index 402ef5e185e..768247cc846 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/SampleUtils.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/SampleUtils.java
@@ -16,8 +16,6 @@
 
 package ch.systemsx.cisd.openbis.generic.server.business.bo.util;
 
-import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
@@ -27,24 +25,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
  */
 public class SampleUtils
 {
-    public static final void checkSampleWithoutDatasets(IDataDAO dataDAO, SamplePE sample)
-    {
-        if (hasDatasets(dataDAO, sample))
-        {
-            throw UserFailureException
-                    .fromTemplate(
-                            "Operation cannot be performed, because some datasets have been already produced for the sample '%s'.",
-                            sample.getSampleIdentifier());
-        }
-    }
-
-    public static boolean hasDatasets(IDataDAO dataDAO, SamplePE sample)
-    {
-        assert sample != null;
-
-        return dataDAO.hasDataSet(sample);
-    }
-
     /** for all experiment samples which belonged to a space the specified space will be set */
     public static void setSamplesSpace(ExperimentPE experiment, SpacePE space)
     {
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBOTest.java
index 7220aa6fba8..363a9668c3f 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBOTest.java
@@ -49,7 +49,7 @@ public final class AuthorizationGroupBOTest extends AbstractBOTest
     private final AuthorizationGroupBO createBO()
     {
         return new AuthorizationGroupBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, groupFactory,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     @Test(expectedExceptions = AssertionError.class)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTableTest.java
index 59bab0f2fb1..f1603417ddf 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTableTest.java
@@ -62,7 +62,7 @@ public class CorePluginTableTest extends AbstractBOTest
         pluginResourceLoader = context.mock(ICorePluginResourceLoader.class);
         pluginTable =
                 new CorePluginTable(daoFactory, EXAMPLE_SESSION, scriptRunner,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
         createdPluginsMatcher = new RecordingMatcher<List<CorePluginPE>>();
     }
 
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBOTest.java
index 369d894fc41..5c7852d9334 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBOTest.java
@@ -40,7 +40,7 @@ public class EntityTypeBOTest extends AbstractBOTest
     {
         final String sampleTypeCode = "SAMPLE_TYPE";
         final IEntityTypeBO entityTypeBO =
-                new EntityTypeBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory);
+                new EntityTypeBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory, null);
         final EntityKind entityKind = EntityKind.SAMPLE;
         final SampleTypePE sampleType =
                 new SampleTypePEBuilder().id(1).code(sampleTypeCode).getSampleType();
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java
index bff6b413a1e..0b94495e045 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java
@@ -233,7 +233,7 @@ public final class EntityTypePropertyTypeBOTest extends AbstractBOTest
     private final EntityTypePropertyTypeBO createEntityTypePropertyTypeBO(EntityKind entityKind)
     {
         return new EntityTypePropertyTypeBO(daoFactory, EXAMPLE_SESSION, entityKind,
-                propertiesConverter, managedPropertyEvaluatorFactory);
+                propertiesConverter, managedPropertyEvaluatorFactory, null);
     }
 
 }
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java
index 07ca99fa8dc..e81e36b1be7 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java
@@ -93,7 +93,7 @@ public final class ExperimentBOTest extends AbstractBOTest
     private final ExperimentBO createExperimentBO()
     {
         return new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, relationshipService,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     @BeforeMethod
@@ -452,7 +452,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareLoadExperimentByIdentifier(identifier, exp);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
         bo.loadByExperimentIdentifier(identifier);
 
         ExperimentPE experiment = bo.getExperiment();
@@ -489,7 +489,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, null);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -516,7 +516,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, null);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -544,7 +544,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, newConvertedProperties);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -572,7 +572,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, newConvertedProperties);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -601,7 +601,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, newConvertedProperties);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -626,7 +626,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, newConvertedProperties);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
@@ -651,7 +651,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         prepareEntity(existingProperties, newConvertedProperties);
         ExperimentBO bo =
                 new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
 
         bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder,
                 entityAsModifiableBean);
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTableTest.java
index fbf076b40dd..be6462ec72f 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTableTest.java
@@ -45,7 +45,7 @@ public final class ExperimentTableTest extends AbstractBOTest
     private final ExperimentTable createExperimentTable()
     {
         return new ExperimentTable(daoFactory, ManagerTestTool.EXAMPLE_SESSION,
-                propertiesConverter, managedPropertyEvaluatorFactory);
+                propertiesConverter, managedPropertyEvaluatorFactory, null);
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBOTest.java
index 5b804826b67..7ddaa7e2e57 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBOTest.java
@@ -99,7 +99,7 @@ public class GridCustomFilterBOTest extends AbstractBOTest
 
     private final IGridCustomFilterOrColumnBO createFilterBO()
     {
-        return new GridCustomFilterBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory);
+        return new GridCustomFilterBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory, null);
     }
 
 }
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTableTest.java
index 131787e4ec8..dbbbdf4373b 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTableTest.java
@@ -47,7 +47,7 @@ public final class MaterialTableTest extends AbstractBOTest
     private final MaterialTable createMaterialTable(List<MaterialPE> materials, boolean dataChanged)
     {
         return new MaterialTable(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter,
-                materials, dataChanged, managedPropertyEvaluatorFactory);
+                materials, dataChanged, managedPropertyEvaluatorFactory, null);
     }
 
     private final MaterialTable createMaterialTable()
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
index 62db710df01..dea4a1aeaa9 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBOTest.java
@@ -55,7 +55,7 @@ public final class ProjectBOTest extends AbstractBOTest
     private final ProjectBO createProjectBO()
     {
         return new ProjectBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, relationshipService,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBOTest.java
index e2714551e21..4434109269c 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBOTest.java
@@ -54,7 +54,7 @@ public final class PropertyTypeBOTest extends AbstractBOTest
     private final PropertyTypeBO createPropertyTypeBO()
     {
         return new PropertyTypeBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     static final PropertyType createPropertyType(final DataTypeCode dataTypeCode)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTableTest.java
index a7174bde770..c9f974c95bd 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RoleAssignmentTableTest.java
@@ -40,7 +40,7 @@ public final class RoleAssignmentTableTest extends AbstractBOTest
     private final RoleAssignmentTable createRoleAssignmentTable()
     {
         return new RoleAssignmentTable(daoFactory, ManagerTestTool.EXAMPLE_SESSION,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java
index 76ffacea058..c8404f764e6 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java
@@ -997,7 +997,7 @@ public final class SampleBOTest extends AbstractBOTest
     private final SampleBO createSampleBO()
     {
         return new SampleBO(daoFactory, EXAMPLE_SESSION, propertiesConverter, relationshipService,
-                entityOperationChecker, managedPropertyEvaluatorFactory);
+                entityOperationChecker, managedPropertyEvaluatorFactory, null);
     }
 
     private SampleType createSampleType(final String sampleTypeCode)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTableTest.java
index deff7e8817b..882e395d756 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTableTest.java
@@ -86,7 +86,7 @@ public final class SampleTableTest extends AbstractBOTest
     private final SampleTable createSampleTableBO()
     {
         return new SampleTable(daoFactory, EXAMPLE_SESSION, null, entityOperationChecker,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     private final static SampleIdentifier getSharedSampleIdentifier(final String code)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBOTest.java
index db6bcdcaac6..c1ec76f3188 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBOTest.java
@@ -75,7 +75,7 @@ public final class ScriptBOTest extends AbstractBOTest
     private final ScriptBO createScriptBO()
     {
         return new ScriptBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, scriptFactory,
-                managedPropertyEvaluatorFactory, new TestJythonEvaluatorPool());
+                managedPropertyEvaluatorFactory, null, new TestJythonEvaluatorPool());
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java
index 83efa094ea2..f66cfe8c109 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java
@@ -390,7 +390,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest
     private SearchDomainSearcher createSearcher()
     {
         return new SearchDomainSearcher(daoFactory, ManagerTestTool.EXAMPLE_SESSION,
-                managedPropertyEvaluatorFactory, dssFactory);
+                managedPropertyEvaluatorFactory, null, dssFactory);
     }
 
     protected List<String> getPermIds(final IPermIdHolder... permIdHolders)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBOTest.java
index a1e33bfc791..f873d292f6a 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SpaceBOTest.java
@@ -32,7 +32,7 @@ public final class SpaceBOTest extends AbstractBOTest
     private final SpaceBO createSpaceBO()
     {
         return new SpaceBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java
index 2bc326bd78b..ff41f7ec137 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java
@@ -94,7 +94,7 @@ public final class TrashBOTest extends AbstractBOTest
         dataSetTable = context.mock(IDataSetTable.class);
         trashBO =
                 new TrashBO(daoFactory, boFactory, ManagerTestTool.EXAMPLE_SESSION,
-                        managedPropertyEvaluatorFactory);
+                        managedPropertyEvaluatorFactory, null);
         context.checking(new Expectations()
             {
                 {
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBOTest.java
index 065b7e04b0e..dbb890920bb 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBOTest.java
@@ -78,13 +78,13 @@ public final class VocabularyBOTest extends AbstractBOTest
 
     private final VocabularyBO createVocabularyBO()
     {
-        return new VocabularyBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory);
+        return new VocabularyBO(daoFactory, EXAMPLE_SESSION, managedPropertyEvaluatorFactory, null);
     }
 
     private final VocabularyBO createVocabularyBO(VocabularyPE vocabulary)
     {
         return new VocabularyBO(daoFactory, EXAMPLE_SESSION, vocabulary,
-                managedPropertyEvaluatorFactory);
+                managedPropertyEvaluatorFactory, null);
     }
 
     static final NewVocabulary createVocabulary()
-- 
GitLab