Skip to content
Snippets Groups Projects
Commit 1a544235 authored by tpylak's avatar tpylak
Browse files

LMS-1192 BatchDataSetHandler needs to support data sets without sample

SVN: 13318
parent 0c0c04bc
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ import java.util.Properties; ...@@ -21,6 +21,7 @@ import java.util.Properties;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import ch.systemsx.cisd.bds.StringUtils;
import ch.systemsx.cisd.common.collections.CollectionUtils; import ch.systemsx.cisd.common.collections.CollectionUtils;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException;
...@@ -214,22 +215,29 @@ class DatasetMappingResolver ...@@ -214,22 +215,29 @@ class DatasetMappingResolver
{ {
return false; return false;
} }
String sampleCode = tryFigureSampleCode(mapping, log);
ExperimentIdentifier experimentIdentifier = tryFigureExperimentIdentifier(mapping); 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) if (sampleCode == null)
{ {
// sample can be skipped only if experiment identifier is supplied if (mapping.getSampleCodeOrLabel() != null)
if (experimentIdentifier == null)
{ {
log.datasetMappingError(mapping, return false; // error has been already reported
"neither sample nor experiment has been specified.");
return false;
} else
{
return experimentExists(mapping, log, experimentIdentifier);
} }
assert experimentIdentifier != null : "experimentIdentifier should be not null here";
return experimentExists(mapping, log, experimentIdentifier);
} else } 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); return sampleExistsAndBelongsToExperiment(mapping, log, sampleCode);
} }
} }
......
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