From ae8190d6f234fb8e8ebd65ae3c2950145289ff53 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 7 Jun 2016 07:16:43 +0000 Subject: [PATCH] SSDM-3617: throw exception when neither archiving status nor present-in-archive flag specified SVN: 36637 --- .../bo/datasetlister/DatasetLister.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java index e2749b5f011..e2a78dc8a0d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java @@ -83,6 +83,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TrackingDataSetCriteria; import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetShareId; import ch.systemsx.cisd.openbis.generic.shared.translator.DataStoreTranslator; + import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -539,15 +540,23 @@ public class DatasetLister extends AbstractLister implements IDatasetLister List<DatasetRecord> dataSets = null; - if (archivingStatus != null && presentInArchive != null) + if (archivingStatus != null) { - dataSets = query.getDatasetsByDataStoreIdWithArchivingStatusAndPressentInArchive(dataStoreID, archivingStatus.name(), presentInArchive); - } else if (archivingStatus == null) + String statusAsString = archivingStatus.name(); + if (presentInArchive != null) + { + dataSets = query.getDatasetsByDataStoreIdWithArchivingStatusAndPressentInArchive(dataStoreID, + statusAsString, presentInArchive); + } else + { + dataSets = query.getDatasetsByDataStoreIdWithArchivingStatus(dataStoreID, statusAsString); + } + } else if (presentInArchive != null) { dataSets = query.getDatasetsByDataStoreIdWithPressentInArchive(dataStoreID, presentInArchive); - } else if (presentInArchive == null) + } else { - dataSets = query.getDatasetsByDataStoreIdWithArchivingStatus(dataStoreID, archivingStatus.name()); + throw new UserFailureException("Neither archiving status nor present in archive flag are specified."); } return orderByCode(enrichDatasets(dataSets, datasetFetchOptions)); -- GitLab