Skip to content
Snippets Groups Projects
Commit 516369b8 authored by buczekp's avatar buczekp
Browse files

[LMS-1772] fixed multi-parent operations and comment in template

SVN: 18643
parent 88c75d3a
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
private static final long serialVersionUID = ServiceVersionHolder.VERSION;
public static final String SAMPLE_REGISTRATION_TEMPLATE_COMMENT =
"# The \"container\" and \"parents\" columns are optional, only one should be specified. "
"# 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"
+ "# If \"parents\" are provided, the registered sample will become a \"child\" of all specified samples.\n"
......@@ -156,7 +156,10 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa
: getParentsOrNull()[0];
}
/** @deprecated convenience method for tests - use {@link #setParents(String)} instead */
/**
* @deprecated kept for backward compatibility and used as a convenience method for tests - use
* {@link #setParents(String)} instead
*/
@Deprecated
@BeanProperty(label = PARENT, optional = true)
public final void setParentIdentifier(final String parent)
......
......@@ -93,7 +93,6 @@ class NewSampleParserObjectFactory extends AbstractParserObjectFactory<NewSample
return true;
}
@SuppressWarnings("deprecation")
@Override
public NewSample createObject(final String[] lineTokens) throws ParserException
{
......@@ -117,9 +116,24 @@ class NewSampleParserObjectFactory extends AbstractParserObjectFactory<NewSample
setProperties(newSample, lineTokens);
newSample
.setContainerIdentifier(StringUtils.trimToNull(newSample.getContainerIdentifier()));
if (newSample.getParentIdentifier() != null)
if (newSample.getParentsOrNull() != null)
{
newSample.setParentIdentifier(StringUtils.trimToNull(newSample.getParentIdentifier()));
List<String> parents = new ArrayList<String>();
for (String parent : newSample.getParentsOrNull())
{
String trimmedOrNull = StringUtils.trimToNull(parent);
if (trimmedOrNull != null)
{
parents.add(trimmedOrNull);
}
}
if (parents.size() == 0)
{
newSample.setParentsOrNull(null);
} else
{
newSample.setParentsOrNull(parents.toArray(new String[0]));
}
}
newSample.setExperimentIdentifier(StringUtils.trimToNull(newSample
.getExperimentIdentifier()));
......
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