From 478398e7878f08652fbf14015e8479f89f1cda4b Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Mon, 16 May 2011 13:13:35 +0000
Subject: [PATCH] [LMS-2104] use IDataDAO in a few places & marked
 IExternalDataDAO as deprecated

SVN: 21319
---
 .../openbis/generic/server/CommonServer.java  | 16 +++++------
 .../business/bo/AbstractBusinessObject.java   |  1 +
 .../bo/AbstractSampleBusinessObject.java      | 16 +++++------
 .../server/business/bo/ExperimentBO.java      |  4 +--
 .../server/business/bo/ExternalDataBO.java    |  1 +
 .../server/business/bo/ExternalDataTable.java |  2 ++
 .../generic/server/business/bo/SampleBO.java  |  4 +--
 .../server/business/bo/SampleTable.java       | 10 ++++---
 .../server/business/bo/util/SampleUtils.java  | 13 +++++----
 .../generic/server/dataaccess/IDataDAO.java   | 10 -------
 .../server/dataaccess/IExternalDataDAO.java   | 22 ++-------------
 .../generic/server/dataaccess/db/DataDAO.java |  3 +--
 .../server/dataaccess/db/ExternalDataDAO.java |  1 +
 .../result_filter/DataSetGroupLoader.java     | 12 ++++-----
 .../result_filter/GroupLoaderFactory.java     |  2 +-
 .../server/business/bo/ExperimentBOTest.java  |  4 +--
 .../business/bo/ExternalDataBOTest.java       |  1 +
 .../business/bo/ExternalDataTableTest.java    | 27 ++++++++++++-------
 .../server/business/bo/SampleBOTest.java      | 16 +++++------
 .../dataaccess/db/ExternalDataDAOTest.java    |  3 ++-
 .../dataaccess/db/SqlUnitMigrationTest.java   |  9 -------
 .../dataaccess/db/scalability/DBCreator.java  |  8 +++---
 .../result_filter/DataSetGroupLoaderTest.java |  8 +++---
 .../result_filter/GroupLoaderFactoryTest.java |  2 +-
 24 files changed, 86 insertions(+), 109 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
index 9f2a597ff19..d3097fd6f58 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java
@@ -72,9 +72,9 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.dynamic_property.calc
 import ch.systemsx.cisd.openbis.generic.server.business.bo.materiallister.IMaterialLister;
 import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister;
 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.IDataStoreDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO;
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IFileFormatTypeDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IHibernateSearchDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IRoleAssignmentDAO;
@@ -208,7 +208,6 @@ import ch.systemsx.cisd.openbis.generic.shared.translator.DataStoreServiceTransl
 import ch.systemsx.cisd.openbis.generic.shared.translator.DataTypeTranslator;
 import ch.systemsx.cisd.openbis.generic.shared.translator.DtoConverters;
 import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator;
-import ch.systemsx.cisd.openbis.generic.shared.translator.ExternalDataTranslator;
 import ch.systemsx.cisd.openbis.generic.shared.translator.GridCustomExpressionTranslator.GridCustomFilterTranslator;
 import ch.systemsx.cisd.openbis.generic.shared.translator.GroupTranslator;
 import ch.systemsx.cisd.openbis.generic.shared.translator.MaterialTypeTranslator;
@@ -913,13 +912,13 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt
         final Session session = getSession(sessionToken);
         try
         {
-            final Set<ExternalDataPE> resultSet = new LinkedHashSet<ExternalDataPE>();
+            final Set<DataPE> resultSet = new LinkedHashSet<DataPE>();
             // TODO 2009-08-17, Piotr Buczek: [LMS-1149] optimize performance
             addRelatedDataSets(resultSet, relatedEntities.getEntities());
             final List<ExternalData> list = new ArrayList<ExternalData>(resultSet.size());
-            for (final ExternalDataPE hit : resultSet)
+            for (final DataPE hit : resultSet)
             {
-                list.add(ExternalDataTranslator.translate(hit, session.getBaseIndexURL(), false));
+                list.add(DataSetTranslator.translate(hit, session.getBaseIndexURL(), false));
             }
             return list;
         } catch (final DataAccessException ex)
@@ -928,16 +927,15 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt
         }
     }
 
-    private void addRelatedDataSets(final Set<ExternalDataPE> resultSet,
+    private void addRelatedDataSets(final Set<DataPE> resultSet,
             final List<? extends IEntityInformationHolder> relatedEntities)
     {
-        final IExternalDataDAO externalDataDAO = getDAOFactory().getExternalDataDAO();
+        final IDataDAO dataDAO = getDAOFactory().getDataDAO();
         for (IEntityInformationHolder entity : relatedEntities)
         {
             if (isEntityKindRelatedWithDataSets(entity.getEntityKind()))
             {
-                List<ExternalDataPE> relatedDataSets =
-                        externalDataDAO.listRelatedExternalData(entity);
+                List<DataPE> relatedDataSets = dataDAO.listRelatedDataSets(entity);
                 resultSet.addAll(relatedDataSets);
             }
         }
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 b24852f3c9c..30875851f56 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
@@ -209,6 +209,7 @@ abstract class AbstractBusinessObject implements IDAOFactory
         return daoFactory.getDataDAO();
     }
 
+    @Deprecated
     public final IExternalDataDAO getExternalDataDAO()
     {
         return daoFactory.getExternalDataDAO();
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 8e65530dfeb..a8a7edfbbcc 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
@@ -29,7 +29,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException;
 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.IExternalDataDAO;
+import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleDAO;
 import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -347,11 +347,11 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
         return project;
     }
 
-    protected void checkAllBusinessRules(SamplePE sample, IExternalDataDAO externalDataDAO,
+    protected void checkAllBusinessRules(SamplePE sample, IDataDAO dataDAO,
             Map<EntityTypePE, List<EntityTypePropertyTypePE>> cacheOrNull)
     {
         checkPropertiesBusinessRules(sample, cacheOrNull);
-        checkExperimentBusinessRules(externalDataDAO, sample);
+        checkExperimentBusinessRules(dataDAO, sample);
         checkParentBusinessRules(sample);
         checkContainerBusinessRules(sample);
     }
@@ -370,9 +370,9 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
         }
     }
 
-    protected void checkExperimentBusinessRules(IExternalDataDAO externalDataDAO, SamplePE sample)
+    protected void checkExperimentBusinessRules(IDataDAO dataDAO, SamplePE sample)
     {
-        final boolean hasDatasets = hasDatasets(externalDataDAO, sample);
+        final boolean hasDatasets = hasDatasets(dataDAO, sample);
         if (hasDatasets && sample.getExperiment() == null)
         {
             throw UserFailureException.fromTemplate(
@@ -407,11 +407,11 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
         SampleGenericBusinessRules.assertValidComponents(sample);
     }
 
-    protected boolean hasDatasets(IExternalDataDAO externalDataDAO, SamplePE sample)
+    protected 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(externalDataDAO, sample);
+        return (onlyNewSamples == false) && SampleUtils.hasDatasets(dataDAO, sample);
     }
 
     protected void updateSpace(SamplePE sample, SampleIdentifier sampleOwnerIdentifier,
@@ -441,7 +441,7 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
 
     private void removeFromExperiment(SamplePE sample)
     {
-        if (hasDatasets(getExternalDataDAO(), sample))
+        if (hasDatasets(getDataDAO(), sample))
         {
             throw UserFailureException.fromTemplate(
                     "Cannot detach the sample '%s' from the experiment "
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 cd16c283ad9..a57e8a46a48 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
@@ -231,7 +231,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper
     {
         if (experiment.getDataSets().size() > 0)
         {
-            getExternalDataDAO().listExternalData(experiment);
+            getDataDAO().listDataSets(experiment);
             boolean onlyPlaceholders = true;
             for (DataPE data : experiment.getDataSets())
             {
@@ -468,7 +468,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper
     {
         for (SamplePE sample : samples)
         {
-            SampleUtils.checkSampleWithoutDatasets(getExternalDataDAO(), sample);
+            SampleUtils.checkSampleWithoutDatasets(getDataDAO(), sample);
             experiment.removeSample(sample);
         }
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java
index 768297549e5..0919865b01b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBO.java
@@ -65,6 +65,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
 /**
  * @author Franz-Josef Elmer
  */
+@SuppressWarnings("deprecation")
 @Friend(toClasses = DataPE.class)
 public class ExternalDataBO extends AbstractExternalDataBusinessObject implements IExternalDataBO
 {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTable.java
index e54fa46de24..f4baad2db7b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTable.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTable.java
@@ -80,6 +80,8 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
  * 
  * @author Christian Ribeaud
  */
+@SuppressWarnings("deprecation")
+// FIXME
 public final class ExternalDataTable extends AbstractExternalDataBusinessObject implements
         IExternalDataTable
 {
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 aedbe2b3144..55237d38a31 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
@@ -188,7 +188,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
             }
             attachments.clear();
         }
-        checkAllBusinessRules(sample, getExternalDataDAO(), null);
+        checkAllBusinessRules(sample, getDataDAO(), null);
         onlyNewSamples = false;
     }
 
@@ -223,7 +223,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam
 
     private final void checkSampleWithoutDatasets()
     {
-        SampleUtils.checkSampleWithoutDatasets(getExternalDataDAO(), sample);
+        SampleUtils.checkSampleWithoutDatasets(getDataDAO(), sample);
     }
 
     private final static void checkSampleUnused(final SamplePE sample)
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 39e20641d69..42c245bbe3f 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
@@ -221,7 +221,7 @@ public final class SampleTable extends AbstractSampleBusinessObject implements I
                 new HashMap<EntityTypePE, List<EntityTypePropertyTypePE>>();
         for (SamplePE s : samples)
         {
-            checkAllBusinessRules(s, getExternalDataDAO(), cache);
+            checkAllBusinessRules(s, getDataDAO(), cache);
         }
     }
 
@@ -245,7 +245,7 @@ public final class SampleTable extends AbstractSampleBusinessObject implements I
         {
             updateSpace(sample, updates.getSampleIdentifier(), sampleOwnerCache);
             updateExperiment(sample, updates.getExperimentIdentifierOrNull(), experimentCache);
-            checkExperimentBusinessRules(getExternalDataDAO(), sample);
+            checkExperimentBusinessRules(getDataDAO(), sample);
         }
         if (details.isParentsUpdateRequested())
         {
@@ -293,14 +293,16 @@ public final class SampleTable extends AbstractSampleBusinessObject implements I
         final Map<EntityTypePE, List<EntityTypePropertyTypePE>> propertiesCache =
                 new HashMap<EntityTypePE, List<EntityTypePropertyTypePE>>();
         samples = loadSamples(updates, sampleOwnerCache);
-        Map<SampleIdentifier, SamplePE> samplesByIdentifiers = new HashMap<SampleIdentifier, SamplePE>();
+        Map<SampleIdentifier, SamplePE> samplesByIdentifiers =
+                new HashMap<SampleIdentifier, SamplePE>();
         for (SamplePE sample : samples)
         {
             samplesByIdentifiers.put(sample.getSampleIdentifier(), sample);
         }
         for (SampleBatchUpdatesDTO sampleUpdates : updates)
         {
-            final SamplePE sample = samplesByIdentifiers.get(sampleUpdates.getOldSampleIdentifierOrNull());
+            final SamplePE sample =
+                    samplesByIdentifiers.get(sampleUpdates.getOldSampleIdentifierOrNull());
             prepareBatchUpdate(sample, sampleUpdates, sampleOwnerCache, experimentCache,
                     propertiesCache);
         }
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 e371dbf7e6d..24a6c291c4f 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
@@ -17,20 +17,19 @@
 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.IExternalDataDAO;
+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.SpacePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 
 /**
  * @author Tomasz Pylak
  */
 public class SampleUtils
 {
-    public static final void checkSampleWithoutDatasets(IExternalDataDAO externalDataDAO,
-            SamplePE sample)
+    public static final void checkSampleWithoutDatasets(IDataDAO dataDAO, SamplePE sample)
     {
-        if (hasDatasets(externalDataDAO, sample))
+        if (hasDatasets(dataDAO, sample))
         {
             throw UserFailureException
                     .fromTemplate(
@@ -39,11 +38,11 @@ public class SampleUtils
         }
     }
 
-    public static boolean hasDatasets(IExternalDataDAO externalDataDAO, SamplePE sample)
+    public static boolean hasDatasets(IDataDAO dataDAO, SamplePE sample)
     {
         assert sample != null;
 
-        return externalDataDAO.hasExternalData(sample); 
+        return dataDAO.hasDataSet(sample);
     }
 
     /** for all experiment samples which belonged to a group the specified group will be set */
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataDAO.java
index d44effed62e..36621269586 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataDAO.java
@@ -58,16 +58,6 @@ public interface IDataDAO extends IGenericDAO<DataPE>
      */
     public List<DataPE> listDataSets(final SamplePE sample) throws DataAccessException;
 
-    // /**
-    // * List the all {@link ExternalDataPE} for given {@link DataSetArchivingStatus}.
-    // *
-    // * @param maxResultSize the maximum size of the returned list. Specifying a negative number
-    // * (e.g. -1) is equal to no limitation.
-    // * @returns list of {@link ExternalDataPE}s with the specified status.
-    // */
-    // public List<ExternalDataPE> listByArchivingStatus(DataSetArchivingStatus status,
-    // int maxResultSize);
-
     /**
      * List the {@link DataPE} for given <var>experiment</var>.
      * 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IExternalDataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IExternalDataDAO.java
index 921112fe768..35f9b3dd03b 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IExternalDataDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IExternalDataDAO.java
@@ -22,7 +22,6 @@ import java.util.Set;
 
 import org.springframework.dao.DataAccessException;
 
-import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE;
@@ -34,8 +33,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
 /**
  * An interface that contains all data access operations on {@link ExternalDataPE}s.
  * 
+ * @deprecated use {@link IDataDAO}
  * @author Christian Ribeaud
  */
+@Deprecated
 public interface IExternalDataDAO extends IGenericDAO<ExternalDataPE>
 {
     /**
@@ -45,15 +46,6 @@ public interface IExternalDataDAO extends IGenericDAO<ExternalDataPE>
      */
     public boolean hasExternalData(final SamplePE sample) throws DataAccessException;
 
-    /**
-     * List the {@link ExternalDataPE} related to given <var>entity</var>.
-     * 
-     * @returns list of {@link ExternalDataPE}s that are related to given
-     *          {@link IEntityInformationHolder}.
-     */
-    public List<ExternalDataPE> listRelatedExternalData(final IEntityInformationHolder entity)
-            throws DataAccessException;
-
     /**
      * List the {@link ExternalDataPE} for given <var>sample</var>.
      * 
@@ -61,16 +53,6 @@ public interface IExternalDataDAO extends IGenericDAO<ExternalDataPE>
      */
     public List<ExternalDataPE> listExternalData(final SamplePE sample) throws DataAccessException;
 
-    // /**
-    // * List the all {@link ExternalDataPE} for given {@link DataSetArchivingStatus}.
-    // *
-    // * @param maxResultSize the maximum size of the returned list. Specifying a negative number
-    // * (e.g. -1) is equal to no limitation.
-    // * @returns list of {@link ExternalDataPE}s with the specified status.
-    // */
-    // public List<ExternalDataPE> listByArchivingStatus(DataSetArchivingStatus status,
-    // int maxResultSize);
-
     /**
      * List the {@link ExternalDataPE} for given <var>experiment</var>.
      * 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
index fbe83c0fc55..95c57e9a6e4 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
@@ -44,7 +44,6 @@ import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.common.utilities.MethodUtils;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources;
 import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder;
 import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
@@ -60,7 +59,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames;
 import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
 
 /**
- * Implementation of {@link IExternalDataDAO} for databases.
+ * Implementation of {@link IDataDAO} for databases.
  * 
  * @author Christian Ribeaud
  */
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAO.java
index 9255dadd949..02b12b38d57 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAO.java
@@ -63,6 +63,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils;
  * 
  * @author Christian Ribeaud
  */
+@SuppressWarnings("deprecation")
 final class ExternalDataDAO extends AbstractGenericEntityWithPropertiesDAO<ExternalDataPE>
         implements IExternalDataDAO
 {
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoader.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoader.java
index fa86ddaa30f..776700cb48e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoader.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoader.java
@@ -21,8 +21,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO;
-import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE;
+import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
+import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 
 /**
@@ -33,9 +33,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 class DataSetGroupLoader implements IGroupLoader
 {
 
-    private final IExternalDataDAO dao;
+    private final IDataDAO dao;
 
-    public DataSetGroupLoader(IExternalDataDAO dao)
+    public DataSetGroupLoader(IDataDAO dao)
     {
         this.dao = dao;
     }
@@ -43,8 +43,8 @@ class DataSetGroupLoader implements IGroupLoader
     public Map<String, SpacePE> loadGroups(Set<String> keys)
     {
         Map<String, SpacePE> map = new HashMap<String, SpacePE>();
-        List<ExternalDataPE> data = dao.listByCode(keys);
-        for (ExternalDataPE d : data)
+        List<DataPE> data = dao.listByCode(keys);
+        for (DataPE d : data)
         {
             map.put(d.getCode(), d.getExperiment().getProject().getSpace());
         }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactory.java
index d07eda0c263..c8c935cf39a 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactory.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactory.java
@@ -42,7 +42,7 @@ class GroupLoaderFactory implements IGroupLoaderFactory
             case SAMPLE:
                 return new SampleGroupLoader(factory.getSampleDAO());
             case DATA_SET:
-                return new DataSetGroupLoader(factory.getExternalDataDAO());
+                return new DataSetGroupLoader(factory.getDataDAO());
             case MATERIAL:
                 throw new UnsupportedOperationException();
         }
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 1578ac12e0d..e573125127f 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
@@ -504,7 +504,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         context.checking(new Expectations()
             {
                 {
-                    allowing(externalDataDAO).hasExternalData((with(any(SamplePE.class))));
+                    allowing(dataDAO).hasDataSet((with(any(SamplePE.class))));
                     will(returnValue(false));
                 }
             });
@@ -582,7 +582,7 @@ public final class ExperimentBOTest extends AbstractBOTest
         context.checking(new Expectations()
             {
                 {
-                    allowing(externalDataDAO).hasExternalData(with(assignedSample));
+                    allowing(dataDAO).hasDataSet(with(assignedSample));
                     will(returnValue(true));
                 }
             });
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java
index 258862dfd94..a0bbd96621a 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataBOTest.java
@@ -72,6 +72,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.types.DataSetTypeCode;
  * @author Franz-Josef Elmer
  */
 // TODO 2009-09-10, Piotr Buczek: write tests with many parents and cycle check
+@SuppressWarnings("deprecation")
 public class ExternalDataBOTest extends AbstractBOTest
 {
     private static final int SPEED_HINT = (Constants.DEFAULT_SPEED_HINT + Constants.MAX_SPEED) / 2;
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTableTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTableTest.java
index cea27e1e036..cc62493e8e2 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTableTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExternalDataTableTest.java
@@ -68,6 +68,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier;
  * @author Christian Ribeaud
  */
 @Friend(toClasses = ExternalDataTable.class)
+// FIXME
+@SuppressWarnings("deprecation")
 public final class ExternalDataTableTest extends AbstractBOTest
 {
     private IDataStoreServiceFactory dssFactory;
@@ -308,8 +310,10 @@ public final class ExternalDataTableTest extends AbstractBOTest
                     prepareFindFullDatasets(new ExternalDataPE[]
                         { d1, d2 }, false, false);
 
-                    BaseMatcher<List<DatasetDescription>> dataSets = createDatasetDescriptionsMatcher(d2);
-                    one(dataStoreService2).getKnownDataSets(with(dss2.getSessionToken()), with(dataSets));
+                    BaseMatcher<List<DatasetDescription>> dataSets =
+                            createDatasetDescriptionsMatcher(d2);
+                    one(dataStoreService2).getKnownDataSets(with(dss2.getSessionToken()),
+                            with(dataSets));
                     will(returnValue(Arrays.asList(d2.getLocation())));
 
                     PersonPE person = EXAMPLE_SESSION.tryGetPerson();
@@ -318,7 +322,8 @@ public final class ExternalDataTableTest extends AbstractBOTest
                     one(eventDAO).persist(createDeletionEvent(d2, person, reason));
                     one(externalDataDAO).delete(d2);
 
-                    one(dataStoreService2).deleteDataSets(with(dss2.getSessionToken()), with(dataSets));
+                    one(dataStoreService2).deleteDataSets(with(dss2.getSessionToken()),
+                            with(dataSets));
                 }
             });
 
@@ -356,7 +361,8 @@ public final class ExternalDataTableTest extends AbstractBOTest
                     will(returnValue(Arrays.asList(d2PE.getLocation())));
 
                     one(dataStoreService2).uploadDataSetsToCIFEX(
-                            with(equal(dss2.getSessionToken())), with(new BaseMatcher<List<ExternalData>>()
+                            with(equal(dss2.getSessionToken())),
+                            with(new BaseMatcher<List<ExternalData>>()
                                 {
 
                                     public boolean matches(Object item)
@@ -647,7 +653,7 @@ public final class ExternalDataTableTest extends AbstractBOTest
                             with(equal(ManagerTestTool.EXAMPLE_PERSON.getEmail())),
                             with(equal(true)));
                     will(throwException(new RuntimeException()));
-                    
+
                     allowing(dataStoreService3).archiveDatasets(
                             with(equal(dss3.getSessionToken())),
                             with(createDatasetDescriptionsMatcher(d3Array)),
@@ -719,7 +725,8 @@ public final class ExternalDataTableTest extends AbstractBOTest
     }
 
     @SuppressWarnings("unchecked")
-    private BaseMatcher<List<DatasetDescription>> createDatasetDescriptionsMatcher(final ExternalDataPE... dataSets)
+    private BaseMatcher<List<DatasetDescription>> createDatasetDescriptionsMatcher(
+            final ExternalDataPE... dataSets)
     {
         return new BaseMatcher<List<DatasetDescription>>()
             {
@@ -730,8 +737,10 @@ public final class ExternalDataTableTest extends AbstractBOTest
                     assertEquals(dataSets.length, list.size());
                     for (int i = 0; i < list.size(); i++)
                     {
-                        assertEquals("data set " + i, dataSets[i].getCode(), list.get(i).getDataSetCode());
-                        assertEquals("data set " + i, dataSets[i].getSpeedHint(), list.get(i).getSpeedHint());
+                        assertEquals("data set " + i, dataSets[i].getCode(), list.get(i)
+                                .getDataSetCode());
+                        assertEquals("data set " + i, dataSets[i].getSpeedHint(), list.get(i)
+                                .getSpeedHint());
                     }
                     return true;
                 }
@@ -747,7 +756,7 @@ public final class ExternalDataTableTest extends AbstractBOTest
                 }
             };
     }
-    
+
     @SuppressWarnings("unchecked")
     private BaseMatcher<List<String>> createUnorderedMarcher(final List<String> list)
     {
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 fd798c1fa46..0c6637d5422 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
@@ -352,7 +352,7 @@ public final class SampleBOTest extends AbstractBOTest
         context.checking(new Expectations()
             {
                 {
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(true));
                 }
             });
@@ -445,7 +445,7 @@ public final class SampleBOTest extends AbstractBOTest
                     allowing(daoFactory).getHomeDatabaseInstance();
                     will(returnValue(EXAMPLE_DATABASE_INSTANCE));
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
                 }
             });
@@ -497,7 +497,7 @@ public final class SampleBOTest extends AbstractBOTest
                     allowing(sampleDAO).tryFindByCodeAndSpace(parent.getCode(), EXAMPLE_GROUP);
                     will(returnValue(parent));
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
                 }
             });
@@ -564,7 +564,7 @@ public final class SampleBOTest extends AbstractBOTest
                             EXAMPLE_GROUP2);
                     will(returnValue(parent3Group2));
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
                 }
             });
@@ -621,7 +621,7 @@ public final class SampleBOTest extends AbstractBOTest
                     allowing(sampleDAO).tryFindByCodeAndSpace(container.getCode(), EXAMPLE_GROUP);
                     will(returnValue(container));
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
                 }
             });
@@ -661,7 +661,7 @@ public final class SampleBOTest extends AbstractBOTest
                     allowing(sampleDAO).tryFindByCodeAndSpace(container.getCode(), EXAMPLE_GROUP2);
                     will(returnValue(container));
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
 
                     one(sampleDAO).createOrUpdateSample(sample);
@@ -692,7 +692,7 @@ public final class SampleBOTest extends AbstractBOTest
             {
                 {
 
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(true));
                 }
             });
@@ -977,7 +977,7 @@ public final class SampleBOTest extends AbstractBOTest
         context.checking(new Expectations()
             {
                 {
-                    allowing(externalDataDAO).hasExternalData(with(sample));
+                    allowing(dataDAO).hasDataSet(with(sample));
                     will(returnValue(false));
                 }
             });
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
index da35a348811..6c1ac0e4b13 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExternalDataDAOTest.java
@@ -65,6 +65,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.types.DataSetTypeCode;
  */
 @Test(groups =
     { "db", "externalData" })
+@SuppressWarnings("deprecation")
 public final class ExternalDataDAOTest extends AbstractDAOTest
 {
 
@@ -171,7 +172,7 @@ public final class ExternalDataDAOTest extends AbstractDAOTest
     {
         checkUpdate(4711L);
     }
-    
+
     private void checkUpdate(Long size)
     {
         IExternalDataDAO externalDataDAO = daoFactory.getExternalDataDAO();
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
index b17e117c693..25559dff8b9 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
@@ -157,15 +157,6 @@ public final class SqlUnitMigrationTest
             return "MyDataSource[" + driver + ", " + url + ", " + owner + "]";
         }
 
-        public boolean isWrapperFor(Class<?> arg0) throws SQLException
-        {
-            return false;
-        }
-
-        public <T> T unwrap(Class<T> arg0) throws SQLException
-        {
-            return null;
-        }
     }
 
     private static final IDataSourceFactory DATA_SOURCE_FACTORY = new IDataSourceFactory()
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
index 60db0c64bfb..33e140a53ac 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/scalability/DBCreator.java
@@ -28,8 +28,8 @@ import org.springframework.test.annotation.Rollback;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
+import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO;
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.IFileFormatTypeDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.ILocatorTypeDAO;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.AbstractDAOTest;
@@ -41,11 +41,11 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.FileFormatTypePE;
-import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.StorageFormat;
 import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE;
@@ -73,8 +73,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind;
  * <br>
  * IMPORTANT - to make it faster try:
  * <ul>
- * <li>commenting out flush() in create methods for in {@link IExternalDataDAO} and
- * {@link SampleDAO}
+ * <li>commenting out flush() in create methods for in {@link IDataDAO} and {@link SampleDAO}
  * <li>turning off logging (doesn't make a big difference) - change root logging priority in log.xml
  * from "info" to "error".
  * </ul>
@@ -305,6 +304,7 @@ public final class DBCreator extends AbstractDAOTest
 
     // DataSets
 
+    @SuppressWarnings("deprecation")
     private void createDataSetsForSample(SamplePE sample)
     {
         final int size = SizeHelper.getNextDataSetsPerSampleSize();
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoaderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoaderTest.java
index 286e81d776c..3e83f0938aa 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoaderTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/DataSetGroupLoaderTest.java
@@ -27,11 +27,11 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.IExternalDataDAO;
+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.ExternalDataPE;
-import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
+import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
 
 /**
  * Test cases for {@link DataSetGroupLoader}.
@@ -48,13 +48,13 @@ public class DataSetGroupLoaderTest extends AssertJUnit
 
     private Mockery context;
 
-    private IExternalDataDAO dao;
+    private IDataDAO dao;
 
     @BeforeMethod
     public void setUp()
     {
         context = new Mockery();
-        dao = context.mock(IExternalDataDAO.class);
+        dao = context.mock(IDataDAO.class);
     }
 
     @AfterMethod
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactoryTest.java
index d7442f07db1..df17d6597a4 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactoryTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/shared/authorization/result_filter/GroupLoaderFactoryTest.java
@@ -89,7 +89,7 @@ public class GroupLoaderFactoryTest extends AssertJUnit
         context.checking(new Expectations()
             {
                 {
-                    one(daoFactory).getExternalDataDAO();
+                    one(daoFactory).getDataDAO();
                     will(returnValue(null));
                 }
             });
-- 
GitLab