diff --git a/elispotassay/src/org/labkey/elispot/query/ElispotAntigenDomainKind.java b/elispotassay/src/org/labkey/elispot/query/ElispotAntigenDomainKind.java index 2679439c2..7753d18b6 100644 --- a/elispotassay/src/org/labkey/elispot/query/ElispotAntigenDomainKind.java +++ b/elispotassay/src/org/labkey/elispot/query/ElispotAntigenDomainKind.java @@ -15,6 +15,7 @@ */ package org.labkey.elispot.query; +import org.jetbrains.annotations.NotNull; import org.labkey.api.assay.AssayDomainKind; import org.labkey.api.data.DbScope; import org.labkey.api.data.JdbcType; @@ -87,7 +88,7 @@ public String getStorageSchemaName() } @Override - public Set getReservedPropertyNames(Domain domain, User user) + public @NotNull Set getReservedPropertyNames(Domain domain, User user) { return getAssayReservedPropertyNames(); } diff --git a/luminex/src/org/labkey/luminex/LuminexAnalyteDomainKind.java b/luminex/src/org/labkey/luminex/LuminexAnalyteDomainKind.java index 5961f185a..4026119ea 100644 --- a/luminex/src/org/labkey/luminex/LuminexAnalyteDomainKind.java +++ b/luminex/src/org/labkey/luminex/LuminexAnalyteDomainKind.java @@ -15,10 +15,14 @@ */ package org.labkey.luminex; +import org.jetbrains.annotations.NotNull; import org.labkey.api.assay.AssayDomainKind; +import org.labkey.api.collections.CaseInsensitiveHashSet; import org.labkey.api.exp.property.Domain; +import org.labkey.api.exp.property.DomainUtil; import org.labkey.api.security.User; +import java.util.List; import java.util.Set; /** @@ -27,6 +31,22 @@ */ public class LuminexAnalyteDomainKind extends AssayDomainKind { + private static final Set RESERVED_NAMES; + static { + RESERVED_NAMES = DomainUtil.getNamesAndLabels( + List.of("Name", + "FitProb", + "RegressionType", + "ResVar", + "StdCurve", + "MinStandardRecovery", + "MaxStandardRecovery", + LuminexDataHandler.POSITIVITY_THRESHOLD_COLUMN_NAME, + LuminexDataHandler.NEGATIVE_BEAD_COLUMN_NAME + ) + ); + RESERVED_NAMES.addAll(getAssayReservedPropertyNames()); + } public LuminexAnalyteDomainKind() { super(LuminexAssayProvider.ASSAY_DOMAIN_ANALYTE); @@ -39,27 +59,9 @@ public String getKindName() } @Override - public Set getReservedPropertyNames(Domain domain, User user) + public @NotNull Set getReservedPropertyNames(Domain domain, User user) { - Set result = getAssayReservedPropertyNames(); - result.add("Name"); - result.add("FitProb"); - result.add("Fit Prob"); - result.add("RegressionType"); - result.add("Regression Type"); - result.add("ResVar"); - result.add("Res Var"); - result.add("StdCurve"); - result.add("Std Curve"); - result.add("MinStandardRecovery"); - result.add("Min Standard Recovery"); - result.add("MaxStandardRecovery"); - result.add("Max Standard Recovery"); - result.add(LuminexDataHandler.POSITIVITY_THRESHOLD_COLUMN_NAME); - result.add(LuminexDataHandler.POSITIVITY_THRESHOLD_DISPLAY_NAME); - result.add(LuminexDataHandler.NEGATIVE_BEAD_COLUMN_NAME); - result.add(LuminexDataHandler.NEGATIVE_BEAD_DISPLAY_NAME); - return result; + return RESERVED_NAMES; } @Override diff --git a/luminex/src/org/labkey/luminex/LuminexDataDomainKind.java b/luminex/src/org/labkey/luminex/LuminexDataDomainKind.java index 84a6487d1..625941943 100644 --- a/luminex/src/org/labkey/luminex/LuminexDataDomainKind.java +++ b/luminex/src/org/labkey/luminex/LuminexDataDomainKind.java @@ -15,12 +15,16 @@ */ package org.labkey.luminex; +import org.jetbrains.annotations.NotNull; import org.labkey.api.assay.AssayDomainKind; +import org.labkey.api.collections.CaseInsensitiveHashSet; import org.labkey.api.exp.property.Domain; +import org.labkey.api.exp.property.DomainUtil; import org.labkey.api.security.User; import org.labkey.luminex.query.LuminexDataTable; import org.labkey.luminex.query.LuminexProtocolSchema; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -30,6 +34,22 @@ */ public class LuminexDataDomainKind extends AssayDomainKind { + public static final Set RESERVED_NAMES; + + static { + // Standard reserved names + Set names = new HashSet<>(getAssayReservedPropertyNames()); + // All from the basic Luminex data table + names.addAll(LuminexProtocolSchema.getTableInfoDataRow().getColumnNameSet()); + // Also reserve the aliased names of the columns + for (Map.Entry entry : LuminexDataTable.REMAPPED_SCHEMA_COLUMNS.entrySet()) + { + names.add(entry.getKey()); + names.add(entry.getValue()); + } + + RESERVED_NAMES = DomainUtil.getNamesAndLabels(names); + } public LuminexDataDomainKind() { super(LuminexAssayProvider.ASSAY_DOMAIN_CUSTOM_DATA); @@ -42,20 +62,8 @@ public String getKindName() } @Override - public Set getReservedPropertyNames(Domain domain, User user) + public @NotNull Set getReservedPropertyNames(Domain domain, User user) { - // Standard reserved names - Set result = getAssayReservedPropertyNames(); - - // All from the basic Luminex data table - result.addAll(LuminexProtocolSchema.getTableInfoDataRow().getColumnNameSet()); - - // Also reserve the aliased names of the columns - for (Map.Entry entry : LuminexDataTable.REMAPPED_SCHEMA_COLUMNS.entrySet()) - { - result.add(entry.getKey()); - result.add(entry.getValue()); - } - return result; + return RESERVED_NAMES; } } diff --git a/nab/src/org/labkey/nab/query/NabVirusDomainKind.java b/nab/src/org/labkey/nab/query/NabVirusDomainKind.java index 5da55e90e..6bbd3f0d0 100644 --- a/nab/src/org/labkey/nab/query/NabVirusDomainKind.java +++ b/nab/src/org/labkey/nab/query/NabVirusDomainKind.java @@ -15,11 +15,14 @@ */ package org.labkey.nab.query; +import org.jetbrains.annotations.NotNull; import org.labkey.api.assay.AssayDomainKind; +import org.labkey.api.collections.CaseInsensitiveHashSet; import org.labkey.api.data.DbScope; import org.labkey.api.data.JdbcType; import org.labkey.api.data.PropertyStorageSpec; import org.labkey.api.exp.property.Domain; +import org.labkey.api.exp.property.DomainUtil; import org.labkey.api.security.User; import org.labkey.nab.NabAssayProvider; import org.labkey.nab.NabManager; @@ -27,12 +30,14 @@ import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; +import java.util.stream.Collectors; public class NabVirusDomainKind extends AssayDomainKind { public static final String VIRUS_LSID_COLUMN_NAME = "virusLsid"; public static final String DATLSID_COLUMN_NAME = "dataLsid"; private static final Set _baseFields; + private static final Set RESERVED_PROPERTY_NAMES; static { @@ -42,6 +47,8 @@ public class NabVirusDomainKind extends AssayDomainKind baseFields.add(new PropertyStorageSpec(DATLSID_COLUMN_NAME, JdbcType.VARCHAR)); _baseFields = Collections.unmodifiableSet(baseFields); + RESERVED_PROPERTY_NAMES = DomainUtil.getNamesAndLabels(_baseFields.stream().map(PropertyStorageSpec::getName).collect(Collectors.toSet())); + RESERVED_PROPERTY_NAMES.addAll(getAssayReservedPropertyNames()); } public NabVirusDomainKind() @@ -74,13 +81,8 @@ public String getStorageSchemaName() } @Override - public Set getReservedPropertyNames(Domain domain, User user) + public @NotNull Set getReservedPropertyNames(Domain domain, User user) { - Set names = getAssayReservedPropertyNames(); - - for (PropertyStorageSpec spec : getBaseProperties(domain)) - names.add(spec.getName()); - - return names; + return RESERVED_PROPERTY_NAMES; } }