-
Notifications
You must be signed in to change notification settings - Fork 7
mvtc empty #7348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
mvtc empty #7348
Conversation
- JdbcType implements SimpleConvert - PropertyType implements SimpleConvert - ColumnInfo implements SimpleConvert - Unit implements SimpleConvert
- JdbcType implements SimpleConvert - PropertyType implements SimpleConvertmake JdbcType.CHAR.convert() consistent with JdbcType.VARCHAR - ColumnInfo implements SimpleConvert - Unit implements SimpleConvert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request consolidates column value conversion and required/non-empty validation logic across the codebase. The primary goals are to handle Array type validation correctly (where required means "cardinality() > 0" rather than "IS NOT NULL") and to ensure consistent conversion behavior for Multiple-choice text fields (converting null/"" to [] rather than null).
Changes:
- Introduces the
SimpleConvertinterface to unify conversion logic across JdbcType, PropertyType, Unit, and ColumnInfo - Consolidates conversion logic into
ColumnInfo.convert()instead of scatteredConvertUtils.convert()calls - Adds
JdbcType.isEmpty()method to properly validate required fields based on type-specific semantics - Adds
array_is_empty()SQL function for PostgreSQL to check array emptiness using cardinality
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| api/src/org/labkey/api/data/SimpleConvert.java | New interface defining conversion contract with optional performance optimization method |
| api/src/org/labkey/api/data/JdbcType.java | Implements SimpleConvert, adds isEmpty() method with Array-specific logic, refactors convert() methods |
| api/src/org/labkey/api/exp/PropertyType.java | Implements SimpleConvert, updates STRING/MULTI_LINE/XML_TEXT to convert empty strings to null |
| api/src/org/labkey/api/ontology/Unit.java | Implements SimpleConvert for Quantity conversion |
| api/src/org/labkey/api/data/ColumnRenderProperties.java | Adds SimpleConvert interface, refactors getConvertFn() to use new pattern |
| api/src/org/labkey/api/data/BaseColumnInfo.java | Implements getConvertFn() using ColumnRenderProperties.getDefaultConvertFn() |
| api/src/org/labkey/api/data/AbstractWrappedColumnInfo.java | Implements getConvertFn() delegation |
| api/src/org/labkey/api/exp/PropertyDescriptor.java | Implements getConvertFn() delegation |
| api/src/org/labkey/api/data/validator/RequiredValidator.java | Updated to use JdbcType parameter and isEmpty() method for validation |
| api/src/org/labkey/api/data/validator/ColumnValidators.java | Updated createRequiredValidator to pass JdbcType to RequiredValidator |
| api/src/org/labkey/api/dataiterator/SimpleTranslator.java | Refactored conversion columns to use ColumnInfo.convert(), removed PropertyConvertColumn classes |
| api/src/org/labkey/api/dataiterator/StandardDataIteratorBuilder.java | Updated to use simplified addConvertColumn signature |
| api/src/org/labkey/api/data/ConvertHelper.java | Added getSimpleConvert() factory method, updated DateFriendlyStringConverter to handle empty strings |
| api/src/org/labkey/api/data/TableViewForm.java | Refactored to use col.convert() instead of ConvertUtils.convert() |
| api/src/org/labkey/api/data/MultiChoice.java | Updated DisplayColumn to implement IMultiValuedDisplayColumn, improved rendering |
| api/src/org/labkey/api/query/*.java | Multiple query service classes updated to use col.convert() |
| experiment/src/org/labkey/experiment/api/*.java | Multiple experiment classes updated to use col.convert() or type.convert() |
| query/src/org/labkey/query/sql/Method.java | Added ArrayIsEmptyMethod for array_is_empty SQL function |
| api/src/org/labkey/api/webdav/WebdavResource.java | Added getSpringResource() helper method |
| api/webapp/WEB-INF/web.xml | Updated to Servlet 3.0 spec, added async-supported to filters |
| api/src/org/labkey/api/data/ColumnInfoTests.jsp | New test file for ColumnInfo.convert() integration testing |
| api/src/messages/Validation.properties | Fixed typo: "tyepMismatch" -> "typeMismatch" |
| core/src/org/labkey/core/CoreModule.java | Added ColumnInfoTests.jsp as integration test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Override | ||
| public URI getURI() throws IOException | ||
| { | ||
| // Nnot sure why getExceuteHref() takes a view context. We ay not need for the moment. |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are spelling errors in the comment. "Nnot" should be "Not", "getExceuteHref" should be "getExecuteHref", and "We ay" should be "We may".
| @Override | ||
| public InputStream getInputStream() throws IOException | ||
| { | ||
| // FileSTream.openInputStream() enforces one stream per instance, so don't use 'fs' |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the comment. "FileSTream" should be "FileStream".
| * A lot of this testing is redunant with lower-level unit testing, | ||
| * however, his till servers as a basic conversion smoke test. | ||
| * <p></p> | ||
| * In particualr, the PropertyType conversions are pretty | ||
| * redundant with ConvertHelper.convert() and JdbcType.convert() | ||
| * (PropertyType predates JdbcType), but there are some differenes |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple spelling errors in the comment: "redunant" should be "redundant", "his till servers" should be "this still serves", "particualr" should be "particular", and "differenes" should be "differences".
| * A lot of this testing is redunant with lower-level unit testing, | |
| * however, his till servers as a basic conversion smoke test. | |
| * <p></p> | |
| * In particualr, the PropertyType conversions are pretty | |
| * redundant with ConvertHelper.convert() and JdbcType.convert() | |
| * (PropertyType predates JdbcType), but there are some differenes | |
| * A lot of this testing is redundant with lower-level unit testing, | |
| * however, this still serves as a basic conversion smoke test. | |
| * <p></p> | |
| * In particular, the PropertyType conversions are pretty | |
| * redundant with ConvertHelper.convert() and JdbcType.convert() | |
| * (PropertyType predates JdbcType), but there are some differences |
| } final String name = col.getName(); | ||
|
|
||
|
|
||
|
|
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be orphaned code on line 1347. The variable declaration final String name = col.getName(); is defined but never used in this scope, and appears to be a remnant from refactoring. This dead code should be removed.
| } final String name = col.getName(); | |
| } |
| * use getConvertFn() e.g. | ||
| * var fn = col.getConvertFn(); | ||
| * while (...) | ||
| * var converted = fb.convert(val); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the example code comment. Line 16 shows fb.convert(val) but should be fn.convert(val) to match the variable name defined on line 14.
| * var converted = fb.convert(val); | |
| * var converted = fn.convert(val); |
| @Override | ||
| public URL getURL() throws IOException | ||
| { | ||
| // Nnot sure why getExceuteHref() takes a view context. We ay not need for the moment. |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are spelling errors in the comment. "Nnot" should be "Not", "getExceuteHref" should be "getExecuteHref", and "We ay" should be "We may".
Rationale
For Array type required does not mean "IS NOT NULL" it means "cardinality() > 0".
Also for Multiple-choice text we prefer that null/"" converts to [] not to null.
To help implement this we consolidate column conversion into ColumnInfo.convert() and required/non-empty checking into JdbcType.isEmpty().
Related Pull Requests
Changes