Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
c298fdc
quantity type prototype
labkey-matthewb Dec 20, 2024
37f9cb9
imports
labkey-matthewb May 15, 2025
60b2e5e
Merge remote-tracking branch 'origin/develop' into fb_quantity
labkey-matthewb May 20, 2025
127b97e
Merge remote-tracking branch 'origin/release24.11-SNAPSHOT' into 24.1…
labkey-matthewb May 20, 2025
0bea798
merge patch
labkey-matthewb May 20, 2025
345c146
merge patch
labkey-matthewb May 20, 2025
e37d898
java 17
labkey-matthewb May 20, 2025
4e19852
merge forward
labkey-matthewb May 20, 2025
0327635
update expected result
labkey-matthewb May 20, 2025
c344188
build problem
labkey-matthewb May 22, 2025
a09337c
I wasn't really planning on commiting this for a while. But this mak…
labkey-matthewb May 22, 2025
cedae1c
Merge branch 'develop' into fb_quantity
cnathe Aug 5, 2025
f2ed404
fixup after merge from develop
cnathe Aug 5, 2025
cecd9ac
Merge branch 'develop' into fb_quantity
cnathe Aug 12, 2025
eafbf25
Add QUANTITY_COLUMN_SUFFIX_TESTING experimental feature flag
cnathe Aug 12, 2025
c65b82b
Merge remote-tracking branch 'origin/develop' into fb_quantity
labkey-susanh Aug 13, 2025
cc7c908
Merge remote-tracking branch 'origin/develop' into fb_quantity
labkey-susanh Aug 14, 2025
7f1e3df
Add "unit" unit to reflect current usage and some minor helper methods
labkey-susanh Aug 14, 2025
c28adfb
Quantity.java unit tests
cnathe Aug 14, 2025
ae9d244
Set Unit enum base to "unit" and "ml"
cnathe Aug 14, 2025
8f2d333
fixup Quantity testFormat test case
cnathe Aug 14, 2025
dbe0f43
Unit.java unit tests and set ml base unit value as 1 instead of liter
cnathe Aug 14, 2025
c625828
Upgrade script to convert StoredAmount and Units and related aliquot …
labkey-susanh Aug 14, 2025
dca876c
comment update
labkey-susanh Aug 18, 2025
75c08e5
Add null check in `isCompatible`
labkey-susanh Aug 18, 2025
ad85c7b
compute aliquot total rollup in base units instead of display units
labkey-susanh Aug 18, 2025
6da4406
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 18, 2025
a9c4f5d
Move to next schema version
labkey-susanh Aug 18, 2025
49ec409
Add Nullable and NotNull annotations and getValidatedUnit method
labkey-susanh Aug 18, 2025
0a8c67b
Use Quantity Unit instead of Measurement.Unit
labkey-susanh Aug 18, 2025
993307f
Remove unused (converted) convertToDisplayUnits method
labkey-susanh Aug 18, 2025
854e1fb
Add some @NotNull and @Nullable annotations
labkey-susanh Aug 18, 2025
2db14d3
Add utility methods for getting Unit objects for sample types
labkey-susanh Aug 19, 2025
ee94d58
AliquotUnit not Units
labkey-susanh Aug 19, 2025
3b6fa65
Unit enum update to use capital "L" for amount units (to match curren…
cnathe Aug 19, 2025
b5c455d
Add hasUnit to Column
labkey-susanh Aug 19, 2025
4cc1900
make getStorageUnit public
labkey-susanh Aug 19, 2025
8d26696
Another 'of' variant and add getter for KindOfQuantity
labkey-susanh Aug 19, 2025
b478299
Merge
labkey-susanh Aug 19, 2025
640b5b7
Precision
labkey-susanh Aug 19, 2025
68a541d
Update conversion columns
labkey-susanh Aug 19, 2025
6947011
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 19, 2025
87eb659
Once more for the upgrade script
labkey-susanh Aug 19, 2025
31760ae
Convert enum table to ontology Unit enum
labkey-susanh Aug 19, 2025
2f7fc9e
Change capitalization for liter-based units
labkey-susanh Aug 19, 2025
d231635
rawUnit may already be a Unit type object
labkey-susanh Aug 19, 2025
5eed099
rawUnit may already be a Unit type object
labkey-susanh Aug 19, 2025
37d91ca
Handle null value
labkey-susanh Aug 19, 2025
2793f0f
Remove AmountDataColumn.java and UnitsDataColumn.java
cnathe Aug 20, 2025
fe5e847
Add ExpMaterialTableImpl SampleTypeAmountDisplayColumn and SampleType…
cnathe Aug 20, 2025
b583cc8
Unit unit needs precision too
labkey-susanh Aug 20, 2025
f1e3858
Add override of coerceTypes to handle amount and unit columns when no…
labkey-susanh Aug 20, 2025
26399ea
Merge branch 'fb_amountsAndUnits' of https://github.com/LabKey/platfo…
labkey-susanh Aug 20, 2025
dbeccf8
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 20, 2025
0059472
display unit as default for amount not base unit
labkey-susanh Aug 20, 2025
9a37168
null check
labkey-susanh Aug 20, 2025
8b3f0d4
Use label from enum
labkey-susanh Aug 21, 2025
942a972
Replace converted amount and unit values with raw values so audit dif…
labkey-susanh Aug 21, 2025
f526b87
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 21, 2025
4c5421d
Make pathway for provided values to be added to the audit log details…
labkey-susanh Aug 21, 2025
0b8c0d6
Data iterator updates for capturing provided values
labkey-susanh Aug 21, 2025
a719acc
Better handling for sample types without display units
labkey-susanh Aug 21, 2025
7343d50
Remove use of deprecated method
labkey-susanh Aug 21, 2025
8ddc67b
MEASUREMENT_UNITS_TABLE to use KindOfQuantity getCommonUnits()
cnathe Aug 22, 2025
0d572b8
Merge branch 'develop' into fb_amountsAndUnits
cnathe Aug 25, 2025
d2953de
tidying
labkey-susanh Aug 25, 2025
aeda361
Update logic for validating unit + amount columns
labkey-susanh Aug 25, 2025
f445d28
Merge branch 'fb_amountsAndUnits' of https://github.com/LabKey/platfo…
labkey-susanh Aug 25, 2025
39d42ae
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 26, 2025
91e9644
Remove defaulting to sample type display unit and add handling for de…
labkey-susanh Aug 26, 2025
07c7212
Merge branch 'develop' into fb_amountsAndUnits
cnathe Aug 26, 2025
09b050c
Update test values
labkey-susanh Aug 26, 2025
04f186e
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 27, 2025
8ac42db
Updates for providedData map to separate delta values to own map and …
labkey-susanh Aug 27, 2025
8de4c95
Remove unneeded code
labkey-susanh Aug 27, 2025
cd0d5c5
Remove Measurement.java
labkey-susanh Aug 28, 2025
acc81ef
Don't convert to base units if there is no display unit. Just store i…
labkey-susanh Aug 28, 2025
5cea82b
Supported measurement units error to only list those common/supported…
cnathe Aug 28, 2025
58908be
Clean up confirmAmountAndUnitsColumn and coerceTypes override
labkey-susanh Aug 28, 2025
0fefb41
Update tests
labkey-susanh Aug 28, 2025
32eedb0
Update error message text
labkey-susanh Aug 28, 2025
8281e80
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Aug 28, 2025
e6fee7d
Merge branch 'develop' into fb_amountsAndUnits
cnathe Aug 29, 2025
ca51150
Remove some fields from the audit logs details
labkey-susanh Sep 1, 2025
e4192a6
Don't update aliquot units if it's already in the base units
labkey-susanh Sep 1, 2025
502ac59
More refinement for aliquots
labkey-susanh Sep 1, 2025
0b213fd
Don't use TableSelector since it uses the display value
labkey-susanh Sep 2, 2025
6fedb23
Merge branch 'develop' into fb_amountsAndUnits
cnathe Sep 2, 2025
fccd939
Measurement enum -> Unit / KindOfQuantity
cnathe Sep 2, 2025
b619e0d
Convert units with alternate names to the standard base unit name
labkey-susanh Sep 2, 2025
399df09
Merge branch 'develop' into fb_amountsAndUnits
cnathe Sep 3, 2025
e02d2f4
DataGenerator to use KindOfQuantity getCommonUnits()
cnathe Sep 3, 2025
7de4eeb
SampleTypeAmountDisplayColumn fix for MSSQL rounding precision display
cnathe Sep 3, 2025
1162fdf
Remove unnecessary map
labkey-susanh Sep 3, 2025
aa27eff
Give Count kind a name
labkey-susanh Sep 3, 2025
39ed90d
Register conversion types before the Tests run and small update to ex…
labkey-susanh Sep 3, 2025
eda628a
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 3, 2025
6064ef7
Move upgrade script to avoid conflict with script from develop
labkey-susanh Sep 3, 2025
95a650a
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 3, 2025
688fbbc
StoredAmount column info to set default format for case without a sam…
cnathe Sep 3, 2025
bf2ce1e
Add some logging, casting, and use a string instead of a Unit
labkey-susanh Sep 3, 2025
a4ed106
Still more logging
labkey-susanh Sep 4, 2025
40205c9
remove TODOs that are done
cnathe Sep 4, 2025
4e033d0
Merge remote-tracking branch 'origin/fb_amountsAndUnits' into fb_amou…
labkey-susanh Sep 4, 2025
2cdff59
Use LogHelper
labkey-susanh Sep 4, 2025
dee53cd
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 4, 2025
530da89
check for label as well as name in isExpMaterialColumn
labkey-susanh Sep 4, 2025
b36f944
Remove TODO
labkey-susanh Sep 4, 2025
567fe58
Move transaction boundary
labkey-susanh Sep 4, 2025
1f58601
Still more logging
labkey-susanh Sep 4, 2025
5762ab4
Remove assert that calls convert and finds the wrong units
labkey-susanh Sep 4, 2025
6ff1c7c
Move to debug logging
labkey-susanh Sep 4, 2025
3685a62
Use prepared statement
labkey-susanh Sep 4, 2025
7a4e2ef
Remove some more logging
labkey-susanh Sep 5, 2025
dad5a0f
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 5, 2025
722d4c2
RawAmount and RawUnits should not be user-editable since they are dro…
labkey-susanh Sep 5, 2025
cf635bb
Use the sample's container for the upgrade audit event, if available,…
labkey-susanh Sep 8, 2025
9c02887
Rename scripts to make room for incoming
labkey-susanh Sep 8, 2025
6009e1d
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 8, 2025
40106bf
Update select statement to be more selective
labkey-susanh Sep 8, 2025
25d1462
Don't add an audit event if the only thing that is updated is the Ali…
labkey-susanh Sep 8, 2025
7b0026c
Add comment
labkey-susanh Sep 8, 2025
2ffa8f0
Update schema version
labkey-susanh Sep 8, 2025
94266b3
Set "RawAmount" column label to "Stored Amount" and "RawUnits" label …
cnathe Sep 8, 2025
a944205
Merge branch 'develop' into fb_amountsAndUnits
cnathe Sep 8, 2025
b633c68
queue lists of events if we're given lists of events
labkey-susanh Sep 8, 2025
0b6004d
Don't use the "unit" Unit for AliquotUnit if there isn't a unit, just…
labkey-susanh Sep 9, 2025
e979591
Use the unit of the first aliquot when there is no other unit indicator
labkey-susanh Sep 9, 2025
c60e2aa
Don't use base unit if there is no display unit.
labkey-susanh Sep 9, 2025
4e64f4a
Revert change to use a List in the eventQueue since we aren't using t…
labkey-susanh Sep 9, 2025
96dade4
Set default format for RawAmount column if none set, to match StoredA…
cnathe Sep 10, 2025
c7421c6
Merge branch 'develop' into fb_amountsAndUnits
cnathe Sep 10, 2025
ae33a83
Remove RawAmount and RawUnits labels
cnathe Sep 10, 2025
9c2c0d0
rename ImportAliasable createImportMap to createImportSet
cnathe Sep 10, 2025
d4d5f1a
remove Unit.count from getCommonUnits()
cnathe Sep 11, 2025
38fbf77
SampleTypeUpdateServiceDI update to fix warning for requesting RawAmo…
cnathe Sep 11, 2025
4bcaedf
Clear cache after doing the update
labkey-susanh Sep 11, 2025
27cfd0e
Add space before units
labkey-susanh Sep 11, 2025
5c5c23f
Update user display for upgrade audit event
labkey-susanh Sep 11, 2025
c52712d
Merge branch 'fb_amountsAndUnits' of https://github.com/LabKey/platfo…
labkey-susanh Sep 11, 2025
4aa09bb
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 11, 2025
28919d5
Add a warning message if we don't see the expected number of audit en…
labkey-susanh Sep 12, 2025
a98e517
Constants and caching
labkey-susanh Sep 12, 2025
1e96b71
Merge remote-tracking branch 'origin/develop' into fb_amountsAndUnits
labkey-susanh Sep 12, 2025
aca2ff8
Add recommendation text
labkey-susanh Sep 12, 2025
f11af1e
Allow the property deletion to happen even from a GET page
labkey-susanh Sep 12, 2025
58ed496
Merge branch 'develop' into fb_amountsAndUnits
cnathe Sep 13, 2025
83dfcaf
switch to debug logging
labkey-susanh Sep 15, 2025
3dec37b
braces for better readability
labkey-susanh Sep 15, 2025
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
3 changes: 0 additions & 3 deletions api/src/org/labkey/api/ApiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
import org.labkey.api.data.dialect.JdbcMetaDataTest;
import org.labkey.api.data.dialect.ParameterSubstitutionTest;
import org.labkey.api.data.dialect.StandardDialectStringHandler;
import org.labkey.api.data.measurement.Measurement;
import org.labkey.api.dataiterator.CachingDataIterator;
import org.labkey.api.dataiterator.DataIteratorUtil;
import org.labkey.api.dataiterator.DiskCachingDataIterator;
Expand Down Expand Up @@ -411,8 +410,6 @@ public void registerServlets(ServletContext servletCtx)
LimitedUser.TestCase.class,
MarkableIterator.TestCase.class,
MaterializedQueryHelper.TestCase.class,
Measurement.TestCase.class,
Measurement.Unit.TestCase.class,
MemTracker.TestCase.class,
ModuleContext.TestCase.class,
ModuleDependencySorter.TestCase.class,
Expand Down
22 changes: 12 additions & 10 deletions api/src/org/labkey/api/audit/AbstractAuditHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ public void addSummaryAuditEvent(User user, Container c, TableInfo table, QueryS

/**
* Create a detailed audit record object so it can be recorded in the audit tables
* @param user making change
* @param c container containing auditable data
* @param tInfo Auditable tableInfo containing auditable record
* @param action being performed
* @param userComment Comment provided by the user explaining reason for change. NOTE: This value is generally not currently supported by many audit logging domains, and may be ignored.
* @param row map of new data values
* @param existingRow map of data values
* @param user making change
* @param c container containing auditable data
* @param tInfo Auditable tableInfo containing auditable record
* @param action being performed
* @param userComment Comment provided by the user explaining reason for change. NOTE: This value is generally not currently supported by many audit logging domains, and may be ignored.
* @param row map of new data values
* @param existingRow map of data values
* @param providedValues map of values provided by the user before conversion (e.g., for quantity values)
* @return DetailedAuditTypeEvent object describing audit record (NOTE: not committed to DB yet)
*/
protected abstract DetailedAuditTypeEvent createDetailedAuditRecord(User user, Container c, AuditConfigurable tInfo, QueryService.AuditAction action, @Nullable String userComment, @Nullable Map<String, Object> row, Map<String, Object> existingRow);
protected abstract DetailedAuditTypeEvent createDetailedAuditRecord(User user, Container c, AuditConfigurable tInfo, QueryService.AuditAction action, @Nullable String userComment, @Nullable Map<String, Object> row, Map<String, Object> existingRow, Map<String, Object> providedValues);

/**
* Allow for adding fields that may be present in the updated row but not represented in the original row
Expand All @@ -69,7 +70,7 @@ protected void addDetailedModifiedFields(Map<String, Object> originalRow, Map<St
}

@Override
public void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action, List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows, boolean useTransactionAuditCache)
public void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action, List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows, @Nullable List<Map<String, Object>> providedValues, boolean useTransactionAuditCache)
{
if (table.supportsAuditTracking())
{
Expand Down Expand Up @@ -119,7 +120,8 @@ public void addAuditEvent(User user, Container c, TableInfo table, @Nullable Aud
{
Map<String, Object> row = rows.get(i);
Map<String, Object> existingRow = null == existingRows ? Collections.emptyMap() : existingRows.get(i);
DetailedAuditTypeEvent event = createDetailedAuditRecord(user, c, auditConfigurable, action, userComment, row, existingRow);
Map<String, Object> providedValueRow = null == providedValues || providedValues.size() <= i ? null : providedValues.get(i);
DetailedAuditTypeEvent event = createDetailedAuditRecord(user, c, auditConfigurable, action, userComment, row, existingRow, providedValueRow);

switch (action)
{
Expand Down
16 changes: 13 additions & 3 deletions api/src/org/labkey/api/audit/AuditHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@

public interface AuditHandler
{
String PROVIDED_DATA_PREFIX = ":::provided:::";
String DELTA_PROVIDED_DATA_PREFIX = ":::delta_provided:::";

void addSummaryAuditEvent(User user, Container c, TableInfo table, QueryService.AuditAction action, Integer dataRowCount, @Nullable AuditBehaviorType auditBehaviorType, @Nullable String userComment);

default void addSummaryAuditEvent(User user, Container c, TableInfo table, QueryService.AuditAction action, Integer dataRowCount, @Nullable AuditBehaviorType auditBehaviorType, @Nullable String userComment, boolean skipAuditLevelCheck)
Expand All @@ -40,13 +43,20 @@ default void addSummaryAuditEvent(User user, Container c, TableInfo table, Query
}

void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action,
@Nullable List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows, boolean useTransactionAuditCache);
@Nullable List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows, @Nullable List<Map<String, Object>> providedValues, boolean useTransactionAuditCache);

/* In the case of update the 'existingRows' is the 'before' version of the record. Caller is not expected to provide existingRows without rows. */
default void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action,
@Nullable List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows)
{
addAuditEvent(user, c, table, auditType, userComment, action, rows, existingRows, null, false);
}

/* In the case of update the 'existingRows' is the 'before' version of the record. Caller is not expected to provide existingRows without rows. */
default void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action,
@Nullable List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows)
@Nullable List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> existingRows, @Nullable List<Map<String, Object>> providedValues)
{
addAuditEvent(user, c, table, auditType, userComment, action, rows, existingRows, false);
addAuditEvent(user, c, table, auditType, userComment, action, rows, existingRows, providedValues, false);
}


Expand Down
11 changes: 10 additions & 1 deletion api/src/org/labkey/api/audit/SampleTimelineAuditEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@
import java.util.Map;
import java.util.Set;

import static org.labkey.api.audit.AuditHandler.DELTA_PROVIDED_DATA_PREFIX;
import static org.labkey.api.audit.AuditHandler.PROVIDED_DATA_PREFIX;
import static org.labkey.api.exp.query.ExpMaterialTable.Column.StoredAmount;
import static org.labkey.api.exp.query.ExpMaterialTable.Column.Units;

public class SampleTimelineAuditEvent extends DetailedAuditTypeEvent
{
public static final String EVENT_TYPE = "SampleTimelineEvent";

public static final String SAMPLE_TIMELINE_EVENT_TYPE = "SampleTimelineEventType";
public static final String AMOUNT_AND_UNIT_UPGRADE_COMMENT = "Storage amount unit conversion to base unit during upgrade script.";

public static final Set<String> EXCLUDED_DETAIL_FIELDS = Set.of("AvailableAliquotVolume", "AvailableAliquotCount", "AliquotCount", "AliquotVolume", "AliquotUnit");
public static final Set<String> EXCLUDED_DETAIL_FIELDS = Set.of(
"AvailableAliquotVolume", "AvailableAliquotCount", "AliquotCount", "AliquotVolume", "AliquotUnit",
PROVIDED_DATA_PREFIX + StoredAmount.name(), PROVIDED_DATA_PREFIX + Units.name(),
DELTA_PROVIDED_DATA_PREFIX + StoredAmount.name() + DELTA_PROVIDED_DATA_PREFIX + Units.name());

public enum SampleTimelineEventType
{
Expand Down
12 changes: 9 additions & 3 deletions api/src/org/labkey/api/data/EnumTableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
public class EnumTableInfo<EnumType extends Enum<EnumType>> extends VirtualTable<UserSchema>
{
protected final Class<EnumType> _enum;
protected final EnumSet<EnumType> _enumSet;
protected final EnumValueGetter<EnumType> _valueGetter;
protected final EnumRowIdGetter<EnumType> _rowIdGetter;
@Nullable protected String _schemaName;
Expand Down Expand Up @@ -93,6 +94,11 @@ public EnumTableInfo(Class<EnumType> e, UserSchema schema, EnumRowIdGetter<EnumT
this(e, schema, EnumType::toString, rowIdGetter, rowIdPK, description);
}

public EnumTableInfo(Class<EnumType> e, UserSchema schema, EnumValueGetter<EnumType> valueGetter, EnumRowIdGetter<EnumType> rowIdGetter, boolean rowIdPK, String description)
{
this(e, EnumSet.allOf(e), schema, valueGetter, rowIdGetter, rowIdPK, description);
}

/**
* Exposes an enum as a three column virtual table, using valueGetter to determine its value, rowIdGetter to determine rowId, and ordinal() as ordinal
* @param e class of the enum
Expand All @@ -102,11 +108,12 @@ public EnumTableInfo(Class<EnumType> e, UserSchema schema, EnumRowIdGetter<EnumT
* @param rowIdPK use the rowId as the key field, otherwise use value field
* @param description a description of this table and its uses for display in the schema browser
*/
public EnumTableInfo(Class<EnumType> e, UserSchema schema, EnumValueGetter<EnumType> valueGetter, EnumRowIdGetter<EnumType> rowIdGetter, boolean rowIdPK, String description)
public EnumTableInfo(Class<EnumType> e, EnumSet<EnumType> enumSet, UserSchema schema, EnumValueGetter<EnumType> valueGetter, EnumRowIdGetter<EnumType> rowIdGetter, boolean rowIdPK, String description)
{
super(schema.getDbSchema(), e.getSimpleName(), schema);
setDescription(description);
_enum = e;
_enumSet = enumSet;
_valueGetter = valueGetter;
_rowIdGetter = rowIdGetter;

Expand All @@ -131,8 +138,7 @@ public SQLFragment getFromSQL()
checkReadBeforeExecute();
SQLFragment sql = new SQLFragment();
String separator = "";
EnumSet<EnumType> enumSet = EnumSet.allOf(_enum);
for (EnumType e : enumSet)
for (EnumType e : _enumSet)
{
sql.append(separator);
separator = " UNION ";
Expand Down
19 changes: 19 additions & 0 deletions api/src/org/labkey/api/data/ImportAliasable.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
package org.labkey.api.data;

import org.labkey.api.collections.CaseInsensitiveHashMap;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.exp.MvColumn;
import org.labkey.api.view.template.PageConfig;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -45,6 +47,23 @@ public interface ImportAliasable

class Helper
{
/**
* Creates a set of the different possible aliases for import (name, label, import aliases) for a single column.
*/
public static <T extends ImportAliasable> Set<String> createImportSet(T property)
{
if (property == null)
return Collections.emptySet();

Set<String> aliases = new CaseInsensitiveHashSet();
aliases.add(property.getName());
if (property.getLabel() != null)
aliases.add(property.getLabel());
if (!property.getImportAliasSet().isEmpty())
aliases.addAll(property.getImportAliasSet());
return aliases;
}

/**
* Creates a mapping of many different possible names (actual name, label/caption, property URI, etc).
* for a column to the column itself. Useful to provide flexibility in how the data is labeled during imports.
Expand Down
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/TableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void addSummaryAuditEvent(User user, Container c, TableInfo table, QueryS
}

@Override
public void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action, List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> updatedRows, boolean useTransactionAuditCache)
public void addAuditEvent(User user, Container c, TableInfo table, @Nullable AuditBehaviorType auditType, @Nullable String userComment, QueryService.AuditAction action, List<Map<String, Object>> rows, @Nullable List<Map<String, Object>> updatedRows, @Nullable List<Map<String, Object>> providedValues, boolean useTransactionAuditCache)
{
}
}
Expand Down
14 changes: 5 additions & 9 deletions api/src/org/labkey/api/data/generator/DataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.labkey.api.data.TableInfo;
import org.labkey.api.data.TableSelector;
import org.labkey.api.data.dialect.SqlDialect;
import org.labkey.api.data.measurement.Measurement;
import org.labkey.api.dataiterator.DataIteratorBuilder;
import org.labkey.api.dataiterator.DetailedAuditLogDataIterator;
import org.labkey.api.dataiterator.MapDataIterator;
Expand All @@ -34,6 +33,8 @@
import org.labkey.api.exp.query.SamplesSchema;
import org.labkey.api.gwt.client.AuditBehaviorType;
import org.labkey.api.gwt.client.model.GWTPropertyDescriptor;
import org.labkey.api.ontology.KindOfQuantity;
import org.labkey.api.ontology.Unit;
import org.labkey.api.pipeline.CancelledException;
import org.labkey.api.pipeline.PipelineJob;
import org.labkey.api.qc.DataState;
Expand Down Expand Up @@ -76,12 +77,7 @@ public class DataGenerator<T extends DataGenerator.Config> implements ContainerU
private static final String SEARCH_FIELD_NAME = "Search";
private static final String USED_FIELD_NAME = "Used";
private static final List<String> UNITS = List.of("g", "mg", "kg", "uL", "mL", "L", "unit");
// TODO use KindOfQuantity
private static final Map<Measurement.Kind, List<String>> UNIT_KINDS = Map.of(
Measurement.Kind.Mass, List.of("g", "mg", "kg"),
Measurement.Kind.Count, List.of("units"),
Measurement.Kind.Volume, List.of("uL", "mL", "L")
);

private static final List<String> LABEL_COLORS = new ArrayList<>();
static {
LABEL_COLORS.add("#800000"); // maroon,
Expand Down Expand Up @@ -846,8 +842,8 @@ private static String getUnitsValue(ExpSampleType sampleType)
{
if (!StringUtils.isEmpty(sampleType.getMetricUnit()))
{
Measurement.Unit unit = Measurement.Unit.getUnit(sampleType.getMetricUnit());
units = randomIndex(UNIT_KINDS.get(unit.getKind()));
Unit unit = Unit.fromName(sampleType.getMetricUnit());
units = randomIndex(unit.getKindOfQuantity().getCommonUnits()).name();
}
else
units = randomIndex(UNITS);
Expand Down
131 changes: 0 additions & 131 deletions api/src/org/labkey/api/data/measurement/AmountDataColumn.java

This file was deleted.

Loading