From fea60d29ae771019171a071b6144771668bf8cd3 Mon Sep 17 00:00:00 2001 From: kaloyane <kaloyane> Date: Mon, 5 Dec 2011 15:36:50 +0000 Subject: [PATCH] [LMS-2676] make ExternalData an abstract class, remove deprecated methods from it SVN: 23878 --- .../api/v1/impl/DataSetUpdatable.java | 3 +- .../dss/generic/server/UploadingCommand.java | 6 +- .../ExperimentBasedArchivingTaskTest.java | 3 +- .../ArchivingPostRegistrationTaskTest.java | 13 ++-- .../server/DatasetDownloadServletTest.java | 30 ++++---- .../shared/utils/SegmentedStoreUtilsTest.java | 4 +- .../dsu/dss/plugins/DataSetToSOFTTest.java | 4 +- .../main/FileBasedTrackingDAOTest.java | 5 +- .../generic/shared/basic/dto/DataSet.java | 12 --- .../shared/basic/dto/ExternalData.java | 76 +++---------------- .../shared/basic/dto/PlaceholderDataSet.java | 36 +++++++++ .../shared/translator/DataSetTranslator.java | 3 +- .../generic/server/ETLServiceTest.java | 2 + .../validator/ExternalDataValidatorTest.java | 19 +++-- .../web/server/GenericClientServiceTest.java | 6 +- ...ataSetInfoExtractorForMSInjectionTest.java | 4 +- .../ProteomicsDataServiceInternalTest.java | 47 ++++++------ .../api/v1/ProteomicsDataServiceTest.java | 5 +- .../server/logic/ScreeningUtils.java | 19 ++--- .../server/DssServiceRpcScreeningTest.java | 8 +- .../server/logic/ScreeningApiImplTest.java | 5 +- 21 files changed, 148 insertions(+), 162 deletions(-) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PlaceholderDataSet.java diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetUpdatable.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetUpdatable.java index 4cd8c33f82a..84a0cde25c8 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetUpdatable.java +++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/DataSetUpdatable.java @@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v1.ISampleImmuta import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PlaceholderDataSet; import ch.systemsx.cisd.openbis.generic.shared.util.EntityHelper; /** @@ -112,7 +113,7 @@ public class DataSetUpdatable extends DataSetImmutable implements IDataSetUpdata { for (String code : containedDataSetCodes) { - ExternalData dummy = new ExternalData(); + PlaceholderDataSet dummy = new PlaceholderDataSet(); dummy.setCode(code); dummies.add(dummy); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java index b52c710ad95..c62e33cb39f 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/UploadingCommand.java @@ -510,7 +510,11 @@ class UploadingCommand implements IDataSetCommand builder.dataSet("producer_code", dataSet.getDataProducerCode()); builder.dataSet("data_set_type", dataSet.getDataSetType().getCode()); builder.dataSet("is_measured", dataSet.isDerived() == false); - builder.dataSet("is_complete", BooleanOrUnknown.T.equals(dataSet.getComplete())); + if (dataSet.tryGetAsDataSet() != null) + { + final Boolean completeFlag = dataSet.tryGetAsDataSet().getComplete(); + builder.dataSet("is_complete", BooleanOrUnknown.T.equals(completeFlag)); + } builder.dataSetProperties(dataSet.getProperties()); StringBuilder stringBuilder = new StringBuilder(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/plugins/ExperimentBasedArchivingTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/plugins/ExperimentBasedArchivingTaskTest.java index 54e18a76261..f72390936d8 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/plugins/ExperimentBasedArchivingTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/plugins/ExperimentBasedArchivingTaskTest.java @@ -42,6 +42,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PlaceholderDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.DataSetBuilder; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.ExperimentBuilder; @@ -134,7 +135,7 @@ public class ExperimentBasedArchivingTaskTest extends AbstractFileSystemTestCase e1 = new ExperimentBuilder().id(41).identifier("/S/P/E1").getExperiment(); e2 = new ExperimentBuilder().id(42).identifier("/S/P/E2").getExperiment(); e3 = new ExperimentBuilder().id(42).identifier("/S/P/E3").getExperiment(); - notARealDataSet = new ExternalData(); + notARealDataSet = new PlaceholderDataSet(); lockedDataSet = dataSet("lockedDataSet").modificationDate(new Date(100)) .status(DataSetArchivingStatus.LOCKED).getDataSet(); diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java index 513aee5b041..e9711dd46b2 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/postregistration/ArchivingPostRegistrationTaskTest.java @@ -41,7 +41,9 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.IDataStoreServiceInternal; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.ProcessingStatus; import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProviderTestWrapper; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType; /** * @author Kaloyan Enimanev @@ -116,7 +118,7 @@ public class ArchivingPostRegistrationTaskTest extends AssertJUnit will(returnValue(directoryProvider)); one(service).listDataSetsByCode(Arrays.asList(DATASET_CODE)); - List<ExternalData> externalDatas = Arrays.asList(createExternalData()); + List<ExternalData> externalDatas = Arrays.asList(createDataSet()); will(returnValue(externalDatas)); one(service).compareAndSetDataSetStatus(DATASET_CODE, AVAILABLE, @@ -151,10 +153,11 @@ public class ArchivingPostRegistrationTaskTest extends AssertJUnit } - private ExternalData createExternalData() + private ExternalData createDataSet() { - ExternalData externalData = new ExternalData(); - externalData.setCode(DATASET_CODE); - return externalData; + DataSet dataSet = new DataSet(); + dataSet.setCode(DATASET_CODE); + dataSet.setFileFormatType(new FileFormatType("DATA")); + return dataSet; } } diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServletTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServletTest.java index 6264d735d78..11149e67ec8 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServletTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServletTest.java @@ -65,6 +65,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.utils.DatasetLocationUtil; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LocatorType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Space; @@ -202,7 +203,7 @@ public class DatasetDownloadServletTest public void testInitialDoGet() throws Exception { final StringWriter writer = new StringWriter(); - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); prepareParseRequestURL(); prepareForObtainingDataSetFromServer(externalData); prepareForGettingDataSetFromSession(externalData, ""); @@ -276,7 +277,7 @@ public class DatasetDownloadServletTest public void testInitialDoGetButDataSetNotFoundInStore() throws Exception { final StringWriter writer = new StringWriter(); - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); prepareParseRequestURL(); prepareForObtainingDataSetFromServer(externalData); prepareLocking(); @@ -352,7 +353,7 @@ public class DatasetDownloadServletTest public void testDoGetSubFolder() throws Exception { final StringWriter writer = new StringWriter(); - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); prepareForObtainingDataSetFromServer(externalData); prepareForGettingDataSetFromSession(externalData, ESCAPED_EXAMPLE_DATA_SET_SUB_FOLDER_NAME); prepareLocking(); @@ -385,7 +386,7 @@ public class DatasetDownloadServletTest @Test() public void testDoGetFile() throws Exception { - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); prepareParseRequestURL(); @@ -433,7 +434,7 @@ public class DatasetDownloadServletTest BufferedImage image = new BufferedImage(100, 200, BufferedImage.TYPE_INT_RGB); ImageIO.write(image, "png", EXAMPLE_FILE); prepareParseRequestURLForThumbnail(100, 50); - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); prepareCheckDatasetAccess(); prepareForObtainingDataSetFromServer(externalData); prepareLocking(); @@ -482,7 +483,7 @@ public class DatasetDownloadServletTest public void testDoGetNonExistingFile() throws Exception { final StringWriter writer = new StringWriter(); - final ExternalData externalData = createExternalData(); + final ExternalData externalData = createDataSet(); prepareParseRequestURL(); prepareForObtainingDataSetFromServer(externalData); prepareLocking(); @@ -773,7 +774,7 @@ public class DatasetDownloadServletTest }); } - private DataSet createExternalData() + private DataSet createDataSet() { Space space = new Space(); space.setCode(SPACE_CODE); @@ -783,16 +784,17 @@ public class DatasetDownloadServletTest Experiment experiment = new Experiment(); experiment.setCode(EXPERIMENT_CODE); experiment.setProject(project); - final DataSet externalData = new DataSet(); - externalData.setExperiment(experiment); - externalData.setCode(EXAMPLE_DATA_SET_CODE); + final DataSet dataSet = new DataSet(); + dataSet.setExperiment(experiment); + dataSet.setCode(EXAMPLE_DATA_SET_CODE); + dataSet.setFileFormatType(new FileFormatType("DATA")); LocatorType locatorType = new LocatorType(); locatorType.setCode(LocatorType.DEFAULT_LOCATOR_TYPE_CODE); - externalData.setLocatorType(locatorType); - externalData.setShareId(DEFAULT_SHARE_ID); - externalData.setLocation(DatasetLocationUtil.getDatasetLocationPath(EXAMPLE_DATA_SET_CODE, + dataSet.setLocatorType(locatorType); + dataSet.setShareId(DEFAULT_SHARE_ID); + dataSet.setLocation(DatasetLocationUtil.getDatasetLocationPath(EXAMPLE_DATA_SET_CODE, DATABASE_INSTANCE_UUID)); - return externalData; + return dataSet; } private static File getDatasetDirectoryLocation(final File baseDir, String dataSetCode) diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SegmentedStoreUtilsTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SegmentedStoreUtilsTest.java index 43e5de0d562..2983269bbeb 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SegmentedStoreUtilsTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/shared/utils/SegmentedStoreUtilsTest.java @@ -40,7 +40,7 @@ import ch.systemsx.cisd.common.utilities.ITimeProvider; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager; import ch.systemsx.cisd.openbis.generic.shared.Constants; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO; /** @@ -197,7 +197,7 @@ public class SegmentedStoreUtilsTest extends AbstractFileSystemTestCase { { one(service).tryGetDataSet("ds-1"); - will(returnValue(new ExternalData())); + will(returnValue(new DataSet())); one(service).updateShareIdAndSize("ds-1", "2", 11L); one(shareIdManager).setShareId("ds-1", "2"); diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/plugins/DataSetToSOFTTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/plugins/DataSetToSOFTTest.java index 44add9aa434..a7fd2448a59 100644 --- a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/plugins/DataSetToSOFTTest.java +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/dss/plugins/DataSetToSOFTTest.java @@ -49,8 +49,8 @@ import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IProcessingPlug import ch.systemsx.cisd.openbis.dss.generic.shared.DataSetProcessingContext; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.ProcessingStatus; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListSampleCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; @@ -227,7 +227,7 @@ public class DataSetToSOFTTest<workingDirectory> extends AbstractFileSystemTestC { { one(service).tryGetDataSet(dataSetCode); - ExternalData dataSet = new ExternalData(); + DataSet dataSet = new DataSet(); dataSet.setCode(dataSetCode); dataSet.setSample(flowLaneSample); will(returnValue(dataSet)); diff --git a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/tracking/main/FileBasedTrackingDAOTest.java b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/tracking/main/FileBasedTrackingDAOTest.java index 5cde0e8dfa3..a9af92bcfd6 100644 --- a/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/tracking/main/FileBasedTrackingDAOTest.java +++ b/deep_sequencing_unit/sourceTest/java/ch/ethz/bsse/cisd/dsu/tracking/main/FileBasedTrackingDAOTest.java @@ -31,6 +31,7 @@ import ch.ethz.bsse.cisd.dsu.tracking.dto.TrackingStateDTO; import ch.ethz.bsse.cisd.dsu.tracking.main.TrackingBO.TrackingStateUpdateHelper; import ch.systemsx.cisd.base.tests.AbstractFileSystemTestCase; import ch.systemsx.cisd.common.filesystem.FileUtilities; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; @@ -131,9 +132,9 @@ public class FileBasedTrackingDAOTest extends AbstractFileSystemTestCase return result; } - private static ExternalData createDataSetWithId(long id) + private static DataSet createDataSetWithId(long id) { - ExternalData result = new ExternalData(); + DataSet result = new DataSet(); result.setId(id); return result; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java index 54bd7dfceed..e80fe87806e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DataSet.java @@ -48,13 +48,11 @@ public class DataSet extends ExternalData implements IDatasetLocation return this; } - @Override public Boolean getComplete() { return complete; } - @Override public void setComplete(Boolean complete) { this.complete = complete; @@ -70,7 +68,6 @@ public class DataSet extends ExternalData implements IDatasetLocation return shareId; } - @Override public String getLocation() { return location; @@ -85,19 +82,16 @@ public class DataSet extends ExternalData implements IDatasetLocation return "-"; } - @Override public void setLocation(String location) { this.location = location; } - @Override public DataSetArchivingStatus getStatus() { return status; } - @Override public void setStatus(DataSetArchivingStatus status) { this.status = status; @@ -113,37 +107,31 @@ public class DataSet extends ExternalData implements IDatasetLocation this.presentInArchive = presentInArchive; } - @Override public int getSpeedHint() { return speedHint; } - @Override public void setSpeedHint(int speedHint) { this.speedHint = speedHint; } - @Override public LocatorType getLocatorType() { return locatorType; } - @Override public void setLocatorType(LocatorType locatorType) { this.locatorType = locatorType; } - @Override public FileFormatType getFileFormatType() { return fileFormatType; } - @Override public void setFileFormatType(FileFormatType fileFormatType) { this.fileFormatType = fileFormatType; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java index 8c19450476b..d7047241dcb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExternalData.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IPermIdHolder; * * @author Christian Ribeaud */ -public class ExternalData extends CodeWithRegistration<ExternalData> implements +public abstract class ExternalData extends CodeWithRegistration<ExternalData> implements IEntityWithDeletionInformation, IEntityInformationHolderWithProperties, IIdAndCodeHolder, IPermIdHolder { @@ -100,6 +100,14 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements return false; // overriden in subclasses } + /** + * @return true if this is a place holder data set. + */ + public boolean isPlaceHolderDataSet() + { + return false; // overriden in subclasses + } + /** * Will return non-null values for plain non-container data sets. */ @@ -196,39 +204,6 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements this.derived = derived; } - @Deprecated - public DataSetArchivingStatus getStatus() - { - return null; - } - - @Deprecated - public void setStatus(DataSetArchivingStatus status) - { - } - - @Deprecated - public int getSpeedHint() - { - return 0; - } - - @Deprecated - public void setSpeedHint(int speedHint) - { - } - - @Deprecated - public Boolean getComplete() - { - return null; - } - - @Deprecated - public void setComplete(Boolean complete) - { - } - public final DataSetType getDataSetType() { return dataSetType; @@ -289,39 +264,6 @@ public class ExternalData extends CodeWithRegistration<ExternalData> implements this.size = size; } - @Deprecated - public String getLocation() - { - return null; - } - - @Deprecated - public void setLocation(final String location) - { - } - - @Deprecated - public FileFormatType getFileFormatType() - { - return null; - } - - @Deprecated - public void setFileFormatType(final FileFormatType fileFormatType) - { - } - - @Deprecated - public LocatorType getLocatorType() - { - return null; - } - - @Deprecated - public void setLocatorType(final LocatorType locatorType) - { - } - public final Deletion getDeletion() { return deletion; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PlaceholderDataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PlaceholderDataSet.java new file mode 100644 index 00000000000..b3a3c471c3a --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PlaceholderDataSet.java @@ -0,0 +1,36 @@ +/* + * Copyright 2011 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.shared.basic.dto; + +/** + * Placeholder data sets are an abstraction pointing to a non-yet existing data set which is about + * to be created. + * + * @author Kaloyan Enimanev + */ +public class PlaceholderDataSet extends ExternalData +{ + + private static final long serialVersionUID = 1L; + + @Override + public boolean isPlaceHolderDataSet() + { + return true; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java index 451cfe33b61..1ad4926ecf3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DataSetTranslator.java @@ -34,6 +34,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PlaceholderDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; @@ -292,7 +293,7 @@ public class DataSetTranslator } else { assert dataPE.isPlaceholder() == true; - result = new ExternalData(); + result = new PlaceholderDataSet(); } result.setId(HibernateUtils.getId(dataPE)); result.setCode(dataPE.getCode()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java index 8657f793a6a..fb7c6af540a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java @@ -103,6 +103,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.builders.DatabaseInstancePEBu import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.DatabaseInstanceIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.util.MaterialConfigurationProvider; /** * @author Franz-Josef Elmer @@ -143,6 +144,7 @@ public class ETLServiceTest extends AbstractServerTestCase dssfactory = context.mock(IDataStoreServiceFactory.class); dataStoreService = context.mock(IDataStoreService.class); hibernateSearchDao = context.mock(IHibernateSearchDAO.class); + MaterialConfigurationProvider.initializeForTesting(false); } @Test diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/authorization/validator/ExternalDataValidatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/authorization/validator/ExternalDataValidatorTest.java index b9a0e8b39ea..d9d06a3f29c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/authorization/validator/ExternalDataValidatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/authorization/validator/ExternalDataValidatorTest.java @@ -19,25 +19,24 @@ package ch.systemsx.cisd.openbis.generic.shared.authorization.validator; import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.shared.authorization.AuthorizationTestCase; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator; /** - * - * * @author Franz-Josef Elmer */ public class ExternalDataValidatorTest extends AuthorizationTestCase { - private ExternalData createData(SpacePE group) + private DataSet createData(SpacePE group) { - ExternalData data = new ExternalData(); - data.setExperiment(ExperimentTranslator.translate(createExperiment(group), "http://someURL")); + DataSet data = new DataSet(); + data.setExperiment(ExperimentTranslator + .translate(createExperiment(group), "http://someURL")); return data; } - + @Test public void testIsValidWithDataInTheRightGroup() { @@ -53,7 +52,7 @@ public class ExternalDataValidatorTest extends AuthorizationTestCase PersonPE person = createPersonWithRoleAssignments(); assertEquals(true, validator.isValid(person, createData(createGroup()))); } - + @Test public void testIsValidWithDataInTheWrongGroup() { @@ -62,5 +61,5 @@ public class ExternalDataValidatorTest extends AuthorizationTestCase SpacePE group = createGroup("blabla", createAnotherDatabaseInstance()); assertEquals(false, validator.isValid(person, createData(group))); } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java index 2ed457d3032..c1787f8329e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceTest.java @@ -43,6 +43,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.server.UploadedFilesBean; import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BatchRegistrationResult; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; @@ -198,7 +199,7 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest prepareGetSessionToken(this); one(genericServer).getDataSetInfo(SESSION_TOKEN, id); - ExternalData dataSet = new ExternalData(); + DataSet dataSet = new DataSet(); dataSet.setDataSetProperties(Arrays.asList(createXmlProperty())); will(returnValue(dataSet)); } @@ -972,7 +973,8 @@ public final class GenericClientServiceTest extends AbstractClientServiceTest private final boolean equals(final NewSample newSample, final NewSample thatNewSample) { - // NOTE: this should take default container and default space into account to be complete + // NOTE: this should take default container and default space into account to be + // complete return ObjectUtils.equals(newSample, thatNewSample) && StringUtils.equals(newSample.getContainerIdentifier(), thatNewSample.getContainerIdentifier()) diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForMSInjectionTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForMSInjectionTest.java index cc65b2357b8..49295b175b8 100644 --- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForMSInjectionTest.java +++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/etlserver/proteomics/DataSetInfoExtractorForMSInjectionTest.java @@ -54,7 +54,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.etlserver.IDataSetInfoExtractor; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; -import ch.systemsx.cisd.openbis.etlserver.proteomics.DataSetInfoExtractorForMSInjection; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypeWithVocabularyTerms; @@ -709,7 +709,7 @@ public class DataSetInfoExtractorForMSInjectionTest extends AbstractFileSystemTe private ExternalData createDataSet(String type, String code, int timestamp) { - ExternalData ds = new ExternalData(); + DataSet ds = new DataSet(); ds.setDataSetType(new DataSetType(type)); ds.setCode(code); ds.setRegistrationDate(new Date(timestamp)); diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ProteomicsDataServiceInternalTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ProteomicsDataServiceInternalTest.java index b255112ed9e..f1532772255 100644 --- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ProteomicsDataServiceInternalTest.java +++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ProteomicsDataServiceInternalTest.java @@ -38,7 +38,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObject import ch.systemsx.cisd.openbis.generic.shared.AbstractServerTestCase; import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStoreServiceKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance; @@ -46,6 +46,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Space; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.DataSetBuilder; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStoreServicePE; import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; @@ -59,7 +60,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.RoleAssignmentPE; 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.properties.EntityKind; -import ch.systemsx.cisd.openbis.plugin.proteomics.server.ProteomicsDataServiceInternal; import ch.systemsx.cisd.openbis.plugin.proteomics.server.business.IBusinessObjectFactory; import ch.systemsx.cisd.openbis.plugin.proteomics.server.business.ISampleLoader; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.IProteomicsDataServiceInternal; @@ -362,32 +362,35 @@ public class ProteomicsDataServiceInternalTest extends AbstractServerTestCase will(returnValue(bioExperiments)); List<Sample> filteredSamples = new ArrayList<Sample>(); - Map<Sample, List<ExternalData>> dataSetsBySamples = - new HashMap<Sample, List<ExternalData>>(); + Map<Sample, List<DataSet>> dataSetsBySamples = + new HashMap<Sample, List<DataSet>>(); for (Sample sample : samples) { if ("Space-0".equals(sample.getGeneratedFrom().getSpace().getCode())) { Long id = sample.getId(); - ExternalData ds1 = new ExternalData(); - ds1.setId(id * 1000); - ds1.setCode("ds-" + id); - ds1.setRegistrationDate(new Date(ds1.getId())); - ds1.setDataSetType(new DataSetType("dt-" + id % 2)); - ds1.setSample(sample); - ExternalData ds2 = new ExternalData(); - ds2.setId((id + 1) * 1001); - ds2.setCode("ds-" + id + 1); - ds2.setRegistrationDate(new Date(ds2.getId())); - ds2.setDataSetType(new DataSetType("dt-" + id % 2)); - ds2.setSample(sample); - ExternalData ds2Child = new ExternalData(); - ds2Child.setId(ds2.getId() + 1); - ds2Child.setCode(ds2.getCode() + "-child"); - ds2Child.setRegistrationDate(new Date(ds2Child.getId())); - ds2Child.setDataSetType(new DataSetType("dt-" + id % 2)); - ds2.setChildren(Arrays.asList(ds2Child)); + String dataSetType = "dt-" + id % 2; + long ds1Id = id * 1000; + DataSet ds1 = + new DataSetBuilder(ds1Id).code("ds-" + id) + .registrationDate(new Date(ds1Id)).sample(sample) + .type(dataSetType).getDataSet(); + + long ds2Id = (id + 1) * 1001; + DataSet ds2 = + new DataSetBuilder(ds2Id).code("ds-" + id + 1) + .registrationDate(new Date(ds2Id)).sample(sample) + .type(dataSetType).getDataSet(); + + long ds2ChildId = ds2.getId() + 1; + DataSet ds2Child = + new DataSetBuilder(ds2ChildId).code(ds2.getCode() + "-child") + .registrationDate(new Date(ds2ChildId)).sample(sample) + .type(dataSetType).getDataSet(); + + ds2.setChildren(Arrays.<ExternalData> asList(ds2Child)); dataSetsBySamples.put(sample, Arrays.asList(ds1, ds2)); + filteredSamples.add(sample); } } diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ProteomicsDataServiceTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ProteomicsDataServiceTest.java index 62bb04f7613..29e78ce768b 100644 --- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ProteomicsDataServiceTest.java +++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ProteomicsDataServiceTest.java @@ -25,8 +25,8 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import org.jmock.Expectations; import org.testng.annotations.BeforeMethod; @@ -50,7 +50,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; import ch.systemsx.cisd.openbis.generic.shared.dto.DataStoreServicePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO; -import ch.systemsx.cisd.openbis.plugin.proteomics.server.api.v1.ProteomicsDataService; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.IProteomicsDataServiceInternal; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.api.v1.IProteomicsDataService; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.api.v1.dto.DataSet; @@ -412,7 +411,7 @@ public class ProteomicsDataServiceTest extends AbstractServerTestCase private ExternalData createDataSet(String type, long date) { - ExternalData dataSet = new ExternalData(); + ExternalData dataSet = new ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet(); dataSet.setId(date); dataSet.setCode(type + "-" + date); dataSet.setDataSetType(new DataSetType(type)); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningUtils.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningUtils.java index f273e099a22..b97b2d4caa3 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningUtils.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningUtils.java @@ -28,7 +28,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ContainerDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.FileFormatType; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.translator.DataStoreTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator; @@ -86,17 +85,19 @@ public class ScreeningUtils dataStore, dataTypeCode, dataset.getRegistrationDate(), fileTypeCode, experiment); } - private static String tryGetFileTypeCode(ExternalData dataset) + private static String tryGetFileTypeCode(ExternalData abstractDataSet) { - @SuppressWarnings("deprecation") - FileFormatType fileFormat = dataset.getFileFormatType(); - String fileTypeCode = fileFormat == null ? null : fileFormat.getCode(); - if (fileTypeCode != null - && fileTypeCode.equalsIgnoreCase(ScreeningConstants.UNKNOWN_FILE_FORMAT)) + ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet dataSet = + abstractDataSet.tryGetAsDataSet(); + if (dataSet != null && dataSet.getFileFormatType() != null) { - fileTypeCode = null; + String fileTypeCode = dataSet.getFileFormatType().getCode(); + if (false == ScreeningConstants.UNKNOWN_FILE_FORMAT.equalsIgnoreCase(fileTypeCode)) + { + return fileTypeCode; + } } - return fileTypeCode; + return null; } private static DatasetReference createDatasetReference(long datasetId, String datasetCode, diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningTest.java index c7fd5cf2dff..82d53dd2270 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningTest.java @@ -68,8 +68,8 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.authorization.Ds import ch.systemsx.cisd.openbis.dss.generic.shared.dto.Size; import ch.systemsx.cisd.openbis.dss.generic.shared.utils.ImageUtilTest; import ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreening; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.DatasetIdentifier; @@ -633,16 +633,16 @@ public class DssServiceRpcScreeningTest extends AssertJUnit context.checking(new Expectations() { { - ExternalData externalData = new ExternalData(); + DataSet dataSet = new DataSet(); Experiment experiment = new Experiment(); experiment.setPermId(EXPERIMENT_PERM_ID); experiment.setId(EXPERIMENT_ID); - externalData.setExperiment(experiment); + dataSet.setExperiment(experiment); for (DatasetIdentifier datasetIdentifier : dataSetIdentifiers) { one(service).tryGetDataSet(SESSION_TOKEN, datasetIdentifier.getDatasetCode()); - will(returnValue(externalData)); + will(returnValue(dataSet)); } } }); diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java index 4920f6ddc65..3b75564581b 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/ScreeningApiImplTest.java @@ -34,6 +34,7 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.test.RecordingMatcher; import ch.systemsx.cisd.openbis.generic.shared.AbstractServerTestCase; import ch.systemsx.cisd.openbis.generic.shared.basic.GenericSharedConstants; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; @@ -498,9 +499,9 @@ public class ScreeningApiImplTest extends AbstractServerTestCase return dataSet; } - private ExternalData createDataSet(Sample sample, String code, long id) + private DataSet createDataSet(Sample sample, String code, long id) { - ExternalData dataSet = new ExternalData(); + DataSet dataSet = new DataSet(); dataSet.setId(id); dataSet.setCode(code); dataSet.setSample(sample); -- GitLab