From e7909e661725dfb49e3bf2a9eb9165e09fd97a70 Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Fri, 28 Sep 2012 10:32:54 +0000 Subject: [PATCH] BIS-170 / SP-279: Changing the owner of dataset from sample to experiment is impossible in the U SVN: 26840 --- .../openbis/generic/server/business/bo/DataBO.java | 1 + .../openbis/systemtest/AssignDataSetToSampleTest.java | 11 +++++++++++ .../systemtest/base/builder/DataSetUpdateBuilder.java | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java index 452982a7351..38de735ff84 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java @@ -567,6 +567,7 @@ public class DataBO extends AbstractDataSetBusinessObject implements IDataBO updateSample(data, updates.getSampleIdentifierOrNull()); } else { + data.setSample(null); updateExperiment(data, updates.getExperimentIdentifierOrNull()); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java index 93267bcab1c..1612093c9b1 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java @@ -196,6 +196,17 @@ public class AssignDataSetToSampleTest extends BaseTest assertThat(component, is(inSample(sourceSample))); } + @Test + public void dataSetCanBeUnassignedFromSample() throws Exception + { + ExternalData data = create(aDataSet().inSample(sourceSample)); + + perform(anUpdateOf(data).removingSample()); + + assertThat(data, hasNoSample()); + assertThat(data, is(inExperiment(sourceExperiment))); + } + Space unrelatedAdmin; Space unrelatedObserver; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java index 4a277035ced..4f6e3337111 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java @@ -102,6 +102,12 @@ public class DataSetUpdateBuilder extends UpdateBuilder<DataSetUpdatesDTO> return this; } + public DataSetUpdateBuilder removingSample() + { + this.sampleIdentifier = null; + return this; + } + public DataSetUpdateBuilder withContainer(ExternalData dataSet) { this.containerCode = dataSet.getCode(); -- GitLab