Skip to content

Commit a696506

Browse files
committed
Revert SampleNameGeneratorState
1 parent 1ecf26b commit a696506

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

experiment/src/org/labkey/experiment/api/SampleTypeUpdateServiceDI.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,18 +1989,25 @@ public String nextName(Map<String, Object> map,
19891989
@Nullable Set<ExpMaterial> parentSamples,
19901990
@Nullable List<Supplier<Map<String, Object>>> _extraPropsFns) throws NameGenerator.NameGenerationException
19911991
{
1992-
boolean isAliquot = (boolean) map.getOrDefault(ALIQUOT_FROM_IS_ALIQUOT, false);
1993-
if (isAliquot)
1992+
String aliquotedFrom = null;
1993+
Object aliquotedFromObj = map.get(ExpMaterial.ALIQUOTED_FROM_INPUT);
1994+
if (aliquotedFromObj != null)
19941995
{
1995-
// Issue 53153: When a name has been resolved for the aliquot,
1996-
// then use that instead of the supplied value for AliquotedFrom.
1997-
Object name = map.get(ALIQUOT_FROM_RESOLVED_NAME);
1998-
if (name instanceof String aliquotParentName)
1999-
map.put(ExpMaterial.ALIQUOTED_FROM_INPUT, aliquotParentName);
2000-
else if (name instanceof List<?> nameList)
2001-
map.put(ExpMaterial.ALIQUOTED_FROM_INPUT, nameList.get(0));
1996+
if (aliquotedFromObj instanceof String)
1997+
{
1998+
// Issue 45563: We need the AliquotedFrom name to be quoted so we can properly find the parent,
1999+
// but we don't want to include the quotes in the name we generate using AliquotedFrom
2000+
aliquotedFrom = StringUtilsLabKey.unquoteString((String) aliquotedFromObj).trim();
2001+
map.put(ExpMaterial.ALIQUOTED_FROM_INPUT, aliquotedFrom);
2002+
}
2003+
else if (aliquotedFromObj instanceof Number)
2004+
{
2005+
aliquotedFrom = aliquotedFromObj.toString();
2006+
}
20022007
}
20032008

2009+
boolean isAliquot = !StringUtils.isEmpty(aliquotedFrom);
2010+
20042011
String generatedName = null;
20052012
if (isAliquot && aliquotNameGenerator != null)
20062013
generatedName = nextName(map, parentDatas, parentSamples, _extraPropsFns, aliquotNameGenerator);

0 commit comments

Comments
 (0)