Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api/src/org/labkey/api/data/NameGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.labkey.api.util.StringExpressionFactory;
import org.labkey.api.util.StringExpressionFactory.AbstractStringExpression.NullValueBehavior;
import org.labkey.api.util.StringExpressionFactory.FieldKeyStringExpression;
import org.labkey.api.util.StringUtilsLabKey;
import org.labkey.api.util.SubstitutionFormat;

import java.io.IOException;
Expand Down Expand Up @@ -78,6 +79,7 @@
import java.util.stream.Stream;

import static org.labkey.api.exp.api.ExpMaterial.ALIQUOTED_FROM_INPUT;
import static org.labkey.api.exp.api.ExpMaterial.ALIQUOTED_FROM_INPUT_LABEL;
import static org.labkey.api.exp.api.ExpRunItem.INPUT_PARENT;
import static org.labkey.api.exp.api.ExperimentJSONConverter.DATA_INPUTS;
import static org.labkey.api.exp.api.ExperimentJSONConverter.MATERIAL_INPUTS;
Expand Down Expand Up @@ -739,6 +741,15 @@ public static Stream<String> parentNames(Object value, String parentColName, TSV
if (StringUtils.isEmpty((valueStr).trim()))
return Stream.empty();

// GitHub Issue 827: Cannot aliquot samples where parent sample has a comma in the name AND the aliquot naming pattern references ancestor lineage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have the GitHub Issue reference here, but I think it would be better to explain in the text why there is special handling for ALIQUOTED_FROM here (you can get it from the PR rationale, but it takes an extra hop).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good reminder. I'll add the explanation in my other branch.

if (ALIQUOTED_FROM_INPUT.equalsIgnoreCase(parentColName) || ALIQUOTED_FROM_INPUT_LABEL.equalsIgnoreCase(parentColName))
{
boolean isQuoted = (valueStr.contains(",") || valueStr.contains("\n") || valueStr.contains("\r")) && (valueStr.startsWith("\"") && valueStr.endsWith("\""));
if (isQuoted)
valueStr = StringUtilsLabKey.unquoteString(valueStr).trim();
return Stream.of(valueStr);
}

// Issue 44841: The names of the parents may include commas, so we parse the set of parent names
// using TabLoader instead of just splitting on the comma.
boolean likelyAlreadyQuoted = valueStr.contains(",") || valueStr.contains("\n") || valueStr.contains("\r") || (valueStr.startsWith("\"") && valueStr.endsWith("\""));
Expand Down