Skip to content
Snippets Groups Projects
Commit 6fb8ec07 authored by cramakri's avatar cramakri
Browse files

LMS-2104 Add API support for creating container data sets.

SVN: 21346
parent 5d8ba064
No related branches found
No related tags found
No related merge requests found
......@@ -102,10 +102,10 @@ public interface IDataSet
* Set the data set type.
*/
public void setDataSetType(String dataSetTypeCode);
/**
* Returns the speed hint. If it hasn't been set by {@link #setSpeedHint(int)} the default
* value {@link Constants#DEFAULT_SPEED_HINT} will be returned.
* Returns the speed hint. If it hasn't been set by {@link #setSpeedHint(int)} the default value
* {@link Constants#DEFAULT_SPEED_HINT} will be returned.
*/
public int getSpeedHint();
......@@ -122,17 +122,29 @@ public interface IDataSet
/**
* Get the value for a property.
*/
String getPropertyValue(String propertyCode);
public String getPropertyValue(String propertyCode);
/**
* Set the value for a property.
*/
void setPropertyValue(String propertyCode, String propertyValue);
public void setPropertyValue(String propertyCode, String propertyValue);
/** Sets the parents of the dataset. */
void setParentDatasets(List<String> parentDatasetCodes);
public void setParentDatasets(List<String> parentDatasetCodes);
/** Sets the parents of the dataset. */
List<String> getParentDatasets();
/** Gets the parents of the dataset. */
public List<String> getParentDatasets();
// Methods relating to container data sets which contain other data sets
/** Return true if this data set contains other data sets. */
public boolean isContainerDataSet();
/**
* Get the codes for contained data sets. This is empty if {@link #isContainerDataSet()} returns
* false.
*/
public List<String> getContainedDataSetCodes();
/** Set the codes for contained data sets. */
public void setContainedDataSetCodes(List<String> containedDataSetCodes);
}
......@@ -29,6 +29,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewProject;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSpace;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewContainerDataSet;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewDataSet;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData;
import ch.systemsx.cisd.openbis.generic.shared.dto.NewProperty;
import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO;
......@@ -101,24 +103,32 @@ public class ConversionUtils
StorageFormat storageFormat, String dataFileRelativePath)
{
DataSetInformation dataSetInformation = registrationDetails.getDataSetInformation();
final NewExternalData data = new NewExternalData();
final NewExternalData data;
if (dataSetInformation.isContainerDataSet())
{
data = new NewContainerDataSet();
((NewContainerDataSet) data).setContainedDataSetCodes(dataSetInformation
.getContainedDataSetCodes());
} else
{
data = new NewDataSet();
data.setSpeedHint(dataSetInformation.getSpeedHint());
final BooleanOrUnknown isCompleteFlag = dataSetInformation.getIsCompleteFlag();
data.setComplete(isCompleteFlag);
data.setLocatorType(registrationDetails.getLocatorType());
data.setShareId(dataSetInformation.getShareId());
data.setLocation(dataFileRelativePath.substring(data.getShareId().length() + 1));
data.setFileFormatType(registrationDetails.getFileFormatType());
}
data.setUserId(dataSetInformation.getUploadingUserIdOrNull());
data.setUserEMail(dataSetInformation.tryGetUploadingUserEmail());
data.setExtractableData(dataSetInformation.getExtractableData());
data.setDataSetType(registrationDetails.getDataSetType());
data.setSpeedHint(dataSetInformation.getSpeedHint());
data.setFileFormatType(registrationDetails.getFileFormatType());
data.setMeasured(registrationDetails.isMeasuredData());
data.setDataStoreCode(dataStoreCode);
data.setExperimentIdentifierOrNull(dataSetInformation.getExperimentIdentifier());
data.setSampleIdentifierOrNull(dataSetInformation.getSampleIdentifier());
final BooleanOrUnknown isCompleteFlag = dataSetInformation.getIsCompleteFlag();
data.setComplete(isCompleteFlag);
data.setLocatorType(registrationDetails.getLocatorType());
data.setShareId(dataSetInformation.getShareId());
data.setLocation(dataFileRelativePath.substring(data.getShareId().length() + 1));
data.setStorageFormat(storageFormat);
List<NewProperty> newProperties =
......
......@@ -17,6 +17,8 @@
package ch.systemsx.cisd.etlserver.registrator.api.v1.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
......@@ -191,4 +193,23 @@ public class DataSet<T extends DataSetInformation> implements IDataSet
{
return registrationDetails.getDataSetInformation().getParentDataSetCodes();
}
public boolean isContainerDataSet()
{
return registrationDetails.getDataSetInformation().isContainerDataSet();
}
public List<String> getContainedDataSetCodes()
{
return Collections.unmodifiableList(registrationDetails.getDataSetInformation()
.getContainedDataSetCodes());
}
public void setContainedDataSetCodes(List<String> containedDataSetCodes)
{
ArrayList<String> newContainedDataSetCodes = new ArrayList<String>(containedDataSetCodes);
registrationDetails.getDataSetInformation().setContainedDataSetCodes(
newContainedDataSetCodes);
}
}
......@@ -17,6 +17,7 @@
package ch.systemsx.cisd.openbis.dss.generic.shared.dto;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -54,7 +55,7 @@ public class DataSetInformation implements Serializable
private IEntityProperty[] topSampleProperties = IEntityProperty.EMPTY_ARRAY;
private DataSetType dataSetType;
private int speedHint = ch.systemsx.cisd.openbis.generic.shared.Constants.DEFAULT_SPEED_HINT;
private String shareId;
......@@ -81,6 +82,8 @@ public class DataSetInformation implements Serializable
private BooleanOrUnknown isCompleteFlag = BooleanOrUnknown.U;
private List<String> containedDataSetCodes = new ArrayList<String>();
/**
* A subset of {@link NewExternalData} which gets set by the code extractor.
* <p>
......@@ -337,6 +340,21 @@ public class DataSetInformation implements Serializable
return extractableData.getDataSetProperties();
}
public List<String> getContainedDataSetCodes()
{
return containedDataSetCodes;
}
public void setContainedDataSetCodes(List<String> containedDataSetCodes)
{
this.containedDataSetCodes = containedDataSetCodes;
}
public boolean isContainerDataSet()
{
return false == containedDataSetCodes.isEmpty();
}
public final String describe()
{
if (experimentIdentifier == null)
......
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