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 9f2a597ff192c8c177cdd596c34fd2c1a0f7facc..d3097fd6f5871da91515006fee04df9d6101046f 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 b24852f3c9cc71a33c7c2ad508397695cb8ae2d6..30875851f56d58fdbae6744af921d595ed865976 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 8e65530dfebaf211bb1e66e1517b9ac324c937b4..a8a7edfbbcc619a414d358329180629bcf8a36de 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 cd16c283ad9157c7dd4b775e8dc0d90006350de0..a57e8a46a48456e992605ea6198c99c2a7d06b3a 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 768297549e56f9931e6db2ef72d9a5dde5fc01fd..0919865b01bbe7940275b0dbe0992b1aa1d22a94 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 e54fa46de24476a2812235d35ef93a02ec6059f6..f4baad2db7b716caa62465a48d8cbef71724e09a 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 aedbe2b3144a1f8ea07042ac11e153420f5a15a6..55237d38a31fa317f839d05632a8fa73f2543af7 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 39e20641d699f746b62ff546e24aee8f82bd24e3..42c245bbe3f9647ba4caa3f46ccf581a380798ea 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 e371dbf7e6d52836d76d52ae982a01b3b9f9a7ca..24a6c291c4f15cca4578faadab89ebdd27df937f 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 d44effed62e2b78c7dd9a5aacb12ad06e7a94178..36621269586d48cc0957fdc0b54401ad891f6354 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 921112fe7687977ee569c0fb6e71ee25fc387b56..35f9b3dd03b0f519b6a30f9341e7733c7ce44307 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 fbe83c0fc55d0f0cd8fbe8db302fcfc258bf3143..95c57e9a6e49cef44723e5a4adf0cbc2a8ebc31a 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 9255dadd9499c5015005ff9720549ed6ca322c0e..02b12b38d576e3fe394e19f46ddd7b46f5c14ff9 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 fa86ddaa30fa8e363854a8c11aa82ee892e856d2..776700cb48e9653e43cabd89e262e1c74ab29fce 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 d07eda0c263f22813005a50c76c63a84d642a220..c8c935cf39abfee420637b3948665aca43e1ee43 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 1578ac12e0d4cf574146d4381fe8d1ec53efbcb2..e573125127f44b35dabecc99c157a8de01753d3a 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 258862dfd94614d050fa8ebbd3cdd53bb2261312..a0bbd96621a88f3dbf18ae7d48192abf1a830fe2 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 cea27e1e036b2d32f6672b15e58cce0c97599960..cc62493e8e2779585cf1dca8dce78daf03caec20 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 fd798c1fa46c287f69c4879c1f33317af78c92c0..0c6637d542207574fcb2f3c2922d749620566f02 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 da35a34881111cb8c568eb157a603dc9e7fa6ca5..6c1ac0e4b1317503e6fe9d91520f38b5e930d4e0 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 b17e117c6939ab7fc16a09b965a896f4466c4c26..25559dff8b9d388ab0c4241e8262809536d003fd 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 60db0c64bfb349c2be66f4873e54dbdb1e2330d9..33e140a53acc7ec539f286a7e6e8469fa3dcf11d 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 286e81d776c90c03d4e3e6401550f07b9affd062..3e83f0938aaeaa3ac021665e360931bca8763b32 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 d7442f07db15c08c3049e30a075c7d25007bd98a..df17d6597a43841af1b00ec366a039ad499d6132 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)); } });