Skip to content
Snippets Groups Projects
Commit de498d66 authored by gpawel's avatar gpawel
Browse files

LMS-2494 Flexible import/upload: DEFAULT_CONTAINER -> CURRENT_CONTAINER

SVN: 22793
parent a8f821b6
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
"# The \"container\" and \"parents\" columns are optional, only one should be specified.\n"
+ "# \"container\" should contain a sample identifier, e.g. /SPACE/SAMPLE_1, while \"parents\" should contain comma separated list of sample identifiers. \n"
+ "# If \"container\" sample is provided, the registered sample will become a \"component\" of it.\n"
+ "# The column \"container\" has an alias \"default_container\", which has a different meaning when samples are updated.\n"
+ "# The column \"container\" has an alias \"current_container\", which has a different meaning when samples are updated.\n"
+ "# If \"parents\" are provided, the registered sample will become a \"child\" of all specified samples.\n";
public static String WITH_EXPERIMENTS_COMMENT =
......@@ -46,7 +46,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
public static final String CONTAINER = "container";
public static final String DEFAULT_CONTAINER = "default_container";
public static final String CURRENT_CONTAINER = "current_container";
public static final String PARENT = "parent";
......@@ -70,10 +70,10 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
private String containerIdentifier;
/**
* The default container identifier. Used only if the sample identifier does not have the
* The current container identifier. Used only if the sample identifier does not have the
* container specified. In such a case it will be assumed that the sample is in that container.
*/
private String defaultContainerIdentifier;
private String currentContainerIdentifier;
/**
* The experiment identifier.
......@@ -119,14 +119,14 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
public NewSample(final String identifier, SampleType sampleType, String containerIdentifier,
String[] parentsOrNull, String experimentIdentifier, String defaultSpaceIdentifier,
String defaultContainerIdentifier, IEntityProperty[] properties,
String currentContainerIdentifier, IEntityProperty[] properties,
List<NewAttachment> attachments)
{
this(identifier, sampleType, containerIdentifier);
this.parentsOrNull = parentsOrNull;
this.experimentIdentifier = experimentIdentifier;
this.setDefaultSpaceIdentifier(defaultSpaceIdentifier);
this.defaultContainerIdentifier = defaultContainerIdentifier;
this.currentContainerIdentifier = currentContainerIdentifier;
this.properties = properties;
this.attachments = attachments;
}
......@@ -213,15 +213,15 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
this.containerIdentifier = StringUtils.trimToNull(container);
}
public final String getDefaultContainerIdentifier()
public final String getCurrentContainerIdentifier()
{
return defaultContainerIdentifier;
return currentContainerIdentifier;
}
@BeanProperty(label = DEFAULT_CONTAINER, optional = true)
public final void setDefaultContainerIdentifier(final String defaultContainer)
@BeanProperty(label = CURRENT_CONTAINER, optional = true)
public final void setCurrentContainerIdentifier(final String currentContainerIdentifier)
{
this.defaultContainerIdentifier = StringUtils.trimToNull(defaultContainer);
this.currentContainerIdentifier = StringUtils.trimToNull(currentContainerIdentifier);
}
public String getExperimentIdentifier()
......@@ -274,7 +274,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
public String getContainerIdentifierForNewSample()
{
return defaultContainerIdentifier != null ? defaultContainerIdentifier
return currentContainerIdentifier != null ? currentContainerIdentifier
: containerIdentifier;
}
......@@ -304,10 +304,10 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
final NewSample that = (NewSample) obj;
final String thisCombinedIdentifier =
StringUtils.emptyIfNull(this.getDefaultSpaceIdentifier()) + this.getIdentifier()
+ getContainerIdentifier() + getDefaultContainerIdentifier();
+ getContainerIdentifier() + getCurrentContainerIdentifier();
final String thatCombinedIdentifier =
StringUtils.emptyIfNull(this.getDefaultSpaceIdentifier()) + that.getIdentifier()
+ that.getContainerIdentifier() + that.getDefaultContainerIdentifier();
+ that.getContainerIdentifier() + that.getCurrentContainerIdentifier();
return thisCombinedIdentifier.equals(thatCombinedIdentifier);
}
}
......@@ -36,7 +36,7 @@ public final class UpdatedSample extends NewSample
+ "# The \"parent\" column (if not removed) should contain comma separated list of sample identifiers, e.g. /SPACE/SAMPLE_1,/SPACE/SAMPLE_2\n"
+ "# The \"experiment\" column (if not removed) should contain experiment identifier, e.g. /SPACE/PROJECT/EXP_1\n"
+ "# The \"default_space\" column is optional, it can be used to override home space for the row\n"
+ "# The \"default_container\" column is optional, it can be used to specify container where the updated sample belongs before the update\n";
+ "# The \"current_container\" column is optional, it can be used to specify container where the updated sample belongs before the update\n";
private SampleBatchUpdateDetails batchUpdateDetails;
......@@ -45,7 +45,7 @@ public final class UpdatedSample extends NewSample
super(newSample.getIdentifier(), newSample.getSampleType(), newSample
.getContainerIdentifier(), newSample.getParentsOrNull(), newSample
.getExperimentIdentifier(), newSample.getDefaultSpaceIdentifier(), newSample
.getDefaultContainerIdentifier(), newSample.getProperties(), newSample
.getCurrentContainerIdentifier(), newSample.getProperties(), newSample
.getAttachments());
this.batchUpdateDetails = batchUpdateDetails;
}
......
......@@ -49,7 +49,7 @@ public final class SampleIdentifierFactory extends AbstractIdentifierFactory
String defaultSpace = sample.getDefaultSpaceIdentifier();
SampleIdentifier identifier = factory.createIdentifier(defaultSpace);
// if the container for the new sample is not specified then use the default (if provided)
String defaultContainer = sample.getDefaultContainerIdentifier();
String defaultContainer = sample.getCurrentContainerIdentifier();
if (identifier.tryGetContainerCode() == null
&& StringUtils.isEmpty(defaultContainer) == false)
{
......
......@@ -78,10 +78,10 @@ public class SampleRegisterOrUpdateUtil
{
String newSampleContainerCode = newSampleIdentifier.tryGetContainerCode();
String newSampleContainerSpace = newSample.getDefaultSpaceIdentifier();
if (newSampleContainerCode == null && newSample.getDefaultContainerIdentifier() != null)
if (newSampleContainerCode == null && newSample.getCurrentContainerIdentifier() != null)
{
SampleIdentifier newSampleContainerIdentifier =
SampleIdentifierFactory.parse(newSample.getDefaultContainerIdentifier(),
SampleIdentifierFactory.parse(newSample.getCurrentContainerIdentifier(),
newSample.getDefaultSpaceIdentifier());
newSampleContainerCode = newSampleContainerIdentifier.getSampleSubCode();
newSampleContainerSpace = tryGetSpaceCode(newSampleContainerIdentifier);
......
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