diff --git a/api/src/org/labkey/api/ontology/KindOfQuantity.java b/api/src/org/labkey/api/ontology/KindOfQuantity.java index e61bb42169a..55fac981bb5 100644 --- a/api/src/org/labkey/api/ontology/KindOfQuantity.java +++ b/api/src/org/labkey/api/ontology/KindOfQuantity.java @@ -3,6 +3,8 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; import java.util.List; @@ -39,7 +41,10 @@ public List getCommonUnits() @Override public List getCommonUnits() { - return List.of(Unit.blocks, Unit.bottles, Unit.boxes, Unit.cells, Unit.kits, Unit.packs, Unit.pieces, Unit.slides, Unit.tests, Unit.unit); + return Arrays.stream(Unit.values()) + .filter(u -> u.getKindOfQuantity() == KindOfQuantity.Count && u != Unit.count) + .sorted(Comparator.comparing(Unit::toString)) + .toList(); } }; diff --git a/api/src/org/labkey/api/ontology/Unit.java b/api/src/org/labkey/api/ontology/Unit.java index 3ac94482022..2388652b533 100644 --- a/api/src/org/labkey/api/ontology/Unit.java +++ b/api/src/org/labkey/api/ontology/Unit.java @@ -46,6 +46,18 @@ public enum Unit implements SimpleConvert bottles(KindOfQuantity.Count, unit, 1.0, 2, "bottles", Quantity.class, "bottle", "bottles"), + organisms(KindOfQuantity.Count, unit, 1.0, 2, "organisms", + Quantity.class, + "organism", "organisms"), + vials(KindOfQuantity.Count, unit, 1.0, 2, "vials", + Quantity.class, + "vial", "vials"), + tubes(KindOfQuantity.Count, unit, 1.0, 2, "tubes", + Quantity.class, + "tube", "tubes"), + syringes(KindOfQuantity.Count, unit, 1.0, 2, "syringes", + Quantity.class, + "syringe", "syringes"), mL(KindOfQuantity.Volume, null, 1e0, 6, "mL", Quantity.Volume_ml.class, @@ -130,7 +142,7 @@ public enum Unit implements SimpleConvert this.quantityClass = quantityClass; this.singular = singular; this.plural = plural; - this.otherNames = null==otherNames || otherNames.length==0 ? null : otherNames; + this.otherNames = null == otherNames || otherNames.length == 0 ? null : otherNames; } public boolean isBase() @@ -173,7 +185,8 @@ public String toString() return print; } - static final HashMap unitMap = new HashMap<>(Unit.values().length*10); + static final HashMap unitMap = new HashMap<>(Unit.values().length * 10); + static { for (Unit unit : Unit.values()) @@ -200,7 +213,7 @@ public static Unit fromName(@Nullable String unitName) } // don't assume multiplicative relation between units (e.g. Kelvin and Celsius) - static Function convertFn(Unit from, Unit to) + static Function convertFn(Unit from, Unit to) { if (from == to) return Function.identity(); @@ -214,7 +227,7 @@ public static double convert(double value, @NotNull Unit from, @NotNull Unit to) Quantity.LOG.debug("Converting value {} from {} to {}", value, from.name(), to.name()); if (from.base != to.base) throw new IllegalArgumentException("Can't convert " + from.name() + " to " + to.name()); - return from==to ? value : to.fromBaseUnitValue(from.toBaseUnitValue(value)); + return from == to ? value : to.fromBaseUnitValue(from.toBaseUnitValue(value)); } @Override diff --git a/api/src/org/labkey/api/workflow/WorkflowService.java b/api/src/org/labkey/api/workflow/WorkflowService.java index 2f0f710e585..ae114ce70a0 100644 --- a/api/src/org/labkey/api/workflow/WorkflowService.java +++ b/api/src/org/labkey/api/workflow/WorkflowService.java @@ -23,7 +23,12 @@ enum ActionType AssayImport("assay types", "Imported assay data"), DeriveSamples("derivation sample type parameters", "Derived samples"), AliquotSamples("aliquot sample type parameters", "Aliquot samples"), - PoolSamples("pooling sample type parameters", "Pooled samples"); + PoolSamples("pooling sample type parameters", "Pooled samples"), + AddToStorage("input parameters", "Added samples to storage"), + MoveInStorage("input parameters", "Moved samples to storage"), + CheckOut("input parameters", "Checked out samples"), + CheckIn("input parameters", "Checked in samples"), + RemoveFromStorage("sample status value", "Removed samples from storage"); private final String _inputDescription; private final String _auditMessage;