Skip to content
Snippets Groups Projects
Commit e1295b93 authored by felmer's avatar felmer
Browse files

LMS-2844 implemented

SVN: 24775
parent 97c420bb
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import net.lemnik.eodsql.DynamicTransactionQuery;
import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
import ch.systemsx.cisd.base.exceptions.InterruptedExceptionUnchecked;
......@@ -699,6 +700,19 @@ abstract class AbstractTransactionState<T extends DataSetInformation>
AtomicEntityOperationDetails<T> createEntityOperationDetails(
List<DataSetRegistrationInformation<T>> dataSetRegistrations)
{
for (DataSetRegistrationInformation<T> dataSetRegistrationInformation : dataSetRegistrations)
{
DataSetInformation dsInfo = dataSetRegistrationInformation.getDataSetInformation();
if (dsInfo.isLinkSample() == false)
{
// A storage processor might need the sample even though the data sets should
// not be linked to the sample because they are data sets of a container data
// set.
dsInfo.setSample(null);
dsInfo.setSampleCode(null);
dataSetRegistrationInformation.getExternalData().setSampleIdentifierOrNull(null);
}
}
List<NewSpace> spaceRegistrations = convertSpacesToBeRegistered();
List<NewProject> projectRegistrations = convertProjectsToBeRegistered();
......
......@@ -78,6 +78,8 @@ public class DataSetInformation implements Serializable
/** sample with properties, enriched with connected experiment with properties. */
private transient Sample sample;
private transient boolean linkSample = true;
private transient Experiment experiment;
......@@ -285,6 +287,16 @@ public class DataSetInformation implements Serializable
this.sampleCode = sampleCode;
}
public boolean isLinkSample()
{
return linkSample;
}
public void setLinkSample(boolean linkSample)
{
this.linkSample = linkSample;
}
public final String getDataSetCode()
{
return extractableData.getCode();
......
......@@ -40,6 +40,8 @@ public class ImageContainerDataSet extends DataSet<DataSetInformation> implement
private DataSet<ImageDataSetInformation> originalDataset;
private List<IDataSet> thumbnailDatasets = Collections.emptyList();
private boolean establishSampleLinkForContainedDataSets = false;
public ImageContainerDataSet(
DataSetRegistrationDetails<? extends DataSetInformation> registrationDetails,
......@@ -53,6 +55,16 @@ public class ImageContainerDataSet extends DataSet<DataSetInformation> implement
setPropertyValue(ScreeningConstants.ANALYSIS_PROCEDURE, analysisProcedure);
}
public void establishSampleLinkForContainedDataSets()
{
establishSampleLinkForContainedDataSets = true;
}
public boolean sampleLinkForContainedDataSetsShouldBeEstablished()
{
return establishSampleLinkForContainedDataSets;
}
public DataSet<ImageDataSetInformation> getOriginalDataset()
{
return originalDataset;
......@@ -80,10 +92,17 @@ public class ImageContainerDataSet extends DataSet<DataSetInformation> implement
if (originalDataset != null)
{
originalDataset.setSample(sampleOrNull);
originalDataset.getRegistrationDetails().getDataSetInformation()
.setLinkSample(establishSampleLinkForContainedDataSets);
}
for (IDataSet thumbnailDataset : thumbnailDatasets)
{
thumbnailDataset.setSample(sampleOrNull);
if (thumbnailDatasets instanceof DataSet)
{
((DataSet<?>) thumbnailDatasets).getRegistrationDetails().getDataSetInformation()
.setLinkSample(establishSampleLinkForContainedDataSets);
}
}
}
......
......@@ -33,4 +33,12 @@ public interface IImageDataSet extends IDataSet
/** Sets analysis procedure. Makes sense only for segmentation datasets. */
void setAnalysisProcedure(String analysisProcedure);
/**
* If this method is called the contained data sets (original data set and thumbnails) will
* automatically linked to the sample specified by
* {@link IDataSet#setSample(ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v1.ISampleImmutable)}.
* By default there will be no such links.
*/
void establishSampleLinkForContainedDataSets();
}
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