From baf469fedd0c3e40179553882aac01cb14f07f3b Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Mon, 14 Sep 2009 13:50:30 +0000 Subject: [PATCH] LMS-1165 change method names in DataSetInformation and add setExperiment() SVN: 12580 --- .../etlserver/phosphonetx/ResultDataSetUploader.java | 12 +++++++++--- .../cisd/yeastx/etl/ML2DatabaseUploader.java | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java index 1aa3b88d088..a4e8829e7f4 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/etlserver/phosphonetx/ResultDataSetUploader.java @@ -79,13 +79,19 @@ class ResultDataSetUploader extends AbstractHandler { try { - Experiment experiment = getOrCreateExperiment(dataSetInfo.getExperiment().getPermId()); - Sample sample = getOrCreateSample(experiment, dataSetInfo.getSample().getPermId()); + Experiment experiment = getOrCreateExperiment(dataSetInfo.tryToGetExperiment().getPermId()); + ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample dataSetInfoSample = + dataSetInfo.tryToGetSample(); + if (dataSetInfoSample == null) + { + throw new UserFailureException("Missing sample in " + dataSetInfo); + } + Sample sample = getOrCreateSample(experiment, dataSetInfoSample.getPermId()); String referenceDatabase = summary.getSummaryHeader().getReferenceDatabase(); Database database = getOrGreateDatabase(referenceDatabase); DataSet ds = getOrCreateDataSet(experiment, sample, database, dataSetInfo.getDataSetCode()); - addToDatabase(ds, experiment, dataSetInfo.getSample().getGroup(), summary); + addToDatabase(ds, experiment, dataSetInfoSample.getGroup(), summary); if (errorMessages.length() == 0) { connection.commit(); diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java index fd08bd1749d..0ade461f3a4 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java @@ -115,7 +115,11 @@ public class ML2DatabaseUploader implements IDataSetUploader private DMDataSetDTO createBacklink(DataSetInformation dataSetInformation) { String datasetPermId = dataSetInformation.getDataSetCode(); - Sample sample = dataSetInformation.getSample(); + Sample sample = dataSetInformation.tryToGetSample(); + if (sample == null) + { + throw new EnvironmentFailureException("Missing sample in " + dataSetInformation); + } Experiment experiment = sample.getExperiment(); String experimentName = findExperimentName(experiment.getProperties()); String sampleName = findSampleName(sample.getProperties()); -- GitLab