Skip to content
Snippets Groups Projects
Commit cec8313e authored by kaloyane's avatar kaloyane
Browse files

[LMS-2104] prevent container datasets from being uploaded to CIFEX for now

SVN: 21179
parent ed4d3d68
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......
......@@ -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 =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment