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 0cb80a21d2eb551ee213036bfbfc5e95f9b74991..107a12581a421f75c658443e393073ba2618b60d 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 @@ -48,6 +48,7 @@ import ch.systemsx.cisd.common.mail.MailClientParameters; import ch.systemsx.cisd.common.types.BooleanOrUnknown; import ch.systemsx.cisd.common.utilities.TokenGenerator; import ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider; +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.IEntityProperty; @@ -409,8 +410,11 @@ class UploadingCommand implements IDataSetCommand { outputStream = new FileOutputStream(zipFile); zipOutputStream = new ZipOutputStream(outputStream); - for (ExternalData dataSet : dataSets) + for (ExternalData externalData : dataSets) { + DataSet dataSet = externalData.tryGetAsDataSet(); + assert dataSet != null : "container datasets are currently not supported by DSS client"; + DatasetDescription dataSetDescription = ExternalDataTranslator.translateToDescription(dataSet); File dataSetFile = dataSetDirectoryProvider.getDataSetDirectory(dataSetDescription); @@ -462,7 +466,7 @@ class UploadingCommand implements IDataSetCommand } } - private String createMetaData(ExternalData dataSet) + private String createMetaData(DataSet dataSet) { MetaDataBuilder builder = new MetaDataBuilder(); builder.dataSet("code", dataSet.getCode()); 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 2d508016b5bd0446321dfc319b38254c01d6334e..4b41b471c46f4a8abf998e2951fbf32286a1d229 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 @@ -309,6 +309,7 @@ public final class ExternalDataTable extends AbstractExternalDataBusinessObject assertDatasetsAreAvailable(externalData); Map<DataStorePE, List<ExternalDataPE>> map = groupDataSetsByDataStores(); assertDataSetsAreKnown(map); + assertNoContainerDataSets(map); uploadContext.setUserEMail(session.getPrincipal().getEmail()); uploadContext.setSessionUserID(session.getUserName()); if (StringUtils.isBlank(uploadContext.getComment())) @@ -386,6 +387,28 @@ public final class ExternalDataTable extends AbstractExternalDataBusinessObject } } + private void assertNoContainerDataSets(Map<DataStorePE, List<ExternalDataPE>> map) + { + Set<String> containerDataSets = new LinkedHashSet<String>(); + for (Map.Entry<DataStorePE, List<ExternalDataPE>> entry : map.entrySet()) + { + for (ExternalDataPE dataSet : entry.getValue()) + { + if (dataSet.isContainerDataSet()) + { + containerDataSets.add(dataSet.getCode()); + } + } + } + + if (false == containerDataSets.isEmpty()) + { + throw new UserFailureException( + "The following data sets are container data sets and cannot be uploaded to CIFEX. " + + containerDataSets); + } + } + private Map<DataStorePE, List<ExternalDataPE>> groupDataSetsByDataStores() { Map<DataStorePE, List<ExternalDataPE>> map =