Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions api/src/org/labkey/api/exp/property/DomainUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,10 @@ public static ValidationException validateProperties(@Nullable Domain domain, @N

if (fieldNames.contains(alias))
addImportAliasErrors(exception, updates, fields, "Import alias '" + alias + "' on field" + (fields.size() == 1 ? " " : "s ") + names + " conflicts with a field name.");

// GH Issue 1474: 'Container' should not be allowed as valid Import Alias
if (reservedNames.contains(alias))
addImportAliasErrors(exception, updates, fields, "Import alias '" + alias + "' on field" + (fields.size() == 1 ? " " : "s ") + names + " conflicts with a reserved field name.");
});

return exception;
Expand Down
2 changes: 2 additions & 0 deletions experiment/src/org/labkey/experiment/ExperimentModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@ SELECT COUNT(DISTINCT DD.DomainURI) FROM
results.put("maxObjectObjectId", new SqlSelector(schema, "SELECT MAX(ObjectId) FROM exp.Object").getObject(Long.class));
results.put("maxMaterialRowId", new SqlSelector(schema, "SELECT MAX(RowId) FROM exp.Material").getObject(Long.class));

results.put("domainFieldsWithContainerAlias", new SqlSelector(schema, "SELECT COUNT(*) FROM exp.propertydescriptor WHERE LOWER(importaliases) = 'container' OR importaliases ILIKE '%, container' OR importaliases ILIKE 'container, %' OR importaliases ILIKE '%, container, %'").getObject(Long.class));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we confident enough that these will be separated by , ? DomainUtil is tolerant of a variety of separators, including, spaces ,semicolons, and commas with no spaces.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Based on ColumnRenderPropertiesImpl.convertToString, ", " is the only delimiter when saving to DB. The parser is more lenient and accepts semicolon, space, tab, etc. It's an unlikely scenario that Container will be used in a multi alias setting that bypasses the default save. The risk of under reporting here is probably acceptable.


results.putAll(ExperimentService.get().getDomainMetrics());

return results;
Expand Down