From 1a5442352497b7315738ff1f82cb356da82e9b0b Mon Sep 17 00:00:00 2001 From: tpylak <tpylak> Date: Wed, 11 Nov 2009 13:13:17 +0000 Subject: [PATCH] LMS-1192 BatchDataSetHandler needs to support data sets without sample SVN: 13318 --- .../yeastx/etl/DatasetMappingResolver.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/DatasetMappingResolver.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/DatasetMappingResolver.java index 0caea447868..c542b5e385e 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/DatasetMappingResolver.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/DatasetMappingResolver.java @@ -21,6 +21,7 @@ import java.util.Properties; import org.apache.commons.io.FilenameUtils; +import ch.systemsx.cisd.bds.StringUtils; import ch.systemsx.cisd.common.collections.CollectionUtils; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; @@ -214,22 +215,29 @@ class DatasetMappingResolver { return false; } - String sampleCode = tryFigureSampleCode(mapping, log); ExperimentIdentifier experimentIdentifier = tryFigureExperimentIdentifier(mapping); + if (mapping.getSampleCodeOrLabel() == null && experimentIdentifier == null) + { + log.datasetMappingError(mapping, "neither sample nor experiment has been specified."); + return false; + } + String sampleCode = tryFigureSampleCode(mapping, log); if (sampleCode == null) { - // sample can be skipped only if experiment identifier is supplied - if (experimentIdentifier == null) + if (mapping.getSampleCodeOrLabel() != null) { - log.datasetMappingError(mapping, - "neither sample nor experiment has been specified."); - return false; - } else - { - return experimentExists(mapping, log, experimentIdentifier); + return false; // error has been already reported } + assert experimentIdentifier != null : "experimentIdentifier should be not null here"; + return experimentExists(mapping, log, experimentIdentifier); } else { + if (StringUtils.isBlank(mapping.getParentDataSetCodes()) == false) + { + log.datasetMappingError(mapping, + "when dataset is connected to a sample it cannot have parent datasets."); + return false; + } return sampleExistsAndBelongsToExperiment(mapping, log, sampleCode); } } -- GitLab