From c84add7a39c051bb02cda73caacbdd7155186526 Mon Sep 17 00:00:00 2001 From: Matthew Bellew Date: Wed, 3 Apr 2019 18:22:53 -0700 Subject: [PATCH 1/2] checkpoint for immutable TableInfo (set ContainerFilter at construct time) --- TODO_ContainerFilter.md | 38 +++++ .../org/labkey/elisa/ElisaProtocolSchema.java | 5 +- .../labkey/elisa/query/ElisaResultsTable.java | 7 +- .../labkey/elispot/ElispotProtocolSchema.java | 13 +- .../labkey/elispot/ElispotProviderSchema.java | 5 +- .../query/ElispotAntigenCrosstabTable.java | 1 + .../elispot/query/ElispotRunAntigenTable.java | 9 +- .../elispot/query/ElispotRunDataTable.java | 16 +- .../query/PlateBasedAssayRunDataTable.java | 13 +- .../executescript/SamplesConfirmGridView.java | 15 +- .../importAnalysisReviewSamples.jsp | 2 +- .../org/labkey/flow/data/FlowProtocol.java | 2 +- .../labkey/flow/data/FlowProtocolSchema.java | 14 +- .../persist/FlowKeywordAuditProvider.java | 5 +- .../flow/query/AttributeForeignKey.java | 8 +- .../flow/query/BackgroundForeignKey.java | 2 +- .../src/org/labkey/flow/query/FlowSchema.java | 97 ++++++----- .../labkey/flow/query/GraphForeignKey.java | 5 +- .../labkey/flow/query/KeywordForeignKey.java | 2 +- .../flow/query/StatisticForeignKey.java | 4 +- .../labkey/luminex/LuminexDataHandler.java | 12 +- .../org/labkey/luminex/LuminexManager.java | 2 +- .../model/AnalyteSinglePointControl.java | 2 +- .../query/AbstractCurveFitPivotTable.java | 9 +- .../luminex/query/AbstractExclusionTable.java | 7 +- .../luminex/query/AbstractLuminexTable.java | 4 +- .../query/AnalyteSinglePointControlTable.java | 15 +- .../labkey/luminex/query/AnalyteTable.java | 26 ++- .../luminex/query/AnalyteTitrationTable.java | 23 ++- .../labkey/luminex/query/CurveFitTable.java | 9 +- .../luminex/query/GuideSetCurveFitTable.java | 8 +- .../labkey/luminex/query/GuideSetTable.java | 18 +- .../luminex/query/LuminexDataTable.java | 25 +-- .../luminex/query/LuminexProtocolSchema.java | 148 ++++++++-------- .../luminex/query/RunExclusionTable.java | 12 +- .../query/SinglePointControlTable.java | 6 +- .../labkey/luminex/query/TitrationTable.java | 6 +- .../luminex/query/WellExclusionTable.java | 8 +- .../microarray/PendingMageMLFilesView.java | 2 +- .../affy/AffymetrixProtocolSchema.java | 11 +- .../assay/MicroarrayProtocolSchema.java | 5 +- .../ExpressionMatrixProtocolSchema.java | 13 +- .../microarray/matrix/FeatureDataTable.java | 26 ++- ms2/src/org/labkey/ms2/MS2Controller.java | 6 +- ...ProteinExpressionMatrixProtocolSchema.java | 43 ++--- .../ms2/matrix/ProteinSequenceDataTable.java | 51 +++--- .../MassSpecMetadataProtocolSchema.java | 9 +- .../QueryProteinGroupMS2RunView.java | 2 +- .../protein/query/CustomAnnotationTable.java | 5 +- .../ms2/protein/query/ProteinUserSchema.java | 29 ++-- .../query/CompareProteinProphetTableInfo.java | 6 +- .../ms2/query/FastaRunMappingTable.java | 13 +- ms2/src/org/labkey/ms2/query/MS2Schema.java | 160 +++++++++--------- .../labkey/ms2/query/PeptidesTableInfo.java | 7 +- .../ms2/query/ProteinGroupTableInfo.java | 23 ++- .../labkey/ms2/query/SequencesTableInfo.java | 28 ++- .../ms2/query/SpectraCountTableInfo.java | 8 +- .../org/labkey/nab/query/NabBaseTable.java | 17 +- .../nab/query/NabDilutionDataTable.java | 5 +- .../labkey/nab/query/NabProtocolSchema.java | 27 +-- .../labkey/nab/query/NabProviderSchema.java | 11 +- .../org/labkey/nab/query/NabRunDataTable.java | 19 ++- .../labkey/nab/query/NabVirusDataTable.java | 5 +- .../labkey/nab/query/NabWellDataTable.java | 10 +- .../viability/ViabilityAssaySchema.java | 47 ++--- .../labkey/viability/ViabilityManager.java | 3 +- 66 files changed, 639 insertions(+), 555 deletions(-) create mode 100644 TODO_ContainerFilter.md diff --git a/TODO_ContainerFilter.md b/TODO_ContainerFilter.md new file mode 100644 index 0000000000..28abf58d45 --- /dev/null +++ b/TODO_ContainerFilter.md @@ -0,0 +1,38 @@ +remove interface ContainerFilterable (migrate method to protected methods e.g. on FilteredTable) + +remove class DelegatingContainerFilter + +test ContainerFilter for ExperimentService.get().createQCFlagsTable + +SpecimenForeignKey calls to getSpecimenTableInfo(null) + +Find classes that override: +- UserSchema.createTable(String name) +- AssayProtocolSchema.createProviderTable(String name) +- AssayProtocolSchema.createDataTable(boolean includeCopiedToStudyColumns) +- AssayProtocolSchema.createRunsTable() + +convert schemas: ms2, study, annoucements, flow + +Find classes that use constructor +- SimpleTable(SchemaType schema, TableInfo table) + +Who is still depending on AbstractExpSchema.setupTable(T table) to set containerFilter??? + +LineageTableInfo + +More clean up of QueryForeignKey (Builder?) +More clean up of PdLookupForeignKey (.create()?) + +QueryDefinitionImpl.getTable() remove usage of deprecated method w/o ContainerFilter + +Issues.AllIssuesTable +IsuesTable.RelatedIssues lookup uses setFk() on locked table + +search for "TODO ContainerFilter" + +Check subclasses of LookupForeignKey. getLookupTableInfo() should use getLookupContainerFilter() + +update MultiValuedForeignKey to take CF, check usages of passed in FK to make sure they are configured with CF + +Check that subclasses of QueryView initialize ContainerFilter when they construct TableInfo \ No newline at end of file diff --git a/elisa/src/org/labkey/elisa/ElisaProtocolSchema.java b/elisa/src/org/labkey/elisa/ElisaProtocolSchema.java index dd464b049d..cd70e053fc 100644 --- a/elisa/src/org/labkey/elisa/ElisaProtocolSchema.java +++ b/elisa/src/org/labkey/elisa/ElisaProtocolSchema.java @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.query.FilteredTable; import org.labkey.api.security.User; @@ -36,8 +37,8 @@ public ElisaProtocolSchema(User user, Container container, @NotNull ElisaAssayPr } @Override - public FilteredTable createDataTable(boolean includeCopiedToStudyColumns) + public FilteredTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - return new ElisaResultsTable(this, includeCopiedToStudyColumns); + return new ElisaResultsTable(this, cf, includeCopiedToStudyColumns); } } diff --git a/elisa/src/org/labkey/elisa/query/ElisaResultsTable.java b/elisa/src/org/labkey/elisa/query/ElisaResultsTable.java index 812a9434b2..1e622d39bf 100644 --- a/elisa/src/org/labkey/elisa/query/ElisaResultsTable.java +++ b/elisa/src/org/labkey/elisa/query/ElisaResultsTable.java @@ -16,6 +16,7 @@ package org.labkey.elisa.query; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpSampleSet; import org.labkey.api.exp.api.ExperimentService; @@ -41,9 +42,9 @@ */ public class ElisaResultsTable extends AssayResultTable { - public ElisaResultsTable(final AssayProtocolSchema schema, boolean includeCopiedToStudyColumns) + public ElisaResultsTable(final AssayProtocolSchema schema, ContainerFilter cf, boolean includeCopiedToStudyColumns) { - super(schema, includeCopiedToStudyColumns); + super(schema, cf, includeCopiedToStudyColumns); List visibleColumns = new ArrayList<>(); @@ -65,7 +66,7 @@ public ElisaResultsTable(final AssayProtocolSchema schema, boolean includeCopied { public TableInfo getLookupTableInfo() { - ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema); + ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema, cf); // Make sure we are filtering to the same set of containers materials.setContainerFilter(getContainerFilter()); if (sampleSet != null) diff --git a/elispotassay/src/org/labkey/elispot/ElispotProtocolSchema.java b/elispotassay/src/org/labkey/elispot/ElispotProtocolSchema.java index 0baf120ca9..3fafb9adda 100644 --- a/elispotassay/src/org/labkey/elispot/ElispotProtocolSchema.java +++ b/elispotassay/src/org/labkey/elispot/ElispotProtocolSchema.java @@ -21,6 +21,7 @@ import org.labkey.api.data.ActionButton; import org.labkey.api.data.ButtonBar; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.CrosstabMember; import org.labkey.api.data.DataRegion; import org.labkey.api.data.TableInfo; @@ -75,26 +76,26 @@ public Set getTableNames() return names; } - public TableInfo createProviderTable(String name) + public TableInfo createProviderTable(String name, ContainerFilter cf) { if (name.equalsIgnoreCase(ANTIGEN_TABLE_NAME)) { Domain domain = AbstractAssayProvider.getDomainByPrefix(getProtocol(), ElispotAssayProvider.ASSAY_DOMAIN_ANTIGEN_WELLGROUP); if (null != domain) - return new ElispotRunAntigenTable(this, domain, getProtocol()); + return new ElispotRunAntigenTable(this, cf, domain, getProtocol()); } else if (name.equalsIgnoreCase(ANTIGEN_STATS_TABLE_NAME)) { - return ElispotAntigenCrosstabTable.create((ElispotRunAntigenTable) createProviderTable(ANTIGEN_TABLE_NAME), getProtocol(), this); + return ElispotAntigenCrosstabTable.create((ElispotRunAntigenTable) createProviderTable(ANTIGEN_TABLE_NAME, cf), getProtocol(), this); } - return super.createProviderTable(name); + return super.createProviderTable(name, cf); } @Override - public ElispotRunDataTable createDataTable(boolean includeCopiedToStudyColumns) + public ElispotRunDataTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - ElispotRunDataTable table = new ElispotRunDataTable(this, getProtocol()); + ElispotRunDataTable table = new ElispotRunDataTable(this, cf, getProtocol()); if (includeCopiedToStudyColumns) { addCopiedToStudyColumns(table, true); diff --git a/elispotassay/src/org/labkey/elispot/ElispotProviderSchema.java b/elispotassay/src/org/labkey/elispot/ElispotProviderSchema.java index e1e38bb14a..4fa75e5773 100644 --- a/elispotassay/src/org/labkey/elispot/ElispotProviderSchema.java +++ b/elispotassay/src/org/labkey/elispot/ElispotProviderSchema.java @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.EnumTableInfo; import org.labkey.api.data.TableInfo; import org.labkey.api.security.User; @@ -53,7 +54,7 @@ public Set getTableNames() } @Override - public TableInfo createTable(String name) + public TableInfo createTable(String name, ContainerFilter cf) { if (name.equalsIgnoreCase(ELISPOT_PLATE_READER_TABLE)) { @@ -69,6 +70,6 @@ public String getValue(ElispotAssayProvider.PlateReaderType e) return result; } - return super.createTable(name); + return super.createTable(name, cf); } } diff --git a/elispotassay/src/org/labkey/elispot/query/ElispotAntigenCrosstabTable.java b/elispotassay/src/org/labkey/elispot/query/ElispotAntigenCrosstabTable.java index fd9e85e278..24813752bd 100644 --- a/elispotassay/src/org/labkey/elispot/query/ElispotAntigenCrosstabTable.java +++ b/elispotassay/src/org/labkey/elispot/query/ElispotAntigenCrosstabTable.java @@ -116,6 +116,7 @@ public ElispotAntigenCrosstabTable(CrosstabSettings crosstabSettings, ArrayList< setTitle("AntigenStats"); } + @NotNull @Override public ContainerFilter getContainerFilter() { diff --git a/elispotassay/src/org/labkey/elispot/query/ElispotRunAntigenTable.java b/elispotassay/src/org/labkey/elispot/query/ElispotRunAntigenTable.java index 7b3e030819..fccfcb5aba 100644 --- a/elispotassay/src/org/labkey/elispot/query/ElispotRunAntigenTable.java +++ b/elispotassay/src/org/labkey/elispot/query/ElispotRunAntigenTable.java @@ -16,6 +16,7 @@ package org.labkey.elispot.query; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.JdbcType; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.TableInfo; @@ -41,9 +42,9 @@ */ public class ElispotRunAntigenTable extends PlateBasedAssayRunDataTable { - public ElispotRunAntigenTable(final AssaySchema schema, final Domain domain, ExpProtocol protocol) + public ElispotRunAntigenTable(final AssaySchema schema, ContainerFilter cf, final Domain domain, ExpProtocol protocol) { - super(schema, StorageProvisioner.createTableInfo(domain), protocol); + super(schema, StorageProvisioner.createTableInfo(domain), cf, protocol); setDescription("Contains one row per well for the \"" + protocol.getName() + "\" ELISpot assay design."); setTitle("Antigen"); this.setPublic(false); @@ -84,13 +85,13 @@ protected ColumnInfo resolveColumn(String name) // node can still be queried there. result = wrapColumn("Properties", getRealTable().getColumn("ObjectId")); result.setIsUnselectable(true); - LookupForeignKey fk = new LookupForeignKey("ObjectId") + LookupForeignKey fk = new LookupForeignKey(getContainerFilter(), "ObjectId", null) { @Override public TableInfo getLookupTableInfo() { Domain domain = AbstractAssayProvider.getDomainByPrefix(_protocol, ElispotAssayProvider.ASSAY_DOMAIN_ANTIGEN_WELLGROUP); - return new ElispotRunAntigenTable(_userSchema, domain, _protocol); + return new ElispotRunAntigenTable(_userSchema, getLookupContainerFilter(), domain, _protocol); } }; fk.setPrefixColumnCaption(false); diff --git a/elispotassay/src/org/labkey/elispot/query/ElispotRunDataTable.java b/elispotassay/src/org/labkey/elispot/query/ElispotRunDataTable.java index 781862e9a3..39f8f2dd91 100644 --- a/elispotassay/src/org/labkey/elispot/query/ElispotRunDataTable.java +++ b/elispotassay/src/org/labkey/elispot/query/ElispotRunDataTable.java @@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.DataColumn; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.DisplayColumnFactory; @@ -49,14 +50,14 @@ */ public class ElispotRunDataTable extends PlateBasedAssayRunDataTable { - public ElispotRunDataTable(final AssaySchema schema, final ExpProtocol protocol) + public ElispotRunDataTable(final AssaySchema schema, ContainerFilter cf, final ExpProtocol protocol) { - this(schema, ElispotManager.getTableInfoElispotRunData(), protocol); + this(schema, ElispotManager.getTableInfoElispotRunData(), cf, protocol); } - public ElispotRunDataTable(final AssaySchema schema, TableInfo table, final ExpProtocol protocol) + public ElispotRunDataTable(final AssaySchema schema, TableInfo table, ContainerFilter cf, final ExpProtocol protocol) { - super(schema, table, protocol); + super(schema, table, cf, protocol); setDescription("Contains one row per sample for the \"" + protocol.getName() + "\" ELISpot assay design."); @@ -116,11 +117,12 @@ protected void addPropertyColumns(final AssaySchema schema, final ExpProtocol pr ColumnInfo antigenLsidColumn = getColumn("AntigenLsid"); antigenLsidColumn.setLabel("Antigen"); - antigenLsidColumn.setFk(new LookupForeignKey(null, "AntigenName") + antigenLsidColumn.setFk(new LookupForeignKey( (String)null, "AntigenName") { @Override public TableInfo getLookupTableInfo() { + // TODO ContainerFilter return ElispotManager.getTableInfoElispotAntigen(_protocol); } }); @@ -138,12 +140,12 @@ protected ColumnInfo resolveColumn(String name) // node can still be queried there. result = wrapColumn("Properties", getRealTable().getColumn("ObjectId")); result.setIsUnselectable(true); - LookupForeignKey fk = new LookupForeignKey("ObjectId") + LookupForeignKey fk = new LookupForeignKey(getContainerFilter(), "ObjectId", null) { @Override public TableInfo getLookupTableInfo() { - return new ElispotRunDataTable(_userSchema, _protocol); + return new ElispotRunDataTable(_userSchema, getLookupContainerFilter(), _protocol); } }; fk.setPrefixColumnCaption(false); diff --git a/elispotassay/src/org/labkey/elispot/query/PlateBasedAssayRunDataTable.java b/elispotassay/src/org/labkey/elispot/query/PlateBasedAssayRunDataTable.java index 48e36a55b1..7bacb8d0d2 100644 --- a/elispotassay/src/org/labkey/elispot/query/PlateBasedAssayRunDataTable.java +++ b/elispotassay/src/org/labkey/elispot/query/PlateBasedAssayRunDataTable.java @@ -17,7 +17,6 @@ package org.labkey.elispot.query; import org.labkey.api.data.*; -import org.labkey.api.exp.PropertyDescriptor; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.exp.api.ExpSampleSet; import org.labkey.api.exp.api.ExperimentService; @@ -47,9 +46,9 @@ public String getInputMaterialPropertyName() return ElispotDataHandler.ELISPOT_INPUT_MATERIAL_DATA_PROPERTY; } - public PlateBasedAssayRunDataTable(final AssaySchema schema, final TableInfo table, final ExpProtocol protocol) + public PlateBasedAssayRunDataTable(final AssaySchema schema, final TableInfo table, ContainerFilter cf, final ExpProtocol protocol) { - super(table, schema); + super(table, schema, cf); _protocol = protocol; final AssayProvider provider = AssayService.get().getProvider(protocol); @@ -63,7 +62,7 @@ public PlateBasedAssayRunDataTable(final AssaySchema schema, final TableInfo tab { public TableInfo getLookupTableInfo() { - ExpRunTable expRunTable = AssayService.get().createRunTable(protocol, provider, schema.getUser(), schema.getContainer()); + ExpRunTable expRunTable = AssayService.get().createRunTable(protocol, provider, schema.getUser(), schema.getContainer(), PlateBasedAssayRunDataTable.this.getContainerFilter()); expRunTable.setContainerFilter(getContainerFilter()); return expRunTable; } @@ -79,13 +78,11 @@ public TableInfo getLookupTableInfo() ColumnInfo materialColumn = getColumn("SpecimenLsid"); // new PropertyColumn(materialProperty, objectUriColumn, getContainer(), schema.getUser(), false); materialColumn.setLabel("Specimen"); materialColumn.setHidden(true); - materialColumn.setFk(new LookupForeignKey("LSID") + materialColumn.setFk(new LookupForeignKey(cf,"LSID", null) { public TableInfo getLookupTableInfo() { - ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema); - // Make sure we are filtering to the same set of containers - materials.setContainerFilter(getContainerFilter()); + ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema, getLookupContainerFilter()); if (sampleSet != null) { materials.setSampleSet(sampleSet, true); diff --git a/flow/src/org/labkey/flow/controllers/executescript/SamplesConfirmGridView.java b/flow/src/org/labkey/flow/controllers/executescript/SamplesConfirmGridView.java index be7d80590c..79e462ec6a 100644 --- a/flow/src/org/labkey/flow/controllers/executescript/SamplesConfirmGridView.java +++ b/flow/src/org/labkey/flow/controllers/executescript/SamplesConfirmGridView.java @@ -25,6 +25,7 @@ import org.labkey.api.data.ButtonBar; import org.labkey.api.data.CachedResultSets; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.Container; import org.labkey.api.data.DataRegion; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.InputColumn; @@ -36,6 +37,7 @@ import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpData; import org.labkey.api.query.FieldKey; +import org.labkey.api.security.User; import org.labkey.api.settings.AppProps; import org.labkey.api.util.PageFlowUtil; import org.labkey.api.util.SimpleNamedObject; @@ -45,6 +47,7 @@ import org.labkey.flow.analysis.model.Workspace; import org.labkey.flow.data.FlowFCSFile; import org.labkey.flow.data.FlowRun; +import org.labkey.flow.query.FlowSchema; import org.labkey.flow.util.KeywordUtil; import org.springframework.validation.Errors; @@ -80,12 +83,12 @@ public class SamplesConfirmGridView extends GridView Map _runs = new HashMap<>(); - public SamplesConfirmGridView(SelectedSamples data, boolean resolving, Errors errors) + public SamplesConfirmGridView(User user, Container container, SelectedSamples data, boolean resolving, Errors errors) { - this(data.getKeywords(), data.getSamples(), resolving, data.getRows(), errors); + this(user, container, data.getKeywords(), data.getSamples(), resolving, data.getRows(), errors); } - public SamplesConfirmGridView(Collection keywords, List samples, boolean resolving, Map rows, Errors errors) + public SamplesConfirmGridView(User user, Container container, Collection keywords, List samples, boolean resolving, Map rows, Errors errors) { super(new SamplesConfirmDataRegion(), errors); @@ -225,7 +228,8 @@ public SamplesConfirmGridView(Collection keywords, List _files; NamedObjectList _list; - FCSFilesFilesForeignKey(List files) + FCSFilesFilesForeignKey(FlowSchema schema, List files) { + super(schema, null); _files = files; _list = new NamedObjectList(); diff --git a/flow/src/org/labkey/flow/controllers/executescript/importAnalysisReviewSamples.jsp b/flow/src/org/labkey/flow/controllers/executescript/importAnalysisReviewSamples.jsp index 31b266176e..496625c616 100644 --- a/flow/src/org/labkey/flow/controllers/executescript/importAnalysisReviewSamples.jsp +++ b/flow/src/org/labkey/flow/controllers/executescript/importAnalysisReviewSamples.jsp @@ -84,7 +84,7 @@ } SelectedSamples selectedSamples = form.getSelectedSamples(); - SamplesConfirmGridView resolveView = new SamplesConfirmGridView(selectedSamples, form.isResolving(), null); + SamplesConfirmGridView resolveView = new SamplesConfirmGridView(getUser(), container, selectedSamples, form.isResolving(), null); %> diff --git a/flow/src/org/labkey/flow/data/FlowProtocol.java b/flow/src/org/labkey/flow/data/FlowProtocol.java index d1d509608f..290fa7397f 100644 --- a/flow/src/org/labkey/flow/data/FlowProtocol.java +++ b/flow/src/org/labkey/flow/data/FlowProtocol.java @@ -572,7 +572,7 @@ public void updateFCSAnalysisName(User user) throws Exception } fs.insertParent(FieldKey.fromParts("FCSFile")); FlowSchema schema = new FlowSchema(user, getContainer()); - ExpDataTable table = schema.createFCSAnalysisTable("FCSAnalysis", FlowDataType.FCSAnalysis, false); + ExpDataTable table = schema.createFCSAnalysisTable(null,"FCSAnalysis", FlowDataType.FCSAnalysis, false); Map columns = new HashMap<>(); ColumnInfo colRowId = table.getColumn(ExpDataTable.Column.RowId); columns.put(new FieldKey(null, "RowId"), colRowId); diff --git a/flow/src/org/labkey/flow/data/FlowProtocolSchema.java b/flow/src/org/labkey/flow/data/FlowProtocolSchema.java index 94633e4e80..66e4faeb1f 100644 --- a/flow/src/org/labkey/flow/data/FlowProtocolSchema.java +++ b/flow/src/org/labkey/flow/data/FlowProtocolSchema.java @@ -18,8 +18,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerFilterable; +import org.labkey.api.data.ContainerFilter; +import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpProtocol; +import org.labkey.api.exp.query.ExpDataTable; import org.labkey.api.exp.query.ExpRunTable; import org.labkey.api.query.QuerySettings; import org.labkey.api.security.User; @@ -49,19 +51,21 @@ public FlowAssayProvider getProvider() } @Override - public ExpRunTable createRunsTable() + public ExpRunTable createRunsTable(ContainerFilter cf) { FlowSchema flowSchema = new FlowSchema(getUser(), getContainer()); //assert protocol == flowSchema.getProtocol(); - return (ExpRunTable)flowSchema.getTable(FlowTableType.Runs); + return (ExpRunTable)flowSchema.getTable(FlowTableType.Runs, cf); } @Override - public ContainerFilterable createDataTable(boolean includeCopiedToStudyColumns) + public TableInfo createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { FlowSchema flowSchema = new FlowSchema(getUser(), getContainer()); //assert protocol == flowSchema.getProtocol(); - return flowSchema.createFCSAnalysisTable(FlowTableType.FCSAnalyses.name(), FlowDataType.FCSAnalysis, includeCopiedToStudyColumns); + ExpDataTable ti; + ti = flowSchema.createFCSAnalysisTable(cf, FlowTableType.FCSAnalyses.name(), FlowDataType.FCSAnalysis, includeCopiedToStudyColumns); + return ti; } @Nullable diff --git a/flow/src/org/labkey/flow/persist/FlowKeywordAuditProvider.java b/flow/src/org/labkey/flow/persist/FlowKeywordAuditProvider.java index 56594ddd97..25928ae4b0 100644 --- a/flow/src/org/labkey/flow/persist/FlowKeywordAuditProvider.java +++ b/flow/src/org/labkey/flow/persist/FlowKeywordAuditProvider.java @@ -20,6 +20,7 @@ import org.labkey.api.audit.AuditTypeProvider; import org.labkey.api.audit.query.AbstractAuditDomainKind; import org.labkey.api.audit.query.DefaultAuditTypeTable; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.TableInfo; import org.labkey.api.exp.PropertyDescriptor; import org.labkey.api.exp.PropertyType; @@ -59,9 +60,9 @@ public class FlowKeywordAuditProvider extends AbstractAuditTypeProvider implemen } @Override - public TableInfo createTableInfo(UserSchema userSchema) + public TableInfo createTableInfo(UserSchema userSchema, ContainerFilter cf) { - DefaultAuditTypeTable table = new DefaultAuditTypeTable(this, createStorageTableInfo(), userSchema, getDefaultVisibleColumns()); + DefaultAuditTypeTable table = new DefaultAuditTypeTable(this, createStorageTableInfo(), userSchema, cf, getDefaultVisibleColumns()); DetailsURL url = DetailsURL.fromString("experiment/resolveLSID.view?lsid=${lsid}"); diff --git a/flow/src/org/labkey/flow/query/AttributeForeignKey.java b/flow/src/org/labkey/flow/query/AttributeForeignKey.java index 002bcb0f3d..676b51d740 100644 --- a/flow/src/org/labkey/flow/query/AttributeForeignKey.java +++ b/flow/src/org/labkey/flow/query/AttributeForeignKey.java @@ -18,9 +18,9 @@ import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; import org.labkey.api.data.*; import org.labkey.api.query.AliasManager; +import org.labkey.api.query.UserSchema; import org.labkey.flow.data.AttributeType; import org.labkey.flow.persist.AttributeCache; import org.labkey.flow.persist.FlowManager; @@ -41,10 +41,10 @@ public StringExpression getURL(ColumnInfo parent) protected Container _container; - public AttributeForeignKey(@NotNull Container c) + public AttributeForeignKey(UserSchema schema) { - _container = c; - assert _container != null; + super(schema, null); + _container = schema.getContainer(); } public TableInfo getLookupTableInfo() diff --git a/flow/src/org/labkey/flow/query/BackgroundForeignKey.java b/flow/src/org/labkey/flow/query/BackgroundForeignKey.java index 99c20199d1..288984420a 100644 --- a/flow/src/org/labkey/flow/query/BackgroundForeignKey.java +++ b/flow/src/org/labkey/flow/query/BackgroundForeignKey.java @@ -36,7 +36,7 @@ public class BackgroundForeignKey extends AttributeForeignKey public BackgroundForeignKey(FlowSchema schema, FlowPropertySet fps, FlowDataType type) { - super(schema.getContainer()); + super(schema); _schema = schema; _fps = fps; _type = type; diff --git a/flow/src/org/labkey/flow/query/FlowSchema.java b/flow/src/org/labkey/flow/query/FlowSchema.java index d981092d79..910f78e5b7 100644 --- a/flow/src/org/labkey/flow/query/FlowSchema.java +++ b/flow/src/org/labkey/flow/query/FlowSchema.java @@ -21,25 +21,7 @@ import org.jetbrains.annotations.Nullable; import org.labkey.api.cache.CacheManager; import org.labkey.api.cache.StringKeyCache; -import org.labkey.api.data.AbstractTableInfo; -import org.labkey.api.data.ColumnInfo; -import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerFilter; -import org.labkey.api.data.ContainerForeignKey; -import org.labkey.api.data.ContainerManager; -import org.labkey.api.data.DataColumn; -import org.labkey.api.data.DbSchema; -import org.labkey.api.data.DisplayColumn; -import org.labkey.api.data.DisplayColumnFactory; -import org.labkey.api.data.FilterInfo; -import org.labkey.api.data.JdbcType; -import org.labkey.api.data.MaterializedQueryHelper; -import org.labkey.api.data.NullColumnInfo; -import org.labkey.api.data.RenderContext; -import org.labkey.api.data.SQLFragment; -import org.labkey.api.data.SimpleFilter; -import org.labkey.api.data.Table; -import org.labkey.api.data.TableInfo; +import org.labkey.api.data.*; import org.labkey.api.exp.PropertyColumn; import org.labkey.api.exp.PropertyDescriptor; import org.labkey.api.exp.api.DataType; @@ -227,7 +209,7 @@ public TableInfo createTable(String name) try { FlowTableType type = FlowTableType.valueOf(name); - AbstractTableInfo table = (AbstractTableInfo)getTable(type); + AbstractTableInfo table = (AbstractTableInfo)getTable(type, null); table.setDescription(type.getDescription()); return table; } @@ -239,17 +221,24 @@ public TableInfo createTable(String name) } public TableInfo getTable(FlowTableType type) + { + // flow schema is not converted yet! + return getTable(type, null); + } + + // TODO ContainerFilter -- not converted yet + public TableInfo getTable(FlowTableType type, ContainerFilter cf) { switch (type) { case FCSFiles: return createFCSFileTable(type.toString()); case FCSAnalyses: - return createFCSAnalysisTable(type.toString(), FlowDataType.FCSAnalysis, true); + return createFCSAnalysisTable(cf, type.toString(), FlowDataType.FCSAnalysis, true); case CompensationControls: return createCompensationControlTable(type.toString()); case Runs: - return createRunTable(type.toString(), null); + return createRunTable(type.toString(), null, cf); case CompensationMatrices: return createCompensationMatrixTable(type.toString()); case AnalysisScripts: @@ -371,9 +360,9 @@ public QueryView createView(ViewContext context, QuerySettings settings, BindExc return sqlDataId; } */ - public ExpRunTable createRunTable(String alias, FlowDataType type) + public ExpRunTable createRunTable(String alias, FlowDataType type, ContainerFilter cf) { - ExpRunTable ret = ExperimentService.get().createRunTable(FlowTableType.Runs.toString(), this); + ExpRunTable ret = ExperimentService.get().createRunTable(FlowTableType.Runs.toString(), this, cf); if (_experiment != null) { @@ -438,10 +427,12 @@ public TableInfo getLookupTableInfo() }); ColumnInfo colWorkspace = ret.addDataInputColumn("Workspace", InputRole.Workspace.toString()); - ExpDataTable workspacesTable = ExperimentService.get().createDataTable("Datas", this); + ExpDataTable workspacesTable = ExperimentService.get().createDataTable("Datas", this, cf); workspacesTable.setPublicSchemaName(ExpSchema.SCHEMA_NAME); workspacesTable.populate(); - colWorkspace.setFk(new QueryForeignKey(workspacesTable, null, "RowId", "Name")); + colWorkspace.setFk(QueryForeignKey + .from(ret.getUserSchema(), ret.getContainerFilter()) + .table(workspacesTable).key("RowId").display("Name")); colWorkspace.setHidden(true); } @@ -522,11 +513,12 @@ class JoinFlowDataTable extends AbstractTableInfo implements ExpDataTable final String _expDataAlias; FlowPropertySet _fps; - JoinFlowDataTable(String name, FlowDataType type) + // TODO ContainerFilter Do I need to over-ride getDefaultContainerFilter() so that AbstractTableInfo doesn't wrap a second CF? + JoinFlowDataTable(String name, FlowDataType type, ContainerFilter cf) { super(getDbSchema(), name); _expDataAlias = "_expdata_"; - _expData = ExperimentService.get().createDataTable(name, FlowSchema.this); + _expData = ExperimentService.get().createDataTable(name, FlowSchema.this, cf); _flowObject = FlowManager.get().getTinfoObject(); _type = type; _fps = new FlowPropertySet(_expData); @@ -535,7 +527,7 @@ class JoinFlowDataTable extends AbstractTableInfo implements ExpDataTable ColumnInfo addStatisticColumn(String columnAlias) { ColumnInfo colStatistic = addObjectIdColumn(columnAlias); - colStatistic.setFk(new StatisticForeignKey(getContainer(), _fps, _type)); + colStatistic.setFk(new StatisticForeignKey(FlowSchema.this, _fps, _type)); colStatistic.setIsUnselectable(true); addMethod(columnAlias, new StatisticMethod(getContainer(), colStatistic)); return colStatistic; @@ -553,7 +545,7 @@ ColumnInfo addKeywordColumn(String columnAlias) ColumnInfo addGraphColumn(String columnAlias) { ColumnInfo colGraph = addObjectIdColumn(columnAlias); - colGraph.setFk(new GraphForeignKey(getContainer(), _fps)); + colGraph.setFk(new GraphForeignKey(FlowSchema.this, _fps)); colGraph.setIsUnselectable(true); return colGraph; } @@ -810,10 +802,10 @@ class FastFlowDataTable extends AbstractTableInfo implements ExpDataTable ExpRun _run = null; boolean _runSpecified = false; - FastFlowDataTable(String name, FlowDataType type) + FastFlowDataTable(String name, FlowDataType type, ContainerFilter cf) { super(getDbSchema(), name); - _expData = ExperimentService.get().createDataTable(name, FlowSchema.this); + _expData = ExperimentService.get().createDataTable(name, FlowSchema.this, cf); _expData.setDataType(type); _flowObject = FlowManager.get().getTinfoObject(); _type = type; @@ -848,7 +840,7 @@ ColumnInfo addDownloadColumn() // Replace ExpDataTable's DownloadLink column with ours ColumnInfo colDownload = new AliasedColumn(this, Column.DownloadLink.name(), this.getColumn(ExpDataTable.Column.RowId)); // Remove RowIdForeignKey - colDownload.setFk(null); + colDownload.clearFk(); colDownload.setKeyField(false); colDownload.setHidden(true); colDownload.setDisplayColumnFactory(new DisplayColumnFactory() @@ -920,7 +912,7 @@ ColumnInfo addFilePathColumn(String columnAlias) ColumnInfo addStatisticColumn(String columnAlias) { ColumnInfo colStatistic = addObjectIdColumn(columnAlias); - colStatistic.setFk(new StatisticForeignKey(getContainer(), _fps, _type)); + colStatistic.setFk(new StatisticForeignKey(FlowSchema.this, _fps, _type)); colStatistic.setIsUnselectable(true); addMethod(columnAlias, new StatisticMethod(getContainer(), colStatistic)); return colStatistic; @@ -938,7 +930,7 @@ ColumnInfo addKeywordColumn(String columnAlias) ColumnInfo addGraphColumn(String columnAlias) { ColumnInfo colGraph = addObjectIdColumn(columnAlias); - colGraph.setFk(new GraphForeignKey(getContainer(), _fps)); + colGraph.setFk(new GraphForeignKey(FlowSchema.this, _fps)); colGraph.setIsUnselectable(true); return colGraph; } @@ -1210,7 +1202,7 @@ public ColumnInfo addReportColumns(final FlowReport report, FlowTableType tableT FieldKey fieldKey = new FieldKey(null, report.getDescriptor().getReportName()); ExprColumn col = new ExprColumn(this, fieldKey, sql, JdbcType.VARCHAR); - PropertyForeignKey fk = new PropertyForeignKey(domain, FlowSchema.this) + PropertyForeignKey fk = new PropertyForeignKey(FlowSchema.this, null, domain) { @Override protected ColumnInfo constructColumnInfo(ColumnInfo parent, FieldKey name, PropertyDescriptor pd) @@ -1328,16 +1320,16 @@ protected ColumnInfo resolveColumn(String name) public class FlowDataTable extends FastFlowDataTable { - FlowDataTable(String name, FlowDataType type) + FlowDataTable(String name, FlowDataType type, ContainerFilter cf) { - super(name, type); + super(name, type, cf); } } - public FlowDataTable createDataTable(String name, final FlowDataType type) + public FlowDataTable createDataTable(String name, final FlowDataType type, ContainerFilter cf) { - FlowDataTable ret = new FlowDataTable(name, type); + FlowDataTable ret = new FlowDataTable(name, type, cf); ret.addColumn(ExpDataTable.Column.Name); ret.addColumn(ExpDataTable.Column.RowId).setHidden(true); ret.addColumn(ExpDataTable.Column.LSID).setHidden(true); @@ -1360,7 +1352,7 @@ public FlowDataTable createDataTable(String name, final FlowDataType type) { public TableInfo getLookupTableInfo() { - return detach().createRunTable("run", type); + return detach().createRunTable("run", type, cf); } }); if (_experiment != null) @@ -1479,7 +1471,8 @@ public FlowDataTable createFCSFileTable(String name) public FlowDataTable createFCSFileTable(String name, boolean specimenRelativeFromFCSFileTable) { - final FlowDataTable ret = createDataTable(name, FlowDataType.FCSFile); + // TODO ContainerFilter + final FlowDataTable ret = createDataTable(name, FlowDataType.FCSFile, null); ret.getColumn(ExpDataTable.Column.Name).setURL(new DetailsURL(new ActionURL(WellController.ShowWellAction.class, getContainer()), Collections.singletonMap(FlowParam.wellId.toString(), ExpDataTable.Column.RowId.toString()))); ret.setDetailsURL(new DetailsURL(new ActionURL(WellController.ShowWellAction.class, getContainer()), Collections.singletonMap(FlowParam.wellId.toString(), ExpDataTable.Column.RowId.toString()))); final ColumnInfo colKeyword = ret.addKeywordColumn("Keyword"); @@ -1617,9 +1610,10 @@ public TableInfo getLookupTableInfo() } - public ExpDataTable createFCSAnalysisTable(String alias, FlowDataType type, boolean includeCopiedToStudyColumns) + public ExpDataTable createFCSAnalysisTable(ContainerFilter cf, String alias, FlowDataType type, boolean includeCopiedToStudyColumns) { - FlowDataTable ret = createDataTable(alias, type); + // TODO ContainerFilter + FlowDataTable ret = createDataTable(alias, type, cf); ColumnInfo colAnalysisScript = new ExprColumn(ret, "AnalysisScript", new SQLFragment(ExprColumn.STR_TABLE_ALIAS + ".scriptid"), JdbcType.INTEGER); ret.addColumn(colAnalysisScript); @@ -1735,7 +1729,8 @@ public static FieldKey removeParent(FieldKey fieldKey, String rootPart) public ExpDataTable createCompensationControlTable(String alias) { - ExpDataTable ret = createFCSAnalysisTable(alias, FlowDataType.CompensationControl, false); + // TODO ContainerFilter + ExpDataTable ret = createFCSAnalysisTable(null, alias, FlowDataType.CompensationControl, false); List defColumns = new ArrayList<>(ret.getDefaultVisibleColumns()); defColumns.add(FieldKey.fromParts("Statistic", new StatisticSpec(FCSAnalyzer.compSubset, StatisticSpec.STAT.Count, null).toString())); defColumns.add(FieldKey.fromParts("Statistic", new StatisticSpec(FCSAnalyzer.compSubset, StatisticSpec.STAT.Freq_Of_Parent, null).toString())); @@ -1745,7 +1740,8 @@ public ExpDataTable createCompensationControlTable(String alias) public FlowDataTable createCompensationMatrixTable(String alias) { - FlowDataTable ret = createDataTable(alias, FlowDataType.CompensationMatrix); + // TODO ContainerFilter + FlowDataTable ret = createDataTable(alias, FlowDataType.CompensationMatrix, null); if (getExperiment() != null) { ret.setExperiment(ExperimentService.get().getExpExperiment(getExperiment().getLSID())); @@ -1761,7 +1757,8 @@ public FlowDataTable createCompensationMatrixTable(String alias) public FlowDataTable createAnalysisScriptTable(String alias, boolean includePrivate) { - FlowDataTable ret = createDataTable(alias, FlowDataType.Script); + // TODO ContainerFilter + FlowDataTable ret = createDataTable(alias, FlowDataType.Script, null); if (!includePrivate) { SQLFragment runIdCondition = new SQLFragment("RunId IS NULL"); @@ -1783,13 +1780,15 @@ public FlowDataTable createAnalysisScriptTable(String alias, boolean includePriv public FlowDataTable createWorkspaceTable(String alias) { - FlowDataTable ret = createDataTable(alias, FlowDataType.Workspace); + // TODO ContainerFilter + FlowDataTable ret = createDataTable(alias, FlowDataType.Workspace, null); return ret; } public ExpExperimentTable createAnalysesTable(String name) { - ExpExperimentTable ret = ExperimentService.get().createExperimentTable(name, new ExpSchema(getUser(), getContainer())); + // TODO ContainerFilter + ExpExperimentTable ret = ExperimentService.get().createExperimentTable(name, new ExpSchema(getUser(), getContainer()), null); ret.populate(); FlowProtocol compensationProtocol = FlowProtocolStep.calculateCompensation.getForContainer(getContainer()); FlowProtocol analysisProtocol = FlowProtocolStep.analysis.getForContainer(getContainer()); diff --git a/flow/src/org/labkey/flow/query/GraphForeignKey.java b/flow/src/org/labkey/flow/query/GraphForeignKey.java index 0f0f36c939..b34a891968 100644 --- a/flow/src/org/labkey/flow/query/GraphForeignKey.java +++ b/flow/src/org/labkey/flow/query/GraphForeignKey.java @@ -17,7 +17,6 @@ package org.labkey.flow.query; import org.labkey.api.data.ColumnInfo; -import org.labkey.api.data.Container; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.dialect.SqlDialect; import org.labkey.api.query.ExprColumn; @@ -33,9 +32,9 @@ public class GraphForeignKey extends AttributeForeignKey { FlowPropertySet _fps; - public GraphForeignKey(Container c, FlowPropertySet fps) + public GraphForeignKey(FlowSchema schema, FlowPropertySet fps) { - super(c); + super(schema); _fps = fps; } diff --git a/flow/src/org/labkey/flow/query/KeywordForeignKey.java b/flow/src/org/labkey/flow/query/KeywordForeignKey.java index 6b7f6a9be6..b45cc0b203 100644 --- a/flow/src/org/labkey/flow/query/KeywordForeignKey.java +++ b/flow/src/org/labkey/flow/query/KeywordForeignKey.java @@ -40,7 +40,7 @@ public class KeywordForeignKey extends AttributeForeignKey public KeywordForeignKey(FlowSchema schema, FlowPropertySet fps) { - super(schema.getContainer()); + super(schema); _schema = schema; _fps = fps; } diff --git a/flow/src/org/labkey/flow/query/StatisticForeignKey.java b/flow/src/org/labkey/flow/query/StatisticForeignKey.java index 38a9933fa1..1aab195280 100644 --- a/flow/src/org/labkey/flow/query/StatisticForeignKey.java +++ b/flow/src/org/labkey/flow/query/StatisticForeignKey.java @@ -33,9 +33,9 @@ public class StatisticForeignKey extends AttributeForeignKey FlowPropertySet _fps; FlowDataType _type; - public StatisticForeignKey(Container c, FlowPropertySet fps, FlowDataType type) + public StatisticForeignKey(FlowSchema schema, FlowPropertySet fps, FlowDataType type) { - super(c); + super(schema); _fps = fps; _type = type; } diff --git a/luminex/src/org/labkey/luminex/LuminexDataHandler.java b/luminex/src/org/labkey/luminex/LuminexDataHandler.java index 9d78eb959d..982f1a2d5b 100644 --- a/luminex/src/org/labkey/luminex/LuminexDataHandler.java +++ b/luminex/src/org/labkey/luminex/LuminexDataHandler.java @@ -519,8 +519,8 @@ else if (col.getName().equals(NEGATIVE_BEAD_COLUMN_NAME)) private void saveDataRows(ExpRun expRun, User user, ExpProtocol protocol, Map> rows, List dataIds) throws SQLException, ValidationException { - // Do a query to find all of the rows that have already been inserted - LuminexDataTable tableInfo = ((LuminexProtocolSchema)AssayService.get().getProvider(protocol).createProtocolSchema(user, expRun.getContainer(), protocol, null)).createDataTable(false); + // Do a query to find all of the rows that have already been inserted + LuminexDataTable tableInfo = ((LuminexProtocolSchema)AssayService.get().getProvider(protocol).createProtocolSchema(user, expRun.getContainer(), protocol, null)).createDataTable(null, false); SimpleFilter filter = new SimpleFilter(new SimpleFilter.InClause(FieldKey.fromParts("Data"), dataIds)); Map existingRows = new HashMap<>(); @@ -815,7 +815,7 @@ public static void insertOrUpdateAnalyteSinglePointControlQCFlags(User user, Exp LuminexProtocolSchema schema = new LuminexProtocolSchema(user, expRun.getContainer(), (LuminexAssayProvider)provider, protocol, null); // query the QC Flags table to get any existing analyte/titration QC Flags - ExpQCFlagTable qcFlagTable = schema.createAnalyteSinglePointControlQCFlagTable(); + ExpQCFlagTable qcFlagTable = schema.createAnalyteSinglePointControlQCFlagTable(null); SimpleFilter analyteSinglePointControlFilter = new SimpleFilter(FieldKey.fromParts("Analyte"), analyte.getRowId()); analyteSinglePointControlFilter.addCondition(FieldKey.fromParts("SinglePointControl"), singlePointControl.getRowId()); List existingQCFlags = new TableSelector(qcFlagTable, analyteSinglePointControlFilter, null).getArrayList(AnalyteSinglePointControlQCFlag.class); @@ -824,7 +824,7 @@ public static void insertOrUpdateAnalyteSinglePointControlQCFlags(User user, Exp if (null != analyteSinglePointControl.getGuideSetId()) { - GuideSetTable guideSetTable = schema.createGuideSetTable(false); + GuideSetTable guideSetTable = schema.createGuideSetTable(null,false); GuideSet guideSetRow = new TableSelector(guideSetTable).getObject(analyteSinglePointControl.getGuideSetId(), GuideSet.class); if (guideSetRow == null) @@ -1456,7 +1456,7 @@ public static void insertOrUpdateAnalyteTitrationQCFlags(User user, ExpRun expRu LuminexProtocolSchema schema = new LuminexProtocolSchema(user, expRun.getContainer(), (LuminexAssayProvider)provider, protocol, null); // query the QC Flags table to get any existing analyte/titration QC Flags - ExpQCFlagTable qcFlagTable = schema.createAnalyteTitrationQCFlagTable(); + ExpQCFlagTable qcFlagTable = schema.createAnalyteTitrationQCFlagTable(null); SimpleFilter analyteTitrationFilter = new SimpleFilter(FieldKey.fromParts("Analyte"), analyte.getRowId()); analyteTitrationFilter.addCondition(FieldKey.fromParts("Titration"), titration.getRowId()); List existingAnalyteTitrationQCFlags = new TableSelector(qcFlagTable, analyteTitrationFilter, null).getArrayList(AnalyteTitrationQCFlag.class); @@ -1466,7 +1466,7 @@ public static void insertOrUpdateAnalyteTitrationQCFlags(User user, ExpRun expRu if (null != analyteTitration.getGuideSetId()) { // query the guide set table to get the average and stddev values for the out of guide set range comparisons - GuideSetTable guideSetTable = schema.createGuideSetTable(false); + GuideSetTable guideSetTable = schema.createGuideSetTable(null,false); GuideSet guideSetRow = new TableSelector(guideSetTable).getObject(analyteTitration.getGuideSetId(), GuideSet.class); if (guideSetRow == null) diff --git a/luminex/src/org/labkey/luminex/LuminexManager.java b/luminex/src/org/labkey/luminex/LuminexManager.java index 38cd747fa3..e8da0ac13b 100644 --- a/luminex/src/org/labkey/luminex/LuminexManager.java +++ b/luminex/src/org/labkey/luminex/LuminexManager.java @@ -665,7 +665,7 @@ private Set getWellKeysForRun(Integer runId, ExpProtocol protocol, Conta throw new NotFoundException("Luminex assay provider not found"); LuminexProtocolSchema schema = new LuminexProtocolSchema(user, container, (LuminexAssayProvider)provider, protocol, null); - LuminexDataTable table = new LuminexDataTable(schema); + LuminexDataTable table = new LuminexDataTable(schema, null); // data file, analyte, description, dilution, and type are needed to match an existing exclusion to data from an Excel file row FieldKey readerSerialNumberFK = FieldKey.fromParts("Data", "ReaderSerialNumber"); diff --git a/luminex/src/org/labkey/luminex/model/AnalyteSinglePointControl.java b/luminex/src/org/labkey/luminex/model/AnalyteSinglePointControl.java index 8dece6a75f..a0e77acc85 100644 --- a/luminex/src/org/labkey/luminex/model/AnalyteSinglePointControl.java +++ b/luminex/src/org/labkey/luminex/model/AnalyteSinglePointControl.java @@ -79,7 +79,7 @@ public void updateQCFlags(LuminexProtocolSchema schema) SimpleFilter filter = new SimpleFilter(FieldKey.fromParts("Analyte"), analyte.getRowId()); filter.addCondition(FieldKey.fromParts("SinglePointControl"), control.getRowId()); - AnalyteSinglePointControlTable analyteSinglePointControlTable = schema.createAnalyteSinglePointControlTable(true); + AnalyteSinglePointControlTable analyteSinglePointControlTable = schema.createAnalyteSinglePointControlTable(null, true); analyteSinglePointControlTable.setContainerFilter(ContainerFilter.EVERYTHING); Double average = new TableSelector(analyteSinglePointControlTable, Collections.singleton("AverageFiBkgd"), filter, null).getObject(Double.class); diff --git a/luminex/src/org/labkey/luminex/query/AbstractCurveFitPivotTable.java b/luminex/src/org/labkey/luminex/query/AbstractCurveFitPivotTable.java index 6acb442e13..f148570612 100644 --- a/luminex/src/org/labkey/luminex/query/AbstractCurveFitPivotTable.java +++ b/luminex/src/org/labkey/luminex/query/AbstractCurveFitPivotTable.java @@ -16,6 +16,7 @@ package org.labkey.luminex.query; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.TableInfo; import org.labkey.api.query.LookupForeignKey; @@ -28,9 +29,9 @@ public abstract class AbstractCurveFitPivotTable extends AbstractLuminexTable private static final String CURVE_FIT_SUFFIX = "CurveFit"; private final String _primaryCurveFitJoinColumn; - public AbstractCurveFitPivotTable(TableInfo table, LuminexProtocolSchema schema, boolean filter, String primaryCurveFitJoinColumn) + public AbstractCurveFitPivotTable(TableInfo table, LuminexProtocolSchema schema, ContainerFilter cf, boolean filter, String primaryCurveFitJoinColumn) { - super(table, schema, filter); + super(table, schema, cf, filter); _primaryCurveFitJoinColumn = primaryCurveFitJoinColumn; } @@ -58,7 +59,7 @@ private ColumnInfo createCurveTypeColumn(final String curveType) { ColumnInfo curveFitColumn = wrapColumn(curveType + "CurveFit", getRealTable().getColumn(_primaryCurveFitJoinColumn)); - LookupForeignKey fk = createCurveFitFK(curveType); + LookupForeignKey fk = createCurveFitFK(getContainerFilter(), curveType); // We need the prefix to distinguish between the different kinds of curve fits fk.setPrefixColumnCaption(true); curveFitColumn.setIsUnselectable(true); @@ -71,5 +72,5 @@ private ColumnInfo createCurveTypeColumn(final String curveType) return curveFitColumn; } - protected abstract LookupForeignKey createCurveFitFK(final String curveType); + protected abstract LookupForeignKey createCurveFitFK(ContainerFilter cf, final String curveType); } diff --git a/luminex/src/org/labkey/luminex/query/AbstractExclusionTable.java b/luminex/src/org/labkey/luminex/query/AbstractExclusionTable.java index 23b91a778e..380aba095f 100644 --- a/luminex/src/org/labkey/luminex/query/AbstractExclusionTable.java +++ b/luminex/src/org/labkey/luminex/query/AbstractExclusionTable.java @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.ForeignKey; import org.labkey.api.data.SqlExecutor; import org.labkey.api.data.Table; @@ -54,9 +55,9 @@ */ public abstract class AbstractExclusionTable extends AbstractLuminexTable { - protected AbstractExclusionTable(TableInfo realTable, LuminexProtocolSchema schema, boolean filter) + protected AbstractExclusionTable(TableInfo realTable, LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(realTable, schema, filter); + super(realTable, schema, cf, filter); wrapAllColumns(true); assert getRealTable().getPkColumnNames().size() == 1; @@ -65,7 +66,7 @@ protected AbstractExclusionTable(TableInfo realTable, LuminexProtocolSchema sche analytesColumn.setUserEditable(true); analytesColumn.setReadOnly(false); - ForeignKey userIdForeignKey = new UserIdQueryForeignKey(schema.getUser(), schema.getContainer(), true); + ForeignKey userIdForeignKey = new UserIdQueryForeignKey(schema, true); getColumn("ModifiedBy").setFk(userIdForeignKey); getColumn("CreatedBy").setFk(userIdForeignKey); diff --git a/luminex/src/org/labkey/luminex/query/AbstractLuminexTable.java b/luminex/src/org/labkey/luminex/query/AbstractLuminexTable.java index 6ccbe4fd27..a404e5815e 100644 --- a/luminex/src/org/labkey/luminex/query/AbstractLuminexTable.java +++ b/luminex/src/org/labkey/luminex/query/AbstractLuminexTable.java @@ -37,9 +37,9 @@ public abstract class AbstractLuminexTable extends FilteredTable dataColumns = Arrays.asList(dataTable.getColumn("FlaggedAsExcluded"), dataTable.getColumn("FIBackground"), dataTable.getColumn("Description"), dataTable.getColumn("Data"), dataTable.getColumn("Analyte")); avgFiSQL.append(QueryService.get().getSelectSQL(dataTable, dataColumns, null, null, Table.ALL_ROWS, 0, false)); avgFiSQL.append(") dr, "); diff --git a/luminex/src/org/labkey/luminex/query/AnalyteTable.java b/luminex/src/org/labkey/luminex/query/AnalyteTable.java index e398266aed..e4ef2af1fc 100644 --- a/luminex/src/org/labkey/luminex/query/AnalyteTable.java +++ b/luminex/src/org/labkey/luminex/query/AnalyteTable.java @@ -30,16 +30,13 @@ import org.labkey.api.exp.api.ExperimentService; import org.labkey.api.exp.property.Domain; import org.labkey.api.exp.property.DomainProperty; -import org.labkey.api.query.DuplicateKeyException; import org.labkey.api.query.ExprColumn; import org.labkey.api.query.FieldKey; import org.labkey.api.query.FilteredTable; import org.labkey.api.query.LookupForeignKey; import org.labkey.api.query.PropertyForeignKey; import org.labkey.api.query.QueryUpdateService; -import org.labkey.api.query.QueryUpdateServiceException; import org.labkey.api.query.RowIdQueryUpdateService; -import org.labkey.api.query.ValidationException; import org.labkey.api.security.User; import org.labkey.api.security.UserPrincipal; import org.labkey.api.security.permissions.Permission; @@ -50,7 +47,6 @@ import org.labkey.luminex.LuminexAssayProvider; import org.labkey.luminex.model.Analyte; -import java.sql.SQLException; import java.util.Map; import java.util.TreeMap; @@ -60,18 +56,18 @@ */ public class AnalyteTable extends AbstractLuminexTable { - public AnalyteTable(final LuminexProtocolSchema schema, boolean filter) + public AnalyteTable(final LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoAnalytes(), schema, filter); + super(LuminexProtocolSchema.getTableInfoAnalytes(), schema, cf, filter); setName(LuminexProtocolSchema.ANALYTE_TABLE_NAME); setPublicSchemaName(AssaySchema.NAME); addColumn(wrapColumn(getRealTable().getColumn("Name"))); - addColumn(wrapColumn("Data", getRealTable().getColumn("DataId"))).setFk(new LookupForeignKey("RowId") + addColumn(wrapColumn("Data", getRealTable().getColumn("DataId"))).setFk(new LookupForeignKey(cf,"RowId", null) { public TableInfo getLookupTableInfo() { - return _userSchema.createDataFileTable(); + return _userSchema.createDataFileTable(getLookupContainerFilter()); } }); addColumn(wrapColumn(getRealTable().getColumn("RowId"))).setHidden(true); @@ -83,30 +79,30 @@ public TableInfo getLookupTableInfo() addColumn(wrapColumn(getRealTable().getColumn("NegativeBead"))); ColumnInfo titrationColumn = addColumn(wrapColumn("Standard", getRealTable().getColumn("RowId"))); - titrationColumn.setFk(new MultiValuedForeignKey(new LookupForeignKey("Analyte") + titrationColumn.setFk(new MultiValuedForeignKey(new LookupForeignKey(cf,"Analyte", null) { @Override public TableInfo getLookupTableInfo() { - FilteredTable result = new FilteredTable<>(LuminexProtocolSchema.getTableInfoAnalyteTitration(), schema); + final FilteredTable result = new FilteredTable<>(LuminexProtocolSchema.getTableInfoAnalyteTitration(), schema, getLookupContainerFilter()); ColumnInfo titrationColumn = result.addColumn(result.wrapColumn("Titration", result.getRealTable().getColumn("TitrationId"))); - titrationColumn.setFk(new LookupForeignKey("RowId") + titrationColumn.setFk(new LookupForeignKey(cf,"RowId", null) { @Override public TableInfo getLookupTableInfo() { - TitrationTable titrationTable = _userSchema.createTitrationTable(false); + TitrationTable titrationTable = _userSchema.createTitrationTable(getLookupContainerFilter(), false); titrationTable.addCondition(new SimpleFilter(FieldKey.fromParts("Standard"), Boolean.TRUE)); return titrationTable; } }); ColumnInfo analyteColumn = result.addColumn(result.wrapColumn("Analyte", result.getRealTable().getColumn("AnalyteId"))); - analyteColumn.setFk(new LookupForeignKey("RowId") + analyteColumn.setFk(new LookupForeignKey(cf,"RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createAnalyteTable(false); + return _userSchema.createAnalyteTable(getLookupContainerFilter(), false); } }); return result; @@ -126,7 +122,7 @@ public TableInfo getLookupTableInfo() { map.put(pd.getName(), pd.getPropertyDescriptor()); } - colProperty.setFk(new PropertyForeignKey(map, _userSchema)); + colProperty.setFk(new PropertyForeignKey(_userSchema, getContainerFilter(), map)); colProperty.setIsUnselectable(true); colProperty.setReadOnly(true); colProperty.setShownInInsertView(false); diff --git a/luminex/src/org/labkey/luminex/query/AnalyteTitrationTable.java b/luminex/src/org/labkey/luminex/query/AnalyteTitrationTable.java index ad85b437a2..e10a923a68 100644 --- a/luminex/src/org/labkey/luminex/query/AnalyteTitrationTable.java +++ b/luminex/src/org/labkey/luminex/query/AnalyteTitrationTable.java @@ -36,7 +36,6 @@ import org.labkey.api.query.LookupForeignKey; import org.labkey.api.query.QueryForeignKey; import org.labkey.api.query.QueryUpdateService; -import org.labkey.api.query.QueryUpdateServiceException; import org.labkey.api.query.ValidationException; import org.labkey.api.security.User; import org.labkey.api.security.UserPrincipal; @@ -68,28 +67,28 @@ */ public class AnalyteTitrationTable extends AbstractCurveFitPivotTable { - public AnalyteTitrationTable(final LuminexProtocolSchema schema, boolean filter) + public AnalyteTitrationTable(final LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoAnalyteTitration(), schema, filter, "AnalyteId"); + super(LuminexProtocolSchema.getTableInfoAnalyteTitration(), schema, cf, filter, "AnalyteId"); setName(LuminexProtocolSchema.ANALYTE_TITRATION_TABLE_NAME); ColumnInfo analyteCol = addColumn(wrapColumn("Analyte", getRealTable().getColumn("AnalyteId"))); - analyteCol.setFk(new LookupForeignKey("RowId") + analyteCol.setFk(new LookupForeignKey(cf, "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createAnalyteTable(false); + return _userSchema.createAnalyteTable(getLookupContainerFilter(),false); } }); setTitleColumn(analyteCol.getName()); ColumnInfo titrationCol = addColumn(wrapColumn("Titration", getRealTable().getColumn("TitrationId"))); - LookupForeignKey titrationFk = new LookupForeignKey("RowId") + LookupForeignKey titrationFk = new LookupForeignKey(cf,"RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createTitrationTable(false); + return _userSchema.createTitrationTable(getLookupContainerFilter(),false); } }; titrationFk.setPrefixColumnCaption(false); @@ -113,7 +112,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) addColumn(maxFiFlagEnabledColumn); ColumnInfo guideSetCol = addColumn(wrapColumn("GuideSet", getRealTable().getColumn("GuideSetId"))); - guideSetCol.setFk(new QueryForeignKey(schema, null, "GuideSet", "RowId", "AnalyteName")); + guideSetCol.setFk(QueryForeignKey.from(schema, getContainerFilter()).to("GuideSet", "RowId", "AnalyteName")); addColumn(wrapColumn(getRealTable().getColumn("IncludeInGuideSetCalculation"))); @@ -195,14 +194,14 @@ public boolean isFilterable() setDefaultVisibleColumns(defaultCols); } - protected LookupForeignKey createCurveFitFK(final String curveType) + protected LookupForeignKey createCurveFitFK(ContainerFilter cf, final String curveType) { - LookupForeignKey fk = new LookupForeignKey("AnalyteId") + LookupForeignKey fk = new LookupForeignKey(cf,"AnalyteId", null) { @Override public TableInfo getLookupTableInfo() { - CurveFitTable result = _userSchema.createCurveFitTable(false); + CurveFitTable result = _userSchema.createCurveFitTable(getLookupContainerFilter(),false); result.addCondition(result.getRealTable().getColumn("CurveType"), curveType); return result; } @@ -235,7 +234,7 @@ public boolean hasPermission(@NotNull UserPrincipal user, @NotNull Class is analyteid/titrationid combo - return new AbstractLuminexControlUpdateService(this, AnalyteTitration.class) + return new AbstractLuminexControlUpdateService<>(this, AnalyteTitration.class) { @Override protected AnalyteTitration createNewBean() diff --git a/luminex/src/org/labkey/luminex/query/CurveFitTable.java b/luminex/src/org/labkey/luminex/query/CurveFitTable.java index 3c6a294a9b..4edb9b1506 100644 --- a/luminex/src/org/labkey/luminex/query/CurveFitTable.java +++ b/luminex/src/org/labkey/luminex/query/CurveFitTable.java @@ -34,9 +34,9 @@ */ public class CurveFitTable extends AbstractLuminexTable { - public CurveFitTable(LuminexProtocolSchema schema, boolean filterTable) + public CurveFitTable(LuminexProtocolSchema schema, ContainerFilter cf, boolean filterTable) { - super(LuminexProtocolSchema.getTableInfoCurveFit(), schema, filterTable); + super(LuminexProtocolSchema.getTableInfoCurveFit(), schema, cf, filterTable); setName(LuminexProtocolSchema.CURVE_FIT_TABLE_NAME); wrapAllColumns(true); ColumnInfo titrationCol = getColumn("TitrationId"); @@ -46,7 +46,7 @@ public CurveFitTable(LuminexProtocolSchema schema, boolean filterTable) @Override public TableInfo getLookupTableInfo() { - return _userSchema.createTitrationTable(false); + return _userSchema.createTitrationTable(cf,false); } }); @@ -57,7 +57,7 @@ public TableInfo getLookupTableInfo() @Override public TableInfo getLookupTableInfo() { - return _userSchema.createAnalyteTable(false); + return _userSchema.createAnalyteTable(cf,false); } }); @@ -108,6 +108,5 @@ protected SQLFragment createContainerFilterSQL(ContainerFilter filter, Container } sql.append("))"); return sql; - } } diff --git a/luminex/src/org/labkey/luminex/query/GuideSetCurveFitTable.java b/luminex/src/org/labkey/luminex/query/GuideSetCurveFitTable.java index 557c54c202..d0a763850e 100644 --- a/luminex/src/org/labkey/luminex/query/GuideSetCurveFitTable.java +++ b/luminex/src/org/labkey/luminex/query/GuideSetCurveFitTable.java @@ -36,20 +36,20 @@ public class GuideSetCurveFitTable extends VirtualTable i private @NotNull ContainerFilter _containerFilter = ContainerFilter.CURRENT; /** @param curveType the type of curve to filter the results to. Null means don't filter */ - public GuideSetCurveFitTable(LuminexProtocolSchema schema, String curveType) + public GuideSetCurveFitTable(LuminexProtocolSchema schema, ContainerFilter cf, String curveType) { - super(schema.getDbSchema(), LuminexProtocolSchema.GUIDE_SET_CURVE_FIT_TABLE_NAME, schema); + super(schema.getDbSchema(), LuminexProtocolSchema.GUIDE_SET_CURVE_FIT_TABLE_NAME, schema, cf); _curveType = curveType; setDescription("Contains one row per curve fit/guide set combination, and contains average and other statistics for all of the matching runs"); ColumnInfo guideSetIdColumn = new ColumnInfo("GuideSetId", this, JdbcType.INTEGER); guideSetIdColumn.setLabel("Guide Set"); - guideSetIdColumn.setFk(new LookupForeignKey("RowId") + guideSetIdColumn.setFk(new LookupForeignKey(cf, "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createGuideSetTable(false); + return _userSchema.createGuideSetTable(getLookupContainerFilter(),false); } }); addColumn(guideSetIdColumn); diff --git a/luminex/src/org/labkey/luminex/query/GuideSetTable.java b/luminex/src/org/labkey/luminex/query/GuideSetTable.java index 6eeb1766e2..29d6e9aa76 100644 --- a/luminex/src/org/labkey/luminex/query/GuideSetTable.java +++ b/luminex/src/org/labkey/luminex/query/GuideSetTable.java @@ -37,13 +37,11 @@ import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.exp.api.ExperimentService; import org.labkey.api.query.AliasedColumn; -import org.labkey.api.query.DuplicateKeyException; import org.labkey.api.query.ExprColumn; import org.labkey.api.query.FieldKey; import org.labkey.api.query.LookupForeignKey; import org.labkey.api.query.QueryService; import org.labkey.api.query.QueryUpdateService; -import org.labkey.api.query.QueryUpdateServiceException; import org.labkey.api.query.RowIdQueryUpdateService; import org.labkey.api.query.UserIdQueryForeignKey; import org.labkey.api.query.ValidationException; @@ -59,11 +57,9 @@ import java.io.IOException; import java.io.Writer; -import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -73,9 +69,9 @@ */ public class GuideSetTable extends AbstractCurveFitPivotTable { - public GuideSetTable(final LuminexProtocolSchema schema, boolean filter) + public GuideSetTable(final LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoGuideSet(), schema, filter, "RowId"); + super(LuminexProtocolSchema.getTableInfoGuideSet(), schema, cf, filter, "RowId"); setName(LuminexProtocolSchema.GUIDE_SET_TABLE_NAME); for (ColumnInfo col : getRealTable().getColumns()) @@ -168,7 +164,7 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep addColumn(valueBasedCol); addFIColumns(LuminexProtocolSchema.getTableInfoAnalyteTitration(), "MaxFI", "TitrationMax", "Titration Max", "GuideSetId"); - AnalyteSinglePointControlTable analyteSinglePointControlTable = schema.createAnalyteSinglePointControlTable(false); + AnalyteSinglePointControlTable analyteSinglePointControlTable = schema.createAnalyteSinglePointControlTable(cf, false); analyteSinglePointControlTable.setContainerFilter(ContainerFilter.EVERYTHING); addFIColumns(analyteSinglePointControlTable, "AverageFiBkgd", "SinglePointControl", "Single Point Control", "GuideSet"); @@ -178,7 +174,7 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep addRunCounts(); - ForeignKey userIdForeignKey = new UserIdQueryForeignKey(schema.getUser(), schema.getContainer(), true); + ForeignKey userIdForeignKey = new UserIdQueryForeignKey(schema, true); getColumn("ModifiedBy").setFk(userIdForeignKey); getColumn("CreatedBy").setFk(userIdForeignKey); @@ -318,14 +314,14 @@ private void addRunCounts() { addColumn(aucRunCounts); } - protected LookupForeignKey createCurveFitFK(final String curveType) + protected LookupForeignKey createCurveFitFK(ContainerFilter cf, final String curveType) { - return new LookupForeignKey("GuideSetId") + return new LookupForeignKey(cf, "GuideSetId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createGuideSetCurveFitTable(curveType); + return _userSchema.createGuideSetCurveFitTable(getLookupContainerFilter(), curveType); } }; } diff --git a/luminex/src/org/labkey/luminex/query/LuminexDataTable.java b/luminex/src/org/labkey/luminex/query/LuminexDataTable.java index 044892f88a..a70e3b6549 100644 --- a/luminex/src/org/labkey/luminex/query/LuminexDataTable.java +++ b/luminex/src/org/labkey/luminex/query/LuminexDataTable.java @@ -19,6 +19,7 @@ import org.labkey.api.collections.CaseInsensitiveHashMap; import org.labkey.api.collections.CaseInsensitiveHashSet; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.ContainerForeignKey; import org.labkey.api.data.DelegatingContainerFilter; import org.labkey.api.data.DisplayColumn; @@ -89,9 +90,9 @@ public class LuminexDataTable extends FilteredTable imple REMAPPED_SCHEMA_COLUMNS = Collections.unmodifiableMap(result); } - public LuminexDataTable(LuminexProtocolSchema schema) + public LuminexDataTable(LuminexProtocolSchema schema, ContainerFilter cf) { - super(LuminexProtocolSchema.getTableInfoDataRow(), schema); + super(LuminexProtocolSchema.getTableInfoDataRow(), schema, cf); final ExpProtocol protocol = schema.getProtocol(); setName(AssayProtocolSchema.DATA_TABLE_NAME); @@ -102,11 +103,11 @@ public LuminexDataTable(LuminexProtocolSchema schema) setDescription("Contains all the Luminex data rows for the " + protocol.getName() + " assay definition"); ColumnInfo dataColumn = addColumn(wrapColumn("Data", getRealTable().getColumn("DataId"))); - dataColumn.setFk(new LookupForeignKey("RowId") + dataColumn.setFk(new LookupForeignKey(cf, "RowId", null) { public TableInfo getLookupTableInfo() { - ExpDataTable result = _userSchema.createDataFileTable(); + ExpDataTable result = _userSchema.createDataFileTable(getLookupContainerFilter()); result.setContainerFilter(new DelegatingContainerFilter(LuminexDataTable.this)); return result; } @@ -116,7 +117,7 @@ public TableInfo getLookupTableInfo() rowIdColumn.setKeyField(true); addColumn(wrapColumn(getRealTable().getColumn("LSID"))).setHidden(true); ColumnInfo protocolColumn = addColumn(wrapColumn("Protocol", getRealTable().getColumn("ProtocolId"))); - protocolColumn.setFk(new ExpSchema(_userSchema.getUser(), _userSchema.getContainer()).getProtocolForeignKey("RowId")); + protocolColumn.setFk(new ExpSchema(_userSchema.getUser(), _userSchema.getContainer()).getProtocolForeignKey(cf,"RowId")); protocolColumn.setHidden(true); addColumn(wrapColumn(getRealTable().getColumn("WellRole"))); addColumn(wrapColumn(getRealTable().getColumn("Type"))); @@ -169,23 +170,23 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) addColumn(wrapColumn(getRealTable().getColumn("Summary"))); ColumnInfo titrationColumn = addColumn(wrapColumn("Titration", getRealTable().getColumn("TitrationId"))); - titrationColumn.setFk(new LookupForeignKey("RowId") + titrationColumn.setFk(new LookupForeignKey(cf, "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createTitrationTable(false); + return _userSchema.createTitrationTable(getLookupContainerFilter(), false); } }); ColumnInfo analyteTitrationColumn = wrapColumn("AnalyteTitration", getRealTable().getColumn("AnalyteId")); analyteTitrationColumn.setIsUnselectable(true); - LookupForeignKey atFK = new LookupForeignKey() + LookupForeignKey atFK = new LookupForeignKey(cf, null, null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createAnalyteTitrationTable(false); + return _userSchema.createAnalyteTitrationTable(getLookupContainerFilter(), false); } @Override @@ -204,12 +205,12 @@ protected ColumnInfo getPkColumn(TableInfo table) singlePointControlCol.setHidden(true); ColumnInfo analyteSinglePointControlColumn = wrapColumn("AnalyteSinglePointControl", getRealTable().getColumn("AnalyteId")); analyteSinglePointControlColumn.setIsUnselectable(true); - LookupForeignKey aspcFK = new LookupForeignKey() + LookupForeignKey aspcFK = new LookupForeignKey(cf, null, null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createAnalyteSinglePointControlTable(false); + return _userSchema.createAnalyteSinglePointControlTable(getLookupContainerFilter(), false); } @Override @@ -314,7 +315,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) setDefaultVisibleColumns(defaultCols); - getColumn("Analyte").setFk(new LuminexProtocolSchema.AnalyteForeignKey(_userSchema)); + getColumn("Analyte").setFk(new LuminexProtocolSchema.AnalyteForeignKey(_userSchema, cf)); SQLFragment protocolIDFilter = new SQLFragment("ProtocolID = ?"); protocolIDFilter.add(_userSchema.getProtocol().getRowId()); diff --git a/luminex/src/org/labkey/luminex/query/LuminexProtocolSchema.java b/luminex/src/org/labkey/luminex/query/LuminexProtocolSchema.java index 17f265b24c..8fb8832086 100644 --- a/luminex/src/org/labkey/luminex/query/LuminexProtocolSchema.java +++ b/luminex/src/org/labkey/luminex/query/LuminexProtocolSchema.java @@ -161,28 +161,28 @@ public synchronized List getCurveTypes() } @Override - protected TableInfo createProviderTable(String tableType) + protected TableInfo createProviderTable(String tableType, ContainerFilter cf) { if (tableType != null) { if (ANALYTE_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createAnalyteTable(true); + return createAnalyteTable(cf, true); } if (TITRATION_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createTitrationTable(true); + return createTitrationTable(cf, true); } if (GUIDE_SET_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createGuideSetTable(true); + return createGuideSetTable(cf, true); } if (ANALYTE_TITRATION_TABLE_NAME.equalsIgnoreCase(tableType)) { - AnalyteTitrationTable result = createAnalyteTitrationTable(true); + AnalyteTitrationTable result = createAnalyteTitrationTable(cf, true); SQLFragment filter = new SQLFragment("AnalyteId IN (SELECT a.RowId FROM "); filter.append(getTableInfoAnalytes(), "a"); filter.append(" WHERE a.DataId "); @@ -194,7 +194,7 @@ protected TableInfo createProviderTable(String tableType) if (DATA_FILE_TABLE_NAME.equalsIgnoreCase(tableType)) { - ExpDataTable result = createDataFileTable(); + ExpDataTable result = createDataFileTable(cf); SQLFragment filter = new SQLFragment("RowId"); filter.append(createDataFilterInClause()); result.addCondition(filter, FieldKey.fromParts("RowId")); @@ -203,7 +203,7 @@ protected TableInfo createProviderTable(String tableType) if (WELL_EXCLUSION_TABLE_NAME.equalsIgnoreCase(tableType)) { - FilteredTable result = createWellExclusionTable(true); + FilteredTable result = createWellExclusionTable(cf, true); result.addCondition(new SimpleFilter(FieldKey.fromParts("Type"), null, CompareType.NONBLANK)); result.removeColumn(new ColumnInfo("Dilution")); SQLFragment filter = new SQLFragment("DataId"); @@ -214,7 +214,7 @@ protected TableInfo createProviderTable(String tableType) if (TITRATION_EXCLUSION_TABLE_NAME.equalsIgnoreCase(tableType)) { - FilteredTable result = createWellExclusionTable(true); + FilteredTable result = createWellExclusionTable(cf, true); result.setName(TITRATION_EXCLUSION_TABLE_NAME); SimpleFilter exclusionFilter = new SimpleFilter(FieldKey.fromParts("Type"), null, CompareType.ISBLANK); exclusionFilter.addCondition(FieldKey.fromParts("Dilution"), null, CompareType.ISBLANK); @@ -232,7 +232,7 @@ protected TableInfo createProviderTable(String tableType) if (SINGLEPOINT_UNKNOWN_EXCLUSION_TABLE_NAME.equalsIgnoreCase(tableType)) { - FilteredTable result = createWellExclusionTable(true); + FilteredTable result = createWellExclusionTable(cf, true); result.setName(SINGLEPOINT_UNKNOWN_EXCLUSION_TABLE_NAME); SimpleFilter exclusionFilter = new SimpleFilter(FieldKey.fromParts("Type"), null, CompareType.ISBLANK); exclusionFilter.addCondition(FieldKey.fromParts("Dilution"), null, CompareType.NONBLANK); @@ -249,7 +249,7 @@ protected TableInfo createProviderTable(String tableType) if (CURVE_FIT_TABLE_NAME.equalsIgnoreCase(tableType)) { - CurveFitTable result = createCurveFitTable(true); + CurveFitTable result = createCurveFitTable(cf, true); SQLFragment filter = new SQLFragment("AnalyteId IN (SELECT a.RowId FROM "); filter.append(getTableInfoAnalytes(), "a"); filter.append(" WHERE a.DataId "); @@ -261,12 +261,12 @@ protected TableInfo createProviderTable(String tableType) if (GUIDE_SET_CURVE_FIT_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createGuideSetCurveFitTable(); + return createGuideSetCurveFitTable(cf); } if (RUN_EXCLUSION_TABLE_NAME.equalsIgnoreCase(tableType)) { - FilteredTable result = createRunExclusionTable(true); + FilteredTable result = createRunExclusionTable(cf, true); SQLFragment filter = new SQLFragment("RunId IN (SELECT pa.RunId FROM "); filter.append(ExperimentService.get().getTinfoProtocolApplication(), "pa"); filter.append(", "); @@ -280,67 +280,67 @@ protected TableInfo createProviderTable(String tableType) if (ANALYTE_TITRATION_QC_FLAG_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createAnalyteTitrationQCFlagTable(); + return createAnalyteTitrationQCFlagTable(cf); } if (ANALYTE_SINGLE_POONT_CONTROL_QC_FLAG_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createAnalyteSinglePointControlQCFlagTable(); + return createAnalyteSinglePointControlQCFlagTable(cf); } if (CV_QC_FLAG_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createCVQCFlagTable(); + return createCVQCFlagTable(cf); } if (SINGLE_POINT_CONTROL_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createSinglePointControlTable(true); + return createSinglePointControlTable(cf, true); } if (ANALYTE_SINGLE_POINT_CONTROL_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createAnalyteSinglePointControlTable(true); + return createAnalyteSinglePointControlTable(cf, true); } } return super.createProviderTable(tableType); } - public AnalyteTitrationTable createAnalyteTitrationTable(boolean filter) + public AnalyteTitrationTable createAnalyteTitrationTable(ContainerFilter cf, boolean filter) { - return new AnalyteTitrationTable(this, filter); + return new AnalyteTitrationTable(this, cf, filter); } - public GuideSetTable createGuideSetTable(boolean filterTable) + public GuideSetTable createGuideSetTable(ContainerFilter cf, boolean filterTable) { - return new GuideSetTable(this, filterTable); + return new GuideSetTable(this, cf, filterTable); } - public CurveFitTable createCurveFitTable(boolean filterTable) + public CurveFitTable createCurveFitTable(ContainerFilter cf, boolean filterTable) { - return new CurveFitTable(this, filterTable); + return new CurveFitTable(this, cf, filterTable); } - public GuideSetCurveFitTable createGuideSetCurveFitTable() + public GuideSetCurveFitTable createGuideSetCurveFitTable(ContainerFilter cf) { - return new GuideSetCurveFitTable(this, null); + return new GuideSetCurveFitTable(this, cf, null); } /** @param curveType the type of curve to filter the results to */ - public GuideSetCurveFitTable createGuideSetCurveFitTable(String curveType) + public GuideSetCurveFitTable createGuideSetCurveFitTable(ContainerFilter cf, String curveType) { - return new GuideSetCurveFitTable(this, curveType); + return new GuideSetCurveFitTable(this, cf, curveType); } - private WellExclusionTable createWellExclusionTable(boolean filterTable) + private WellExclusionTable createWellExclusionTable(ContainerFilter cf, boolean filterTable) { - return new WellExclusionTable(this, filterTable); + return new WellExclusionTable(this, cf, filterTable); } - private SinglePointControlTable createSinglePointControlTable(boolean filterTable) + private SinglePointControlTable createSinglePointControlTable(ContainerFilter cf, boolean filterTable) { - SinglePointControlTable result = new SinglePointControlTable(this, filterTable); + SinglePointControlTable result = new SinglePointControlTable(this, cf, filterTable); if (filterTable) { SQLFragment sql = new SQLFragment("RunId IN (SELECT pa.RunId FROM "); @@ -355,9 +355,9 @@ private SinglePointControlTable createSinglePointControlTable(boolean filterTabl return result; } - public AnalyteSinglePointControlTable createAnalyteSinglePointControlTable(boolean filterTable) + public AnalyteSinglePointControlTable createAnalyteSinglePointControlTable(ContainerFilter cf, boolean filterTable) { - AnalyteSinglePointControlTable result = new AnalyteSinglePointControlTable(this, filterTable); + AnalyteSinglePointControlTable result = new AnalyteSinglePointControlTable(this, cf, filterTable); if (filterTable) { SQLFragment sql = new SQLFragment("SinglePointControlId IN (SELECT RowId FROM "); @@ -374,14 +374,14 @@ public AnalyteSinglePointControlTable createAnalyteSinglePointControlTable(boole return result; } - private RunExclusionTable createRunExclusionTable(boolean filterTable) + private RunExclusionTable createRunExclusionTable(ContainerFilter cf, boolean filterTable) { - return new RunExclusionTable(this, filterTable); + return new RunExclusionTable(this, cf, filterTable); } - public AnalyteTable createAnalyteTable(boolean filterTable) + public AnalyteTable createAnalyteTable(ContainerFilter cf, boolean filterTable) { - AnalyteTable result = new AnalyteTable(this, filterTable); + AnalyteTable result = new AnalyteTable(this, cf, filterTable); if (filterTable) { @@ -393,9 +393,9 @@ public AnalyteTable createAnalyteTable(boolean filterTable) return result; } - public TitrationTable createTitrationTable(boolean filter) + public TitrationTable createTitrationTable(ContainerFilter cf, boolean filter) { - TitrationTable result = new TitrationTable(this, filter); + TitrationTable result = new TitrationTable(this, cf, filter); if (filter) { SQLFragment sql = new SQLFragment("RunId IN (SELECT pa.RunId FROM "); @@ -410,9 +410,9 @@ public TitrationTable createTitrationTable(boolean filter) return result; } - public ExpDataTable createDataFileTable() + public ExpDataTable createDataFileTable(ContainerFilter cf) { - final ExpDataTable ret = ExperimentService.get().createDataTable(DATA_FILE_TABLE_NAME, this); + final ExpDataTable ret = ExperimentService.get().createDataTable(DATA_FILE_TABLE_NAME, this, cf); ret.addColumn(ExpDataTable.Column.RowId); ret.addColumn(ExpDataTable.Column.Name); ret.addColumn(ExpDataTable.Column.Flag); @@ -431,8 +431,8 @@ public ExpDataTable createDataFileTable() { public TableInfo getLookupTableInfo() { - ExpRunTable result = AssayService.get().createRunTable(getProtocol(), AssayService.get().getProvider(getProtocol()), _user, _container); - result.setContainerFilter(ret.getContainerFilter()); + ExpRunTable result = AssayService.get().createRunTable(getProtocol(), AssayService.get().getProvider(getProtocol()), _user, _container, null); + result.setContainerFilter(getLookupContainerFilter()); return result; } }); @@ -452,9 +452,9 @@ public TableInfo getLookupTableInfo() } @Override - public LuminexDataTable createDataTable(boolean includeCopiedToStudyColumns) + public LuminexDataTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - LuminexDataTable table = new LuminexDataTable(this); + LuminexDataTable table = new LuminexDataTable(this, cf); if (includeCopiedToStudyColumns) { addCopiedToStudyColumns(table, true); @@ -462,16 +462,16 @@ public LuminexDataTable createDataTable(boolean includeCopiedToStudyColumns) return table; } - public ExpQCFlagTable createAnalyteTitrationQCFlagTable() + public ExpQCFlagTable createAnalyteTitrationQCFlagTable(ContainerFilter cf) { - ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ANALYTE_TITRATION_QC_FLAG_TABLE_NAME, this); + ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ANALYTE_TITRATION_QC_FLAG_TABLE_NAME, this, cf); result.populate(); result.setAssayProtocol(getProtocol()); ColumnInfo analyteColumn = result.addColumn("Analyte", ExpQCFlagTable.Column.IntKey1); - analyteColumn.setFk(new AnalyteForeignKey(this)); + analyteColumn.setFk(new AnalyteForeignKey(this, cf)); ColumnInfo titrationColumn = result.addColumn("Titration", ExpQCFlagTable.Column.IntKey2); - titrationColumn.setFk(new TitrationForeignKey(this)); + titrationColumn.setFk(new TitrationForeignKey(this, cf)); result.setDescription("Contains Run QC Flags that are associated with an analyte/titration combination"); SQLFragment nonCVFlagFilter = new SQLFragment(" Key1 IS NULL AND Key2 IS NULL AND FlagType != ?"); @@ -486,16 +486,16 @@ public ExpQCFlagTable createAnalyteTitrationQCFlagTable() return result; } - public ExpQCFlagTable createAnalyteSinglePointControlQCFlagTable() + public ExpQCFlagTable createAnalyteSinglePointControlQCFlagTable(ContainerFilter cf) { - ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ANALYTE_SINGLE_POONT_CONTROL_QC_FLAG_TABLE_NAME, this); + ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ANALYTE_SINGLE_POONT_CONTROL_QC_FLAG_TABLE_NAME, this, cf); result.populate(); result.setAssayProtocol(getProtocol()); ColumnInfo analyteColumn = result.addColumn("Analyte", ExpQCFlagTable.Column.IntKey1); - analyteColumn.setFk(new AnalyteForeignKey(this)); + analyteColumn.setFk(new AnalyteForeignKey(this, cf)); ColumnInfo titrationColumn = result.addColumn("SinglePointControl", ExpQCFlagTable.Column.IntKey2); - titrationColumn.setFk(new SinglePointControlForeignKey(this)); + titrationColumn.setFk(new SinglePointControlForeignKey(this, cf)); result.setDescription("Contains Run QC Flags that are associated with an analyte/single point control combination"); SQLFragment nonCVFlagFilter = new SQLFragment(" Key1 IS NULL AND Key2 IS NULL AND FlagType = ?"); @@ -510,14 +510,14 @@ public ExpQCFlagTable createAnalyteSinglePointControlQCFlagTable() return result; } - public ExpQCFlagTable createCVQCFlagTable() + public ExpQCFlagTable createCVQCFlagTable(ContainerFilter cf) { - ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ExpSchema.TableType.QCFlags.toString(), this); + ExpQCFlagTable result = ExperimentService.get().createQCFlagsTable(ExpSchema.TableType.QCFlags.toString(), this, cf); result.populate(); result.setAssayProtocol(getProtocol()); ColumnInfo analyteColumn = result.addColumn("Analyte", ExpQCFlagTable.Column.IntKey1); - analyteColumn.setFk(new AnalyteForeignKey(this)); + analyteColumn.setFk(new AnalyteForeignKey(this, cf)); result.addColumn("DataId", ExpQCFlagTable.Column.IntKey2); ColumnInfo wellTypeColumn = result.addColumn("WellType", ExpQCFlagTable.Column.Key1); wellTypeColumn.setLabel("Well Type"); @@ -627,26 +627,26 @@ public static TableInfo getTableInfoRunExclusionAnalyte() return getSchema().getTable(RUN_EXCLUSION_ANALYTE_TABLE_NAME); } - public TableInfo createWellExclusionAnalyteTable() + public TableInfo createWellExclusionAnalyteTable(ContainerFilter cf) { - FilteredTable result = new FilteredTable<>(getTableInfoWellExclusionAnalyte(), this); + FilteredTable result = new FilteredTable<>(getTableInfoWellExclusionAnalyte(), this, cf); result.wrapAllColumns(true); - result.getColumn("AnalyteId").setFk(new AnalyteForeignKey(this)); + result.getColumn("AnalyteId").setFk(new AnalyteForeignKey(this, cf)); return result; } - public TableInfo createRunExclusionAnalyteTable() + public TableInfo createRunExclusionAnalyteTable(ContainerFilter cf) { - FilteredTable result = new FilteredTable<>(getTableInfoRunExclusionAnalyte(), this); + FilteredTable result = new FilteredTable<>(getTableInfoRunExclusionAnalyte(), this, cf); result.wrapAllColumns(true); - result.getColumn("AnalyteId").setFk(new AnalyteForeignKey(this)); + result.getColumn("AnalyteId").setFk(new AnalyteForeignKey(this, cf)); return result; } @Override - public ExpRunTable createRunsTable() + public ExpRunTable createRunsTable(ContainerFilter cf) { - final ExpRunTable result = super.createRunsTable(); + final ExpRunTable result = super.createRunsTable(cf); // Render any PDF outputs we found as direct download links since they should be plots of standard curves ColumnInfo curvesColumn = result.addColumn("Curves", ExpRunTable.Column.Name); @@ -745,16 +745,16 @@ public static class AnalyteForeignKey extends LookupForeignKey { private final LuminexProtocolSchema _schema; - public AnalyteForeignKey(LuminexProtocolSchema schema) + public AnalyteForeignKey(LuminexProtocolSchema schema, ContainerFilter cf) { - super("RowId"); + super(cf,"RowId", null); _schema = schema; } @Override public TableInfo getLookupTableInfo() { - return _schema.createAnalyteTable(false); + return _schema.createAnalyteTable(getLookupContainerFilter(),false); } } @@ -762,16 +762,16 @@ public static class TitrationForeignKey extends LookupForeignKey { private final LuminexProtocolSchema _schema; - public TitrationForeignKey(LuminexProtocolSchema schema) + public TitrationForeignKey(LuminexProtocolSchema schema, ContainerFilter cf) { - super("RowId"); + super(cf,"RowId", null); _schema = schema; } @Override public TableInfo getLookupTableInfo() { - return _schema.createTitrationTable(false); + return _schema.createTitrationTable(getLookupContainerFilter(), false); } } @@ -779,16 +779,16 @@ public static class SinglePointControlForeignKey extends LookupForeignKey { private final LuminexProtocolSchema _schema; - public SinglePointControlForeignKey(LuminexProtocolSchema schema) + public SinglePointControlForeignKey(LuminexProtocolSchema schema, ContainerFilter cf) { - super("RowId"); + super(cf,"RowId", null); _schema = schema; } @Override public TableInfo getLookupTableInfo() { - return _schema.createSinglePointControlTable(false); + return _schema.createSinglePointControlTable(getLookupContainerFilter(), false); } } @@ -827,7 +827,7 @@ public DataView createDataView() SimpleFilter f = new SimpleFilter(); f.addCondition(FieldKey.fromParts("Standard"), false, CompareType.EQUAL); f.addCondition(FieldKey.fromParts("Run"), Integer.parseInt(runId), CompareType.EQUAL); - TableSelector tbs = new TableSelector(getSchema().getTable("Titration"), f, null); + TableSelector tbs = new TableSelector(getSchema().getTable("Titration", getContainerFilter()), f, null); long rows = tbs.getRowCount(); if (rows > 0) { diff --git a/luminex/src/org/labkey/luminex/query/RunExclusionTable.java b/luminex/src/org/labkey/luminex/query/RunExclusionTable.java index f621313d6a..978d4adf58 100644 --- a/luminex/src/org/labkey/luminex/query/RunExclusionTable.java +++ b/luminex/src/org/labkey/luminex/query/RunExclusionTable.java @@ -41,26 +41,26 @@ */ public class RunExclusionTable extends AbstractExclusionTable { - public RunExclusionTable(LuminexProtocolSchema schema, boolean filter) + public RunExclusionTable(LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoRunExclusion(), schema, filter); + super(LuminexProtocolSchema.getTableInfoRunExclusion(), schema, cf, filter); getColumn("RunId").setLabel("Assay ID"); - getColumn("RunId").setFk(new LookupForeignKey("RowId") + getColumn("RunId").setFk(new LookupForeignKey(cf, "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createRunsTable(); + return _userSchema.createRunsTable(getLookupContainerFilter()); } }); - getColumn("Analytes").setFk(new MultiValuedForeignKey(new LookupForeignKey("RunId") + getColumn("Analytes").setFk(new MultiValuedForeignKey(new LookupForeignKey(cf, "RunId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createRunExclusionAnalyteTable(); + return _userSchema.createRunExclusionAnalyteTable(getLookupContainerFilter()); } }, "AnalyteId")); diff --git a/luminex/src/org/labkey/luminex/query/SinglePointControlTable.java b/luminex/src/org/labkey/luminex/query/SinglePointControlTable.java index 467972f71b..8aca5155dc 100644 --- a/luminex/src/org/labkey/luminex/query/SinglePointControlTable.java +++ b/luminex/src/org/labkey/luminex/query/SinglePointControlTable.java @@ -29,17 +29,17 @@ */ public class SinglePointControlTable extends AbstractLuminexTable { - public SinglePointControlTable(LuminexProtocolSchema schema, boolean filterTable) + public SinglePointControlTable(LuminexProtocolSchema schema, ContainerFilter cf, boolean filterTable) { // expose the actual columns in the table - super(LuminexProtocolSchema.getTableInfoSinglePointControl(), schema, filterTable); + super(LuminexProtocolSchema.getTableInfoSinglePointControl(), schema, cf, filterTable); setName(LuminexProtocolSchema.SINGLE_POINT_CONTROL_TABLE_NAME); addWrapColumn(getRealTable().getColumn("RowId")); addWrapColumn(getRealTable().getColumn("Name")); // Alias the RunId column to be consistent with other Schema columns ColumnInfo runColumn = addColumn(wrapColumn("Run", getRealTable().getColumn("RunId"))); - runColumn.setFk(new QueryForeignKey(schema, null, AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name")); + runColumn.setFk( QueryForeignKey.from(schema, cf).to(AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name") ); } @Override diff --git a/luminex/src/org/labkey/luminex/query/TitrationTable.java b/luminex/src/org/labkey/luminex/query/TitrationTable.java index 1885076ce9..38e56fee0f 100644 --- a/luminex/src/org/labkey/luminex/query/TitrationTable.java +++ b/luminex/src/org/labkey/luminex/query/TitrationTable.java @@ -34,9 +34,9 @@ */ public class TitrationTable extends AbstractLuminexTable { - public TitrationTable(LuminexProtocolSchema schema, boolean filter) + public TitrationTable(LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoTitration(), schema, filter); + super(LuminexProtocolSchema.getTableInfoTitration(), schema, cf, filter); setName(LuminexProtocolSchema.TITRATION_TABLE_NAME); addColumn(wrapColumn(getRealTable().getColumn("RowId"))).setHidden(true); @@ -63,7 +63,7 @@ public TitrationTable(LuminexProtocolSchema schema, boolean filter) addColumn(new ExprColumn(this, "IncludeInQcReport", qcReportSQL, JdbcType.BOOLEAN)); ColumnInfo runColumn = addColumn(wrapColumn("Run", getRealTable().getColumn("RunId"))); - QueryForeignKey runFk = new QueryForeignKey(schema, null, AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name"); + var runFk = QueryForeignKey.from(schema, cf).to(AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name"); runColumn.setFk(runFk); setTitleColumn("Name"); } diff --git a/luminex/src/org/labkey/luminex/query/WellExclusionTable.java b/luminex/src/org/labkey/luminex/query/WellExclusionTable.java index 1d27438795..a9de55909e 100644 --- a/luminex/src/org/labkey/luminex/query/WellExclusionTable.java +++ b/luminex/src/org/labkey/luminex/query/WellExclusionTable.java @@ -70,19 +70,19 @@ */ public class WellExclusionTable extends AbstractExclusionTable { - public WellExclusionTable(LuminexProtocolSchema schema, boolean filter) + public WellExclusionTable(LuminexProtocolSchema schema, ContainerFilter cf, boolean filter) { - super(LuminexProtocolSchema.getTableInfoWellExclusion(), schema, filter); + super(LuminexProtocolSchema.getTableInfoWellExclusion(), schema, cf, filter); getColumn("DataId").setLabel("Data File"); getColumn("DataId").setFk(new ExpSchema(schema.getUser(), schema.getContainer()).getDataIdForeignKey()); - getColumn("Analytes").setFk(new MultiValuedForeignKey(new LookupForeignKey("WellExclusionId") + getColumn("Analytes").setFk(new MultiValuedForeignKey(new LookupForeignKey(cf, "WellExclusionId", null) { @Override public TableInfo getLookupTableInfo() { - return _userSchema.createWellExclusionAnalyteTable(); + return _userSchema.createWellExclusionAnalyteTable(getLookupContainerFilter()); } }, "AnalyteId")); getColumn("Analytes").setUserEditable(false); diff --git a/microarray/src/org/labkey/microarray/PendingMageMLFilesView.java b/microarray/src/org/labkey/microarray/PendingMageMLFilesView.java index f0484937db..5231530d2e 100644 --- a/microarray/src/org/labkey/microarray/PendingMageMLFilesView.java +++ b/microarray/src/org/labkey/microarray/PendingMageMLFilesView.java @@ -142,7 +142,7 @@ protected void populateButtonBar(DataView view, ButtonBar bar) protected TableInfo createTable() { - ExpDataTable table = ExperimentService.get().createDataTable("pendingFile", getSchema()); + ExpDataTable table = ExperimentService.get().createDataTable("pendingFile", getSchema(), getContainerFilter()); table.setRun(null); table.setDataType(MicroarrayModule.MAGE_ML_INPUT_TYPE); table.populate(); diff --git a/microarray/src/org/labkey/microarray/affy/AffymetrixProtocolSchema.java b/microarray/src/org/labkey/microarray/affy/AffymetrixProtocolSchema.java index f1170c800c..77beddcf48 100644 --- a/microarray/src/org/labkey/microarray/affy/AffymetrixProtocolSchema.java +++ b/microarray/src/org/labkey/microarray/affy/AffymetrixProtocolSchema.java @@ -19,9 +19,10 @@ import org.jetbrains.annotations.Nullable; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerFilterable; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.DisplayColumnFactory; +import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.security.User; import org.labkey.api.study.assay.AssayProtocolSchema; @@ -37,16 +38,16 @@ public class AffymetrixProtocolSchema extends AssayProtocolSchema @Nullable @Override - public ContainerFilterable createDataTable(boolean includeCopiedToStudyColumns) + public TableInfo createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - return new AssayResultTable(this, includeCopiedToStudyColumns); + return new AssayResultTable(this, cf, includeCopiedToStudyColumns); } @Nullable @Override - public final ContainerFilterable createDataTable() + public final TableInfo createDataTable(ContainerFilter cf) { - ContainerFilterable table = super.createDataTable(); + TableInfo table = super.createDataTable(cf); if (null != table) { diff --git a/microarray/src/org/labkey/microarray/assay/MicroarrayProtocolSchema.java b/microarray/src/org/labkey/microarray/assay/MicroarrayProtocolSchema.java index 3a863b2f25..3c1e819fd2 100644 --- a/microarray/src/org/labkey/microarray/assay/MicroarrayProtocolSchema.java +++ b/microarray/src/org/labkey/microarray/assay/MicroarrayProtocolSchema.java @@ -20,6 +20,7 @@ import org.labkey.api.data.ActionButton; import org.labkey.api.data.ButtonBar; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.exp.query.ExpRunTable; import org.labkey.api.query.FieldKey; @@ -68,9 +69,9 @@ public ExpRunTable createRunsTable() } @Override - public AssayResultTable createDataTable(boolean includeCopiedToStudyColumns) + public AssayResultTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - AssayResultTable result = new AssayResultTable(this, includeCopiedToStudyColumns); + AssayResultTable result = new AssayResultTable(this, cf, includeCopiedToStudyColumns); if (!AbstractAssayProvider.getDomainByPrefix(getProtocol(), ExpProtocol.ASSAY_DOMAIN_DATA).getProperties().isEmpty()) { List cols = new ArrayList<>(result.getDefaultVisibleColumns()); diff --git a/microarray/src/org/labkey/microarray/matrix/ExpressionMatrixProtocolSchema.java b/microarray/src/org/labkey/microarray/matrix/ExpressionMatrixProtocolSchema.java index a67ef5bf72..7100bb7191 100644 --- a/microarray/src/org/labkey/microarray/matrix/ExpressionMatrixProtocolSchema.java +++ b/microarray/src/org/labkey/microarray/matrix/ExpressionMatrixProtocolSchema.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.query.FilteredTable; @@ -47,17 +48,17 @@ public ExpressionMatrixProtocolSchema(User user, Container container, @NotNull E } @Override - public FilteredTable createDataTable(boolean includeCopiedToStudyColumns) + public FilteredTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - FeatureDataTable result = new FeatureDataTable(this); + FeatureDataTable result = new FeatureDataTable(this, cf); result.setName(AssayProtocolSchema.DATA_TABLE_NAME); return result; } @Override - public TableInfo createTable(String name) + public TableInfo createTable(String name, ContainerFilter cf) { - return super.createTable(name, FEATURE_ID, SAMPLE_ID, VALUE_MEASURE_ID, TITLE); //TODO: Looks a bit funny, modify? + return super.createTable(name, cf, FEATURE_ID, SAMPLE_ID, VALUE_MEASURE_ID, TITLE); //TODO: Looks a bit funny, modify? } @Override @@ -69,9 +70,9 @@ public List getDistinctSampleIds() } @Override - public TableInfo getDataTableInfo() + public TableInfo getDataTableInfo(ContainerFilter cf) { - return new FeatureDataTable(this); + return new FeatureDataTable(this, cf); } public static TableInfo getTableInfoFeatureData() diff --git a/microarray/src/org/labkey/microarray/matrix/FeatureDataTable.java b/microarray/src/org/labkey/microarray/matrix/FeatureDataTable.java index 9d12fd29fe..6c60b620e4 100644 --- a/microarray/src/org/labkey/microarray/matrix/FeatureDataTable.java +++ b/microarray/src/org/labkey/microarray/matrix/FeatureDataTable.java @@ -34,9 +34,9 @@ public class FeatureDataTable extends FilteredTable { - public FeatureDataTable(ExpressionMatrixProtocolSchema schema) + public FeatureDataTable(ExpressionMatrixProtocolSchema schema, ContainerFilter cf) { - super(ExpressionMatrixProtocolSchema.getTableInfoFeatureData(), schema); + super(ExpressionMatrixProtocolSchema.getTableInfoFeatureData(), schema, cf); setDetailsURL(AbstractTableInfo.LINK_DISABLER); setImportURL(AbstractTableInfo.LINK_DISABLER); @@ -51,16 +51,20 @@ public FeatureDataTable(ExpressionMatrixProtocolSchema schema) ColumnInfo featureIdColumn = addColumn(wrapColumn(getRealTable().getColumn("FeatureId"))); featureIdColumn.setHidden(false); featureIdColumn.setLabel("Probe Id"); - featureIdColumn.setFk(new QueryForeignKey(MicroarrayUserSchema.SCHEMA_NAME, schema.getContainer(), null, - schema.getUser(), MicroarrayUserSchema.TABLE_FEATURE_ANNOTATION, "RowId", "FeatureId")); + featureIdColumn.setFk(QueryForeignKey + .from(schema, cf) + .schema(MicroarrayUserSchema.SCHEMA_NAME) + .to(MicroarrayUserSchema.TABLE_FEATURE_ANNOTATION, "RowId", "FeatureId")); ColumnInfo sampleIdColumn = addColumn(wrapColumn(getRealTable().getColumn("SampleId"))); sampleIdColumn.setHidden(false); sampleIdColumn.setLabel("Sample Id"); // Lookup to exp.materials since we don't know the sample set - sampleIdColumn.setFk(new QueryForeignKey(ExpSchema.SCHEMA_NAME, schema.getContainer(), null, schema.getUser(), - "materials","RowId","Name")); + sampleIdColumn.setFk(QueryForeignKey + .from(schema, cf) + .schema(ExpSchema.SCHEMA_NAME) + .to("materials", "RowId", "Name")); SQLFragment runSQL = new SQLFragment("(SELECT d.RunId FROM "); runSQL.append(ExperimentService.get().getTinfoData(), "d"); @@ -69,13 +73,17 @@ public FeatureDataTable(ExpressionMatrixProtocolSchema schema) runSQL.append(".DataId)"); ColumnInfo runIdColumn = new ExprColumn(this, "Run", runSQL, JdbcType.INTEGER); addColumn(runIdColumn); - runIdColumn.setFk(new QueryForeignKey(getUserSchema(), null, AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name")); + runIdColumn.setFk(QueryForeignKey + .from(getUserSchema(), getContainerFilter()) + .to(AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name")); ColumnInfo dataIdColumn = addColumn(wrapColumn(getRealTable().getColumn("DataId"))); dataIdColumn.setHidden(false); dataIdColumn.setLabel("Data Id"); - dataIdColumn.setFk(new QueryForeignKey(ExpSchema.SCHEMA_NAME, schema.getContainer(), null, schema.getUser(), ExpSchema.TableType.Data.toString(), - "RowId", "Name")); + dataIdColumn.setFk(QueryForeignKey + .from(getUserSchema(), getContainerFilter()) + .schema(ExpSchema.SCHEMA_NAME, schema.getContainer()) + .to( ExpSchema.TableType.Data.name(),"RowId", "Name")); List columns = new ArrayList<>(getDefaultVisibleColumns()); columns.remove(dataIdColumn.getFieldKey()); diff --git a/ms2/src/org/labkey/ms2/MS2Controller.java b/ms2/src/org/labkey/ms2/MS2Controller.java index 9fa29e45eb..8e4f9530ca 100644 --- a/ms2/src/org/labkey/ms2/MS2Controller.java +++ b/ms2/src/org/labkey/ms2/MS2Controller.java @@ -1570,7 +1570,7 @@ public ModelAndView getView(ProteinDisambiguationForm form, BindException errors } MS2Schema schema = new MS2Schema(getUser(), getContainer()); - SequencesTableInfo tableInfo = schema.createSequencesTable(); + SequencesTableInfo tableInfo = schema.createSequencesTable(null); MatchCriteria matchCriteria = MatchCriteria.getMatchCriteria(form.getTargetProteinMatchCriteria()); tableInfo.addProteinNameFilter(form.getTargetProtein(), matchCriteria == null ? MatchCriteria.PREFIX : matchCriteria); @@ -2999,7 +2999,7 @@ private QueryView createProteinGroupSearchView(final ProbabilityProteinSearchFor { protected TableInfo createTable() { - ProteinGroupTableInfo table = ((MS2Schema)getSchema()).createProteinGroupsForSearchTable(); + ProteinGroupTableInfo table = ((MS2Schema)getSchema()).createProteinGroupsForSearchTable(null); table.addPeptideFilter(form, getViewContext()); int[] seqIds = form.getSeqId(); if (seqIds.length <= 500) @@ -3204,7 +3204,7 @@ public int[] getSeqId() if (_seqId == null) { MS2Schema schema = new MS2Schema(_context.getUser(), _context.getContainer()); - SequencesTableInfo tableInfo = schema.createSequencesTable(); + SequencesTableInfo tableInfo = schema.createSequencesTable(null); tableInfo.addProteinNameFilter(getIdentifier(), isExactMatch() ? MatchCriteria.EXACT : MatchCriteria.PREFIX); if (isRestrictProteins()) { diff --git a/ms2/src/org/labkey/ms2/matrix/ProteinExpressionMatrixProtocolSchema.java b/ms2/src/org/labkey/ms2/matrix/ProteinExpressionMatrixProtocolSchema.java index ba54b98eee..0027c6245f 100644 --- a/ms2/src/org/labkey/ms2/matrix/ProteinExpressionMatrixProtocolSchema.java +++ b/ms2/src/org/labkey/ms2/matrix/ProteinExpressionMatrixProtocolSchema.java @@ -1,23 +1,24 @@ -/* - * Copyright (c) 2015 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +/* + * Copyright (c) 2015 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.labkey.ms2.matrix; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.query.FilteredTable; @@ -44,17 +45,17 @@ public ProteinExpressionMatrixProtocolSchema(User user, Container container, @No } @Override - public FilteredTable createDataTable(boolean includeCopiedToStudyColumns) + public FilteredTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - ProteinSequenceDataTable result = new ProteinSequenceDataTable(this); + ProteinSequenceDataTable result = new ProteinSequenceDataTable(this, cf); result.setName(AssayProtocolSchema.DATA_TABLE_NAME); return result; } @Override - public TableInfo createTable(String name) + public TableInfo createTable(String name, ContainerFilter cf) { - return super.createTable(name, SEQUENCE_ID, SAMPLE_ID, VALUE_MEASURE_ID, TITLE); + return super.createTable(name, cf, SEQUENCE_ID, SAMPLE_ID, VALUE_MEASURE_ID, TITLE); } @Override @@ -67,9 +68,9 @@ public List getDistinctSampleIds() } @Override - public TableInfo getDataTableInfo() + public TableInfo getDataTableInfo(ContainerFilter cf) { - return new ProteinSequenceDataTable(this); + return new ProteinSequenceDataTable(this, cf); } public static TableInfo getTableInfoSequenceData() diff --git a/ms2/src/org/labkey/ms2/matrix/ProteinSequenceDataTable.java b/ms2/src/org/labkey/ms2/matrix/ProteinSequenceDataTable.java index 14e6d76ac1..726ef1790a 100644 --- a/ms2/src/org/labkey/ms2/matrix/ProteinSequenceDataTable.java +++ b/ms2/src/org/labkey/ms2/matrix/ProteinSequenceDataTable.java @@ -1,18 +1,18 @@ -/* - * Copyright (c) 2015 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +/* + * Copyright (c) 2015 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.labkey.ms2.matrix; import org.labkey.api.data.AbstractTableInfo; @@ -34,9 +34,9 @@ public class ProteinSequenceDataTable extends FilteredTable { - public ProteinSequenceDataTable(ProteinExpressionMatrixProtocolSchema schema) + public ProteinSequenceDataTable(ProteinExpressionMatrixProtocolSchema schema, ContainerFilter cf) { - super(ProteinExpressionMatrixProtocolSchema.getTableInfoSequenceData(), schema); + super(ProteinExpressionMatrixProtocolSchema.getTableInfoSequenceData(), schema, cf); setDetailsURL(AbstractTableInfo.LINK_DISABLER); setImportURL(AbstractTableInfo.LINK_DISABLER); @@ -51,15 +51,17 @@ public ProteinSequenceDataTable(ProteinExpressionMatrixProtocolSchema schema) ColumnInfo seqIdColumn = addColumn(wrapColumn(getRealTable().getColumn("SeqId"))); seqIdColumn.setHidden(false); seqIdColumn.setLabel("Protein"); - seqIdColumn.setFk(new QueryForeignKey(ProteinUserSchema.NAME, schema.getContainer(), null, - schema.getUser(), ProteinUserSchema.SEQUENCES_TABLE_NAME, "SeqId", "BestName")); + seqIdColumn.setFk( QueryForeignKey.from(getUserSchema(), cf) + .schema(ProteinUserSchema.NAME) + .to(ProteinUserSchema.SEQUENCES_TABLE_NAME, "SeqId", "BestName") ); ColumnInfo sampleIdColumn = addColumn(wrapColumn(getRealTable().getColumn("SampleId"))); sampleIdColumn.setHidden(false); sampleIdColumn.setLabel("Sample Id"); - sampleIdColumn.setFk(new QueryForeignKey(ExpSchema.SCHEMA_NAME, schema.getContainer(), null, schema.getUser(), - ExpSchema.TableType.Materials.toString(),"RowId","Name")); + sampleIdColumn.setFk( QueryForeignKey.from(getUserSchema(), getContainerFilter()) + .schema(ExpSchema.SCHEMA_NAME) + .to(ExpSchema.TableType.Materials.toString(),"RowId","Name")); SQLFragment runSQL = new SQLFragment("(SELECT d.RunId FROM "); runSQL.append(ExperimentService.get().getTinfoData(), "d"); @@ -68,13 +70,14 @@ public ProteinSequenceDataTable(ProteinExpressionMatrixProtocolSchema schema) runSQL.append(".DataId)"); ColumnInfo runIdColumn = new ExprColumn(this, "Run", runSQL, JdbcType.INTEGER); addColumn(runIdColumn); - runIdColumn.setFk(new QueryForeignKey(getUserSchema(), null, AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name")); + runIdColumn.setFk( QueryForeignKey.from(getUserSchema(), getContainerFilter()).to(AssayProtocolSchema.RUNS_TABLE_NAME, "RowId", "Name") ); ColumnInfo dataIdColumn = addColumn(wrapColumn(getRealTable().getColumn("DataId"))); dataIdColumn.setHidden(false); dataIdColumn.setLabel("Data Id"); - dataIdColumn.setFk(new QueryForeignKey(ExpSchema.SCHEMA_NAME, schema.getContainer(), null, schema.getUser(), ExpSchema.TableType.Data.toString(), - "RowId", "Name")); + dataIdColumn.setFk( QueryForeignKey.from(getUserSchema(), getContainerFilter()) + .schema(ExpSchema.SCHEMA_NAME) + .to(ExpSchema.TableType.Data.toString(), "RowId", "Name")); List columns = new ArrayList<>(getDefaultVisibleColumns()); columns.remove(dataIdColumn.getFieldKey()); diff --git a/ms2/src/org/labkey/ms2/metadata/MassSpecMetadataProtocolSchema.java b/ms2/src/org/labkey/ms2/metadata/MassSpecMetadataProtocolSchema.java index 2080b52749..d55c2e5393 100644 --- a/ms2/src/org/labkey/ms2/metadata/MassSpecMetadataProtocolSchema.java +++ b/ms2/src/org/labkey/ms2/metadata/MassSpecMetadataProtocolSchema.java @@ -69,9 +69,9 @@ public MassSpecMetadataProtocolSchema(User user, Container container, @NotNull M } @Override - public ExpRunTable createRunsTable() + public ExpRunTable createRunsTable(ContainerFilter cf) { - ExpRunTable result = super.createRunsTable(); + ExpRunTable result = super.createRunsTable(cf); SQLFragment searchCountSQL = new SQLFragment(); searchCountSQL.append(getSearchRunSQL(getContainer(), result.getContainerFilter(), ExprColumn.STR_TABLE_ALIAS + ".RowId", "COUNT(DISTINCT(er.RowId))")); ExprColumn searchCountCol = new ExprColumn(result, SEARCH_COUNT_COLUMN, searchCountSQL, JdbcType.INTEGER); @@ -166,12 +166,11 @@ public FilteredTable createDataTable(boolean includeCopiedToStudyColumns) ExperimentService.get().getTinfoExperimentRun() + " WHERE ProtocolLSID = ?)"); runConditionSQL.add(getProtocol().getLSID()); result.addCondition(runConditionSQL, FieldKey.fromParts("RunId")); - result.getColumn(ExpDataTable.Column.Run).setFk(new LookupForeignKey("RowId") + result.getColumn(ExpDataTable.Column.Run).setFk(new LookupForeignKey(result.getContainerFilter(), "RowId", null) { public TableInfo getLookupTableInfo() { - ExpRunTable expRunTable = createRunsTable(); - expRunTable.setContainerFilter(result.getContainerFilter()); + ExpRunTable expRunTable = createRunsTable(getLookupContainerFilter()); return expRunTable; } }); diff --git a/ms2/src/org/labkey/ms2/peptideview/QueryProteinGroupMS2RunView.java b/ms2/src/org/labkey/ms2/peptideview/QueryProteinGroupMS2RunView.java index a060895e82..6416ef00cd 100644 --- a/ms2/src/org/labkey/ms2/peptideview/QueryProteinGroupMS2RunView.java +++ b/ms2/src/org/labkey/ms2/peptideview/QueryProteinGroupMS2RunView.java @@ -127,7 +127,7 @@ protected Sort getBaseSort() public ProteinGroupTableInfo createTable() { - ProteinGroupTableInfo result = ((MS2Schema)getSchema()).createProteinGroupsForRunTable(false); + ProteinGroupTableInfo result = ((MS2Schema)getSchema()).createProteinGroupsForRunTable(getContainerFilter(), false); result.setRunFilter(Arrays.asList(_runs)); return result; } diff --git a/ms2/src/org/labkey/ms2/protein/query/CustomAnnotationTable.java b/ms2/src/org/labkey/ms2/protein/query/CustomAnnotationTable.java index 4d88508532..c5b39ee614 100644 --- a/ms2/src/org/labkey/ms2/protein/query/CustomAnnotationTable.java +++ b/ms2/src/org/labkey/ms2/protein/query/CustomAnnotationTable.java @@ -64,7 +64,8 @@ public CustomAnnotationTable(CustomAnnotationSet annotationSet, CustomAnnotation _domain = PropertyService.get().getDomain(_annotationSet.lookupContainer(), _annotationSet.getLsid()); if (_domain != null) { - propertyCol.setFk(new PropertyForeignKey(_domain, schema)); + // TODO ContainerFilter + propertyCol.setFk(new PropertyForeignKey(schema, null, _domain)); } List defaultCols = new ArrayList<>(); @@ -104,7 +105,7 @@ private void addProteinDetailsColumn() public TableInfo getLookupTableInfo() { MS2Schema schema = new MS2Schema(_userSchema.getUser(), _userSchema.getContainer()); - return schema.createSequencesTable(); + return schema.createSequencesTable(null); } }); addColumn(col); diff --git a/ms2/src/org/labkey/ms2/protein/query/ProteinUserSchema.java b/ms2/src/org/labkey/ms2/protein/query/ProteinUserSchema.java index 1f1aa0cce3..837e200174 100644 --- a/ms2/src/org/labkey/ms2/protein/query/ProteinUserSchema.java +++ b/ms2/src/org/labkey/ms2/protein/query/ProteinUserSchema.java @@ -191,8 +191,8 @@ private TableInfo createFastaSequencesTable() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoFastaSequences()); table.init(); table.setReadOnly(true); - table.getColumn("SeqId").setFk(new QueryForeignKey(this, null, TableType.Sequences.name(), null, null)); - table.getColumn("FastaId").setFk(new QueryForeignKey(this, null, TableType.FastaFiles.name(), null, null)); + table.getColumn("SeqId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.Sequences.name()) ); + table.getColumn("FastaId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.FastaFiles.name()) ); return table; } @@ -201,9 +201,9 @@ private TableInfo createIdentifiersTable() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoIdentifiers()); table.init(); table.setReadOnly(true); - table.getColumn("SeqId").setFk(new QueryForeignKey(this, null, TableType.Sequences.name(), null, null)); - table.getColumn("IdentTypeId").setFk(new QueryForeignKey(this, null, TableType.IdentTypes.name(), null, null)); - table.getColumn("SourceId").setFk(new QueryForeignKey(this, null, TableType.InfoSources.name(), null, null)); + table.getColumn("SeqId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.Sequences.name()) ); + table.getColumn("IdentTypeId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.IdentTypes.name()) ); + table.getColumn("SourceId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.InfoSources.name()) ); return table; } @@ -212,7 +212,7 @@ private TableInfo createIdentTypesTable() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoIdentTypes()); table.init(); table.setReadOnly(true); - table.getColumn("CannonicalSourceId").setFk(new QueryForeignKey(this, null, TableType.InfoSources.name(), null, null)); + table.getColumn("CannonicalSourceId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.InfoSources.name()) ); return table; } @@ -247,7 +247,7 @@ private SimpleUserSchema.SimpleTable createAnnotationTypesTable() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoAnnotationTypes()); table.init(); table.setReadOnly(true); - table.getColumn("SourceId").setFk(new QueryForeignKey(this, null, TableType.InfoSources.name(), null, null)); + table.getColumn("SourceId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.InfoSources.name()) ); return table; } @@ -264,10 +264,10 @@ protected TableInfo createAnnotationsTable() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoAnnotations()); table.init(); table.setReadOnly(true); - table.getColumn("AnnotTypeId").setFk(new QueryForeignKey(this, null, TableType.AnnotationTypes.name(), null, null)); - table.getColumn("AnnotSourceId").setFk(new QueryForeignKey(this, null, TableType.InfoSources.name(), null, null)); - table.getColumn("AnnotIdent").setFk(new QueryForeignKey(this, null, TableType.Identifiers.name(), null, null)); - table.getColumn("SeqId").setFk(new QueryForeignKey(this, null, TableType.Sequences.name(), null, null)); + table.getColumn("AnnotTypeId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.AnnotationTypes.name()) ); + table.getColumn("AnnotSourceId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.InfoSources.name()) ); + table.getColumn("AnnotIdent").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.Identifiers.name()) ); + table.getColumn("SeqId").setFk( QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.Sequences.name()) ); return table; } @@ -292,8 +292,8 @@ protected TableInfo createGoTerm2Term() SimpleUserSchema.SimpleTable table = new SimpleUserSchema.SimpleTable<>(this, ProteinManager.getTableInfoGoTerm2Term()); table.init(); table.setReadOnly(true); - table.getColumn("term1id").setFk(new QueryForeignKey(this, null, TableType.GoTerm.name(), null, null)); - table.getColumn("term2id").setFk(new QueryForeignKey(this, null, TableType.GoTerm.name(), null, null)); + table.getColumn("term1id").setFk(QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.GoTerm.name()) ); + table.getColumn("term2id").setFk(QueryForeignKey.from(this, table.getContainerFilter()).table(TableType.GoTerm.name()) ); return table; } @@ -320,7 +320,8 @@ protected TableInfo createOrganisms() protected SequencesTableInfo createSequences() { - return new SequencesTableInfo<>(this); + // TODO ContainerFilter + return new SequencesTableInfo<>(this, null); } protected TableInfo createFastaFileTable() diff --git a/ms2/src/org/labkey/ms2/query/CompareProteinProphetTableInfo.java b/ms2/src/org/labkey/ms2/query/CompareProteinProphetTableInfo.java index 76ce57a209..74fcf1fa46 100644 --- a/ms2/src/org/labkey/ms2/query/CompareProteinProphetTableInfo.java +++ b/ms2/src/org/labkey/ms2/query/CompareProteinProphetTableInfo.java @@ -45,7 +45,7 @@ public class CompareProteinProphetTableInfo extends SequencesTableInfo runs, boolean forExport, HttpServletRequest request, String peptideViewName) { - super(MS2Schema.HiddenTableType.CompareProteinProphet.toString(), schema); + super(MS2Schema.HiddenTableType.CompareProteinProphet.toString(), schema, null); _runs = runs; _forExport = forExport; @@ -91,7 +91,7 @@ public CompareProteinProphetTableInfo(MS2Schema schema, List runs, boole { public TableInfo getLookupTableInfo() { - return new ProteinGroupTableInfo(_userSchema, false); + return new ProteinGroupTableInfo(_userSchema, getLookupContainerFilter(), false); } }; if (!_forExport) @@ -111,7 +111,7 @@ public TableInfo getLookupTableInfo() { public TableInfo getLookupTableInfo() { - return new ProteinGroupTableInfo(_userSchema, false); + return new ProteinGroupTableInfo(_userSchema, getLookupContainerFilter(), false); } }); addColumn(proteinGroupIdColumn); diff --git a/ms2/src/org/labkey/ms2/query/FastaRunMappingTable.java b/ms2/src/org/labkey/ms2/query/FastaRunMappingTable.java index d3e974237b..26151919de 100644 --- a/ms2/src/org/labkey/ms2/query/FastaRunMappingTable.java +++ b/ms2/src/org/labkey/ms2/query/FastaRunMappingTable.java @@ -31,14 +31,19 @@ public class FastaRunMappingTable extends FilteredTable { private static final FieldKey CONTAINER_FIELD_KEY = FieldKey.fromParts("Container"); - public FastaRunMappingTable(MS2Schema schema) + public FastaRunMappingTable(MS2Schema schema, ContainerFilter cf) { - super(MS2Manager.getTableInfoFastaRunMapping(), schema); + super(MS2Manager.getTableInfoFastaRunMapping(), schema, cf); wrapAllColumns(true); setDescription("Contains a row for each FASTA file used for a given imported MS2 search"); - getColumn("FastaId").setFk(new QueryForeignKey(ProteinUserSchema.NAME, schema.getContainer(), null, schema.getUser(), ProteinUserSchema.FASTA_FILE_TABLE_NAME, null, null, false)); - getColumn("Run").setFk(new QueryForeignKey(schema, null, MS2Schema.TableType.MS2RunDetails.name(), null, "Description")); + getColumn("FastaId").setFk( QueryForeignKey + .from(schema, getContainerFilter()) + .schema(ProteinUserSchema.NAME, schema.getContainer()) + .table(ProteinUserSchema.FASTA_FILE_TABLE_NAME)); + getColumn("Run").setFk( QueryForeignKey + .from(schema, getContainerFilter()) + .to(MS2Schema.TableType.MS2RunDetails.name(), null, "Description")); } @Override diff --git a/ms2/src/org/labkey/ms2/query/MS2Schema.java b/ms2/src/org/labkey/ms2/query/MS2Schema.java index 585541a910..98f9d77f67 100644 --- a/ms2/src/org/labkey/ms2/query/MS2Schema.java +++ b/ms2/src/org/labkey/ms2/query/MS2Schema.java @@ -143,9 +143,9 @@ public enum TableType { SamplePrepRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable result = ExperimentService.get().createRunTable(SamplePrepRuns.toString(), ms2Schema); + ExpRunTable result = ExperimentService.get().createRunTable(SamplePrepRuns.toString(), ms2Schema, cf); result.populate(); // Include the old XAR-based and the new assay-based result.setDescription("Contains one row per experimental metadata attached to source spectra files."); @@ -155,72 +155,72 @@ public ExpRunTable createTable(MS2Schema ms2Schema) }, ImportedSearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(ImportedSearchRuns.toString(), ContainerFilter.CURRENT, IMPORTED_SEARCH_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(ImportedSearchRuns.toString(), cf, IMPORTED_SEARCH_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per externally-generated MS2 search result imported in this folder."); return searchTable; } }, XTandemSearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(XTandemSearchRuns.toString(), ContainerFilter.CURRENT, XTANDEM_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(XTandemSearchRuns.toString(), cf, XTANDEM_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per X!Tandem search result loaded in this folder."); return searchTable; } }, MascotSearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(MascotSearchRuns.toString(), ContainerFilter.CURRENT, MASCOT_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(MascotSearchRuns.toString(), cf, MASCOT_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per Mascot search results loaded in this folder."); return searchTable; } }, CometSearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(CometSearchRuns.toString(), ContainerFilter.CURRENT, COMET_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(CometSearchRuns.toString(), cf, COMET_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per Comet search results loaded in this folder."); return searchTable; } }, SequestSearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(SequestSearchRuns.toString(), ContainerFilter.CURRENT, SEQUEST_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(SequestSearchRuns.toString(), cf, SEQUEST_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per Sequest search result loaded in this folder."); return searchTable; } }, FractionRollupsRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable searchTable = ms2Schema.createSearchTable(FractionRollupsRuns.toString(), ContainerFilter.CURRENT, FRACTION_ROLLUP_PROTOCOL_OBJECT_PREFIX); + ExpRunTable searchTable = ms2Schema.createSearchTable(FractionRollupsRuns.toString(), cf, FRACTION_ROLLUP_PROTOCOL_OBJECT_PREFIX); searchTable.setDescription("Contains one row per fraction rollup analysis result loaded in this folder."); return searchTable; } }, MS2SearchRuns { - public ExpRunTable createTable(MS2Schema ms2Schema) + public ExpRunTable createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ExpRunTable runsTable = ms2Schema.createRunsTable(MS2SearchRuns.toString(), ContainerFilter.CURRENT); + ExpRunTable runsTable = ms2Schema.createRunsTable(MS2SearchRuns.toString(), cf); runsTable.setDescription("Contains one row per MS2 search result, regardless of source, loaded in this folder."); return runsTable; } }, MS2RunDetails { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2, ContainerFilter cf) { - FilteredTable result = new FilteredTable<>(MS2Manager.getTableInfoRuns(), ms2Schema); + FilteredTable result = new FilteredTable<>(MS2Manager.getTableInfoRuns(), ms2, cf); result.setName(MS2RunDetails.name()); result.addWrapColumn(result.getRealTable().getColumn("Run")); result.addWrapColumn(result.getRealTable().getColumn("Description")); @@ -246,7 +246,7 @@ public TableInfo createTable(MS2Schema ms2Schema) ColumnInfo fastaColumnInfo = result.wrapColumn("FastaId", result.getRealTable().getColumn("Run")); fastaColumnInfo.setKeyField(false); - fastaColumnInfo.setFk(new MultiValuedForeignKey(new QueryForeignKey(ms2Schema, null, FastaRunMapping.name(), "Run", null), "FastaId")); + fastaColumnInfo.setFk(new MultiValuedForeignKey(QueryForeignKey.from(ms2,cf).to(FastaRunMapping.name(), "Run", null).build(), "FastaId")); fastaColumnInfo.setLabel("FASTA"); result.addColumn(fastaColumnInfo); result.addWrapColumn(result.getRealTable().getColumn("SearchEnzyme")); @@ -262,7 +262,7 @@ public TableInfo createTable(MS2Schema ms2Schema) { public DisplayColumn createRenderer(ColumnInfo colInfo) { - ActionURL linkURL = MS2Controller.getShowRunURL(ms2Schema.getUser(), ms2Schema.getContainer()); + ActionURL linkURL = MS2Controller.getShowRunURL(ms2.getUser(), ms2.getContainer()); return new IconDisplayColumn(colInfo, 18, 18, linkURL, "run", AppProps.getInstance().getContextPath() + "/MS2/images/runIcon.gif"); } }); @@ -285,114 +285,114 @@ public SQLFragment getScanCountSqlFragment(int msLevel) }, Peptides { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createPeptidesTable(ContainerFilter.CURRENT, MS2RunType.values()); + return ms2Schema.createPeptidesTable(cf, MS2RunType.values()); } }, Fractions { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createFractionsTable(); + return ms2Schema.createFractionsTable(cf); } }, ProteinGroups { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - ProteinGroupTableInfo result = new ProteinGroupTableInfo(ms2Schema); - result.addContainerCondition(ms2Schema.getContainer(), ms2Schema.getUser(), false); + ProteinGroupTableInfo result = new ProteinGroupTableInfo(ms2Schema, cf); return result; } }, Sequences { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createSequencesTable(); + + return ms2Schema.createSequencesTable(cf); } }, FastaRunMapping { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createFastaRunMappingTable(); + return ms2Schema.createFastaRunMappingTable(cf); } }; - public abstract TableInfo createTable(MS2Schema ms2Schema); + public abstract TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf); } public enum HiddenTableType { PeptidesFilter { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - PeptidesTableInfo peptidesTable = (PeptidesTableInfo)ms2Schema.createPeptidesTable(ContainerFilter.CURRENT, MS2RunType.values()); + PeptidesTableInfo peptidesTable = (PeptidesTableInfo)ms2Schema.createPeptidesTable(cf, MS2RunType.values()); peptidesTable.setName(this.toString()); return peptidesTable; } }, ProteinGroupsFilter { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createProteinGroupsForRunTable(null); + return ms2Schema.createProteinGroupsForRunTable(cf, null); } }, ProteinGroupsForSearch { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createProteinGroupsForSearchTable(); + return ms2Schema.createProteinGroupsForSearchTable(cf); } }, ProteinGroupsForRun { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { - return ms2Schema.createProteinGroupsForRunTable(false); + return ms2Schema.createProteinGroupsForRunTable(cf, false); } }, CompareProteinProphet { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { return ms2Schema.createProteinProphetCompareTable(null, null); } }, ComparePeptides { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { return ms2Schema.createPeptidesCompareTable(false, null, null); } }, ProteinProphetCrosstab { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { return ms2Schema.createProteinProphetCrosstabTable(null, null); } }, ProteinProphetNormalizedCrosstab { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { return ms2Schema.createNormalizedProteinProphetComparisonTable(null, null); } }, PeptideCrosstab { - public TableInfo createTable(MS2Schema ms2Schema) + public TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf) { return ms2Schema.createPeptideCrosstabTable(null, null); } } ; - public abstract TableInfo createTable(MS2Schema ms2Schema); + public abstract TableInfo createTable(MS2Schema ms2Schema, ContainerFilter cf); } @@ -406,20 +406,20 @@ public ProteinGroupProteins getProteinGroupProteins() return _proteinGroupProteins; } - public TableInfo createTable(String name) + public TableInfo createTable(String name, ContainerFilter cf) { for (TableType tableType : TableType.values()) { if (tableType.toString().equalsIgnoreCase(name)) { - return tableType.createTable(this); + return tableType.createTable(this, cf); } } for (HiddenTableType tableType : HiddenTableType.values()) { if (tableType.toString().equalsIgnoreCase(name)) { - return tableType.createTable(this); + return tableType.createTable(this, cf); } } for (MS2RunType runType : MS2RunType.values()) @@ -478,9 +478,9 @@ public SpectraCountTableInfo createSpectraCountTable(SpectraCountConfiguration c return new SpectraCountTableInfo(this, config, context, form); } - public ProteinGroupTableInfo createProteinGroupsForSearchTable() + public ProteinGroupTableInfo createProteinGroupsForSearchTable(ContainerFilter cf) { - ProteinGroupTableInfo result = new ProteinGroupTableInfo(this); + ProteinGroupTableInfo result = new ProteinGroupTableInfo(this, cf); List defaultColumns = new ArrayList<>(result.getDefaultVisibleColumns()); defaultColumns.add(0, FieldKey.fromParts("ProteinProphet","Run")); defaultColumns.add(0, FieldKey.fromParts("ProteinProphet", "Run", "Folder")); @@ -488,14 +488,14 @@ public ProteinGroupTableInfo createProteinGroupsForSearchTable() return result; } - public ProteinGroupTableInfo createProteinGroupsForRunTable(String alias) + public ProteinGroupTableInfo createProteinGroupsForRunTable(ContainerFilter cf, String alias) { - return createProteinGroupsForRunTable(true); + return createProteinGroupsForRunTable(cf, true); } - public ProteinGroupTableInfo createProteinGroupsForRunTable(boolean includeFirstProteinColumn) + public ProteinGroupTableInfo createProteinGroupsForRunTable(ContainerFilter cf, boolean includeFirstProteinColumn) { - ProteinGroupTableInfo result = new ProteinGroupTableInfo(this, includeFirstProteinColumn); + ProteinGroupTableInfo result = new ProteinGroupTableInfo(this, cf, includeFirstProteinColumn); result.addProteinsColumn(); List defaultColumns = new ArrayList<>(result.getDefaultVisibleColumns()); defaultColumns.add(FieldKey.fromParts("Proteins", "Protein")); @@ -511,11 +511,11 @@ protected FilteredTable createProteinGroupMembershipTable(final MS2Controller.Pe FilteredTable result = new FilteredTable<>(MS2Manager.getTableInfoProteinGroupMemberships(), this); result.wrapAllColumns(true); - result.getColumn("ProteinGroupId").setFk(new LookupForeignKey("RowId") + result.getColumn("ProteinGroupId").setFk(new LookupForeignKey(result.getContainerFilter(), "RowId", null) { public TableInfo getLookupTableInfo() { - ProteinGroupTableInfo result = createProteinGroupsForRunTable(null); + ProteinGroupTableInfo result = createProteinGroupsForRunTable(getLookupContainerFilter(), null); result.removeColumn(result.getColumn("Proteins")); result.removeColumn(result.getColumn("FirstProtein")); @@ -595,11 +595,11 @@ else if (form.isCustomViewProteinGroupFilter()) } ColumnInfo peptideMembershipsColumn = result.wrapColumn("PeptideMemberships", result.getRealTable().getColumn("ProteinGroupId")); - peptideMembershipsColumn.setFk(new LookupForeignKey("ProteinGroupId") + peptideMembershipsColumn.setFk(new LookupForeignKey(result.getContainerFilter(), "ProteinGroupId", null) { public TableInfo getLookupTableInfo() { - return createPeptideMembershipsTable(); + return createPeptideMembershipsTable(getLookupContainerFilter()); } }); result.addColumn(peptideMembershipsColumn); @@ -618,7 +618,7 @@ public void getProteinGroupSelectSQL(MS2Controller.PeptideFilteringComparisonFor view.applyFilterAndSortToURL(url, "InternalName"); filter.addUrlFilters(url, "InternalName"); } - ProteinGroupTableInfo tableInfo = new ProteinGroupTableInfo(this, false); + ProteinGroupTableInfo tableInfo = new ProteinGroupTableInfo(this, null, false); tableInfo.setContainerFilter(ContainerFilter.EVERYTHING); sql.append(getSelectSQL(tableInfo, filter, Collections.singleton(FieldKey.fromParts("RowId")))); } @@ -643,16 +643,16 @@ public void appendRunInClause(SQLFragment sql) sql.append(")"); } - protected TableInfo createPeptideMembershipsTable() + protected TableInfo createPeptideMembershipsTable(ContainerFilter cf) { FilteredTable result = new FilteredTable<>(MS2Manager.getTableInfoPeptideMemberships(), this); result.wrapAllColumns(false); - LookupForeignKey fk = new LookupForeignKey("RowId") + LookupForeignKey fk = new LookupForeignKey(cf, "RowId", null) { public TableInfo getLookupTableInfo() { - ProteinGroupTableInfo result = new ProteinGroupTableInfo(MS2Schema.this); + ProteinGroupTableInfo result = new ProteinGroupTableInfo(MS2Schema.this, getLookupContainerFilter()); result.getColumn("ProteinProphet").setHidden(true); result.addProteinDetailColumns(); @@ -674,10 +674,10 @@ public TableInfo getLookupTableInfo() return result; } - protected TableInfo createFractionsTable() + protected TableInfo createFractionsTable(ContainerFilter cf) { SqlDialect dialect = MS2Manager.getSqlDialect(); - FilteredTable result = new FilteredTable(MS2Manager.getTableInfoFractions(), this) + FilteredTable result = new FilteredTable(MS2Manager.getTableInfoFractions(), this, cf) { @Override protected void applyContainerFilter(ContainerFilter filter) @@ -731,14 +731,14 @@ public TableInfo getLookupTableInfo() return result; } - public SequencesTableInfo createSequencesTable() + public SequencesTableInfo createSequencesTable(ContainerFilter cf) { - return new SequencesTableInfo<>(this); + return new SequencesTableInfo<>(this, cf); } - private TableInfo createFastaRunMappingTable() + private TableInfo createFastaRunMappingTable(ContainerFilter cf) { - return new FastaRunMappingTable(this); + return new FastaRunMappingTable(this, cf); } public TableInfo createPeptidesTable(ContainerFilter containerFilter, MS2RunType... runTypes) @@ -748,8 +748,7 @@ public TableInfo createPeptidesTable(ContainerFilter containerFilter, MS2RunType private ExpRunTable createSearchTable(String name, ContainerFilter filter, String... protocolObjectPrefix) { - final ExpRunTable result = ExperimentService.get().createRunTable(name, this); - result.setContainerFilter(filter); + final ExpRunTable result = ExperimentService.get().createRunTable(name, this, filter); result.populate(); String[] protocolPatterns = new String[protocolObjectPrefix.length]; for (int i = 0; i < protocolObjectPrefix.length; i++) @@ -766,7 +765,7 @@ private ExpRunTable createSearchTable(String name, ContainerFilter filter, Strin ActionURL url = MS2Controller.getShowRunURL(getUser(), getContainer()); DetailsURL detailsURL = new DetailsURL(url, Collections.singletonMap("Run", ms2DetailsColumn.getFieldKey())); ms2DetailsColumn.setURL(detailsURL); - ms2DetailsColumn.setFk(new QueryForeignKey(this, null, TableType.MS2RunDetails.name(), "Run", "Description")); + ms2DetailsColumn.setFk( QueryForeignKey.from(this,filter).to(TableType.MS2RunDetails.name(), "Run", "Description" ) ); result.addColumn(ms2DetailsColumn); result.getColumn("Name").setDisplayColumnFactory(new DisplayColumnFactory() @@ -859,8 +858,7 @@ public List getRuns() protected SQLFragment getPeptideSelectSQL(SimpleFilter filter, Collection fieldKeys) { - FilteredTable tiFiltered = (FilteredTable) getTable(HiddenTableType.PeptidesFilter.name(), true); - tiFiltered.setContainerFilter(ContainerFilter.EVERYTHING); + TableInfo tiFiltered = getTable(HiddenTableType.PeptidesFilter.name(), ContainerFilter.EVERYTHING, true, false); return getSelectSQL(tiFiltered, filter, fieldKeys); } @@ -924,11 +922,11 @@ public CrosstabTableInfo createNormalizedProteinProphetComparisonTable(final MS2 normalizedIdCol.setHidden(true); ColumnInfo proteinGroupIdCol = new ColumnInfo("ProteinGroupId", JdbcType.INTEGER); - proteinGroupIdCol.setFk(new LookupForeignKey("RowId") + proteinGroupIdCol.setFk(new LookupForeignKey((ContainerFilter)null, "RowId", null) { public TableInfo getLookupTableInfo() { - return new ProteinGroupTableInfo(MS2Schema.this, true); + return new ProteinGroupTableInfo(MS2Schema.this, getLookupContainerFilter(), true); } @Override @@ -971,14 +969,14 @@ public SQLFragment getFromSQL() rawTable.addColumn(proteinGroupIdCol); proteinGroupIdCol.setParentTable(rawTable); - FilteredTable baseTable = new FilteredTable<>(rawTable, this); + FilteredTable baseTable = new FilteredTable<>(rawTable, this, null); baseTable.wrapAllColumns(true); ColumnInfo peptideMembershipsColumn = baseTable.wrapColumn("PeptideMemberships", rawTable.getColumn("ProteinGroupId")); - peptideMembershipsColumn.setFk(new LookupForeignKey("ProteinGroupId") + peptideMembershipsColumn.setFk(new LookupForeignKey((ContainerFilter)null, "ProteinGroupId", null) { public TableInfo getLookupTableInfo() { - return createPeptideMembershipsTable(); + return createPeptideMembershipsTable(getLookupContainerFilter()); } }); baseTable.addColumn(peptideMembershipsColumn); @@ -1013,7 +1011,7 @@ public SQLFragment getFromSQL() { public TableInfo getLookupTableInfo() { - return MS2Schema.this.createSequencesTable(); + return MS2Schema.this.createSequencesTable(getLookupContainerFilter()); } }; seqFK.setPrefixColumnCaption(false); @@ -1474,7 +1472,7 @@ private ForeignKey createSequencesLookup() { public TableInfo getLookupTableInfo() { - SequencesTableInfo result = createSequencesTable(); + SequencesTableInfo result = createSequencesTable(getLookupContainerFilter()); // This is a horrible hack to try to deal with https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=5237 // Performance on a SQLServer installation with a large number of runs and sequences is much better with // this condition because it causes the query plan to flip to something that does a much more efficient diff --git a/ms2/src/org/labkey/ms2/query/PeptidesTableInfo.java b/ms2/src/org/labkey/ms2/query/PeptidesTableInfo.java index 855d437e4c..4b6b3de6ce 100644 --- a/ms2/src/org/labkey/ms2/query/PeptidesTableInfo.java +++ b/ms2/src/org/labkey/ms2/query/PeptidesTableInfo.java @@ -23,6 +23,7 @@ import org.labkey.api.data.DataColumn; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.DisplayColumnFactory; +import org.labkey.api.data.ForeignKey; import org.labkey.api.data.JdbcType; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.TableInfo; @@ -193,7 +194,7 @@ public TableInfo getLookupTableInfo() { public TableInfo getLookupTableInfo() { - return _userSchema.createPeptideMembershipsTable(); + return _userSchema.createPeptideMembershipsTable(getLookupContainerFilter()); } }); proteinGroup.setKeyField(false); @@ -246,7 +247,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) { public TableInfo getLookupTableInfo() { - return _userSchema.createFractionsTable(); + return _userSchema.createFractionsTable(getLookupContainerFilter()); } }); @@ -614,7 +615,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) return new DeltaScanColumn(colInfo); } }); - deltaScanColumn.setFk(null); + deltaScanColumn.clearFk(); table.addColumn(deltaScanColumn); } diff --git a/ms2/src/org/labkey/ms2/query/ProteinGroupTableInfo.java b/ms2/src/org/labkey/ms2/query/ProteinGroupTableInfo.java index f67a1e0e3a..20a7374f09 100644 --- a/ms2/src/org/labkey/ms2/query/ProteinGroupTableInfo.java +++ b/ms2/src/org/labkey/ms2/query/ProteinGroupTableInfo.java @@ -20,6 +20,7 @@ import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.CompareType; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.ContainerManager; import org.labkey.api.data.DataColumn; import org.labkey.api.data.DisplayColumn; @@ -59,14 +60,14 @@ public class ProteinGroupTableInfo extends FilteredTable private static final Set HIDDEN_PROTEIN_GROUP_MEMBERSHIPS_COLUMN_NAMES = new CaseInsensitiveHashSet("ProteinGroupId", "SeqId"); private List _runs; - public ProteinGroupTableInfo(MS2Schema schema) + public ProteinGroupTableInfo(MS2Schema schema, ContainerFilter cf) { - this(schema, true); + this(schema, cf, true); } - public ProteinGroupTableInfo(MS2Schema schema, boolean includeFirstProteinColumn) + public ProteinGroupTableInfo(MS2Schema schema, ContainerFilter cf, boolean includeFirstProteinColumn) { - super(MS2Manager.getTableInfoProteinGroups(), schema); + super(MS2Manager.getTableInfoProteinGroups(), schema, cf); ColumnInfo groupNumberColumn = wrapColumn("Group", getRealTable().getColumn("GroupNumber")); groupNumberColumn.setDisplayColumnFactory(new DisplayColumnFactory() @@ -91,6 +92,7 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) { public TableInfo getLookupTableInfo() { + // TODO ContainerFilter return new ProteinQuantitationTable(_userSchema); } }); @@ -104,6 +106,7 @@ public TableInfo getLookupTableInfo() { public TableInfo getLookupTableInfo() { + // TODO ContainerFilter return new ITraqProteinQuantitationTable(_userSchema); } }); @@ -122,6 +125,7 @@ public TableInfo getLookupTableInfo() { public TableInfo getLookupTableInfo() { + // TODO ContainerFilter return new ProteinProphetFileTableInfo(_userSchema); } }; @@ -144,11 +148,11 @@ public TableInfo getLookupTableInfo() firstProteinSQL.append(")"); ExprColumn firstProteinColumn = new ExprColumn(this, "FirstProtein", firstProteinSQL, JdbcType.INTEGER); - firstProteinColumn.setFk(new LookupForeignKey("SeqId") + firstProteinColumn.setFk(new LookupForeignKey(cf, "SeqId", null) { public TableInfo getLookupTableInfo() { - return new SequencesTableInfo(null, _userSchema); + return new SequencesTableInfo(null, _userSchema, getLookupContainerFilter()); } }); addColumn(firstProteinColumn); @@ -206,10 +210,11 @@ public void addPeptideFilter(MS2Controller.ProbabilityProteinSearchForm form, Vi public void addProteinsColumn() { ColumnInfo proteinGroup = wrapColumn("Proteins", getRealTable().getColumn("RowId")); - LookupForeignKey fk = new LookupForeignKey("ProteinGroupId") + LookupForeignKey fk = new LookupForeignKey(getContainerFilter(), "ProteinGroupId", null) { public TableInfo getLookupTableInfo() { + // TODO ContainerFilter TableInfo info = MS2Manager.getTableInfoProteinGroupMemberships(); FilteredTable result = new FilteredTable<>(info, getUserSchema()); for (ColumnInfo col : info.getColumns()) @@ -240,11 +245,11 @@ public DisplayColumn createRenderer(ColumnInfo colInfo) }); result.addColumn(proteinColumn); - proteinColumn.setFk(new LookupForeignKey("SeqId", "DatabaseSequenceName") + proteinColumn.setFk(new LookupForeignKey(getContainerFilter(), "SeqId", "DatabaseSequenceName") { public TableInfo getLookupTableInfo() { - SequencesTableInfo result = new SequencesTableInfo(null, _userSchema); + SequencesTableInfo result = new SequencesTableInfo(_userSchema, getLookupContainerFilter()); ExprColumn col = new ExprColumn(result, "DatabaseSequenceName", new SQLFragment("#PLACEHOLDER#"), JdbcType.VARCHAR) { @Override diff --git a/ms2/src/org/labkey/ms2/query/SequencesTableInfo.java b/ms2/src/org/labkey/ms2/query/SequencesTableInfo.java index b027fd90aa..a706208a1d 100644 --- a/ms2/src/org/labkey/ms2/query/SequencesTableInfo.java +++ b/ms2/src/org/labkey/ms2/query/SequencesTableInfo.java @@ -20,6 +20,7 @@ import org.labkey.api.data.AbstractForeignKey; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.ContainerManager; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.DisplayColumnFactory; @@ -61,23 +62,31 @@ */ public class SequencesTableInfo extends FilteredTable { + // TODO ContainerFilter + @Deprecated protected SequencesTableInfo(String name, SchemaType schema) { - this(schema); + this(schema, null); setName(name); } - public SequencesTableInfo(SchemaType schema) + protected SequencesTableInfo(String name, SchemaType schema, ContainerFilter cf) { - super(ProteinManager.getTableInfoSequences(), schema); + this(schema, cf); + setName(name); + } + + public SequencesTableInfo(SchemaType schema, ContainerFilter cf) + { + super(ProteinManager.getTableInfoSequences(), schema, cf); setPublicSchemaName(ProteinUserSchema.NAME); setTitleColumn("BestName"); wrapAllColumns(true); - getColumn("OrgId").setFk(new QueryForeignKey(ProteinUserSchema.NAME, schema.getContainer(), null, schema.getUser(), ProteinUserSchema.TableType.Organisms.name(), null, null)); + getColumn("OrgId").setFk( QueryForeignKey.from(schema, getContainerFilter()).schema(ProteinUserSchema.NAME).table(ProteinUserSchema.TableType.Organisms.name()) ); addColumn(wrapColumn("Source", getRealTable().getColumn("SourceId"))); - getColumn("Source").setFk(new QueryForeignKey(schema, null, ProteinUserSchema.TableType.InfoSources.name(), null, null)); + getColumn("Source").setFk( QueryForeignKey.from(schema, getContainerFilter()).to(ProteinUserSchema.TableType.InfoSources.name(), null, null) ); removeColumn(getColumn("SourceId")); ActionURL url = new ActionURL(MS2Controller.ShowProteinAction.class, _userSchema.getContainer()); @@ -90,7 +99,7 @@ public SequencesTableInfo(SchemaType schema) ColumnInfo annotationColumn = wrapColumn("CustomAnnotations", _rootTable.getColumn("SeqId")); annotationColumn.setIsUnselectable(true); - annotationColumn.setFk(new AbstractForeignKey() + annotationColumn.setFk(new AbstractForeignKey(schema, cf) { public StringExpression getURL(ColumnInfo parent) { @@ -122,6 +131,7 @@ public ColumnInfo createLookupColumn(ColumnInfo parent, String displayField) { public TableInfo getLookupTableInfo() { + // TODO ContainerFilter return new CustomAnnotationTable(annotationSet, new CustomAnnotationSchema(_userSchema.getUser(), _userSchema.getContainer(), false)); } }); @@ -141,17 +151,17 @@ public TableInfo getLookupTableInfo() ColumnInfo goMPColumn = wrapColumn("GOMetabolicProcesses", getRealTable().getColumn("SeqId")); goMPColumn.setLabel("GO Metabolic Processes"); - goMPColumn.setFk(new MultiValuedForeignKey(new QueryForeignKey(ProteinUserSchema.NAME, getUserSchema().getContainer(), null, getUserSchema().getUser(), "GOMetabolicProcess", "SeqId", "BestName"), "GOMPAnnotId")); + goMPColumn.setFk(new MultiValuedForeignKey(QueryForeignKey.from(schema, cf).schema(ProteinUserSchema.NAME).to("GOMetabolicProcess", "SeqId", "BestName"), "GOMPAnnotId")); addColumn(goMPColumn); ColumnInfo goCLColumn = wrapColumn("GOCellularLocations", getRealTable().getColumn("SeqId")); goCLColumn.setLabel("GO Cellular Locations"); - goCLColumn.setFk(new MultiValuedForeignKey(new QueryForeignKey(ProteinUserSchema.NAME, getUserSchema().getContainer(), null, getUserSchema().getUser(), "GOCellularLocation", "SeqId", "BestName"), "GOCLAnnotId")); + goCLColumn.setFk(new MultiValuedForeignKey(QueryForeignKey.from(schema, cf).schema(ProteinUserSchema.NAME).to("GOCellularLocation", "SeqId", "BestName"), "GOCLAnnotId")); addColumn(goCLColumn); ColumnInfo goMFColumn = wrapColumn("GOMolecularFunctions", getRealTable().getColumn("SeqId")); goMFColumn.setLabel("GO Molecular Functions"); - goMFColumn.setFk(new MultiValuedForeignKey(new QueryForeignKey(ProteinUserSchema.NAME, getUserSchema().getContainer(), null, getUserSchema().getUser(), "GOMolecularFunction", "SeqId", "BestName"), "GOMFAnnotId")); + goMFColumn.setFk(new MultiValuedForeignKey(QueryForeignKey.from(schema, cf).schema(ProteinUserSchema.NAME).to("GOMolecularFunction", "SeqId", "BestName"), "GOMFAnnotId")); addColumn(goMFColumn); for (CustomAnnotationType type : CustomAnnotationType.values()) diff --git a/ms2/src/org/labkey/ms2/query/SpectraCountTableInfo.java b/ms2/src/org/labkey/ms2/query/SpectraCountTableInfo.java index d30b6bc9f6..6dd1c49f96 100644 --- a/ms2/src/org/labkey/ms2/query/SpectraCountTableInfo.java +++ b/ms2/src/org/labkey/ms2/query/SpectraCountTableInfo.java @@ -136,11 +136,11 @@ public SpectraCountTableInfo(MS2Schema ms2Schema, SpectraCountConfiguration conf List defaultCols = new ArrayList<>(); ExprColumn runColumn = new ExprColumn(this, "Run", new SQLFragment(ExprColumn.STR_TABLE_ALIAS + ".Run"), JdbcType.INTEGER); - runColumn.setFk(new LookupForeignKey(MS2Controller.getShowRunURL(_userSchema.getUser(), _userSchema.getContainer()), "run", "MS2Details", "Name") + runColumn.setFk(new LookupForeignKey(/*TODO ContainerFilter,*/ MS2Controller.getShowRunURL(_userSchema.getUser(), _userSchema.getContainer()), "run", "MS2Details", "Name") { public TableInfo getLookupTableInfo() { - ExpRunTable result = (ExpRunTable)MS2Schema.TableType.MS2SearchRuns.createTable(_userSchema); + ExpRunTable result = (ExpRunTable)MS2Schema.TableType.MS2SearchRuns.createTable(_userSchema, getLookupContainerFilter()); result.setContainerFilter(ContainerFilter.EVERYTHING); return result; } @@ -189,11 +189,11 @@ public TableInfo getLookupTableInfo() } proteinColumn.setDescription("The protein associated with the peptide identification. Only available if a grouping by protein information, or a target protein has been specified."); addColumn(proteinColumn); - proteinColumn.setFk(new LookupForeignKey(new ActionURL(MS2Controller.ShowProteinAction.class, ContainerManager.getRoot()), "seqId", "SeqId", "BestName") + proteinColumn.setFk(new LookupForeignKey(/*TODO ContainerFilter,*/ new ActionURL(MS2Controller.ShowProteinAction.class, ContainerManager.getRoot()), "seqId", "SeqId", "BestName") { public TableInfo getLookupTableInfo() { - return _userSchema.createSequencesTable(); + return _userSchema.createSequencesTable(getLookupContainerFilter()); } }); diff --git a/nab/src/org/labkey/nab/query/NabBaseTable.java b/nab/src/org/labkey/nab/query/NabBaseTable.java index 98d0591765..054cc4b4b0 100644 --- a/nab/src/org/labkey/nab/query/NabBaseTable.java +++ b/nab/src/org/labkey/nab/query/NabBaseTable.java @@ -16,6 +16,7 @@ package org.labkey.nab.query; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.JdbcType; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.TableInfo; @@ -33,7 +34,6 @@ import org.labkey.api.study.assay.AbstractPlateBasedAssayProvider; import org.labkey.api.study.assay.AssayProtocolSchema; import org.labkey.api.study.assay.AssayProvider; -import org.labkey.api.study.assay.AssaySchema; import org.labkey.api.study.assay.AssayService; import org.labkey.api.study.assay.SpecimenPropertyColumnDecorator; import org.labkey.api.util.StringExpression; @@ -49,9 +49,9 @@ public abstract class NabBaseTable extends FilteredTable protected final NabProtocolSchema _schema; protected final ExpProtocol _protocol; - public NabBaseTable(final NabProtocolSchema schema, TableInfo table, final ExpProtocol protocol) + public NabBaseTable(final NabProtocolSchema schema, TableInfo table, ContainerFilter cf, final ExpProtocol protocol) { - super(table, schema); + super(table, schema, cf); _schema = schema; _protocol = protocol; } @@ -66,14 +66,12 @@ protected void addSpecimenColumn() specimenColumn.setLabel("Specimen"); specimenColumn.setKeyField(false); specimenColumn.setIsUnselectable(true); - LookupForeignKey lfkSpecimen = new LookupForeignKey("LSID") + LookupForeignKey lfkSpecimen = new LookupForeignKey(getContainerFilter(), "LSID", null) { @Override public TableInfo getLookupTableInfo() { - ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), _schema); - // Make sure we are filtering to the same set of containers - materials.setContainerFilter(getContainerFilter()); + ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), _schema, getLookupContainerFilter()); if (sampleSet != null) { materials.setSampleSet(sampleSet, true); @@ -96,13 +94,12 @@ protected void addRunColumn() { final AssayProvider provider = AssayService.get().getProvider(_protocol); ExprColumn runColumn = new ExprColumn(this, "Run", new SQLFragment(ExprColumn.STR_TABLE_ALIAS + ".RunID"), JdbcType.INTEGER); - runColumn.setFk(new LookupForeignKey("RowID") + runColumn.setFk(new LookupForeignKey(getContainerFilter(), "RowID", null) { @Override public TableInfo getLookupTableInfo() { - ExpRunTable expRunTable = AssayService.get().createRunTable(_protocol, provider, _schema.getUser(), _schema.getContainer()); - expRunTable.setContainerFilter(getContainerFilter()); + ExpRunTable expRunTable = AssayService.get().createRunTable(_protocol, provider, _schema.getUser(), _schema.getContainer(), getLookupContainerFilter()); return expRunTable; } diff --git a/nab/src/org/labkey/nab/query/NabDilutionDataTable.java b/nab/src/org/labkey/nab/query/NabDilutionDataTable.java index 07076f5cd1..ad6d9f4b0f 100644 --- a/nab/src/org/labkey/nab/query/NabDilutionDataTable.java +++ b/nab/src/org/labkey/nab/query/NabDilutionDataTable.java @@ -17,6 +17,7 @@ import org.labkey.api.assay.dilution.DilutionManager; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.exp.api.ExpProtocol; /** @@ -25,9 +26,9 @@ */ public class NabDilutionDataTable extends NabBaseTable { - public NabDilutionDataTable(final NabProtocolSchema schema, ExpProtocol protocol) + public NabDilutionDataTable(final NabProtocolSchema schema, ContainerFilter cf, ExpProtocol protocol) { - super(schema, DilutionManager.getTableInfoDilutionData(), protocol); + super(schema, DilutionManager.getTableInfoDilutionData(), cf, protocol); addRunColumn(); for (ColumnInfo col : getRealTable().getColumns()) diff --git a/nab/src/org/labkey/nab/query/NabProtocolSchema.java b/nab/src/org/labkey/nab/query/NabProtocolSchema.java index 32bce1d342..6fe32b210b 100644 --- a/nab/src/org/labkey/nab/query/NabProtocolSchema.java +++ b/nab/src/org/labkey/nab/query/NabProtocolSchema.java @@ -27,6 +27,7 @@ import org.labkey.api.cache.Wrapper; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.DatabaseCache; import org.labkey.api.data.DisplayColumn; import org.labkey.api.data.DisplayColumnFactory; @@ -72,9 +73,9 @@ public NabProtocolSchema(User user, Container container, @NotNull NabAssayProvid } @Override - public NabRunDataTable createDataTable(boolean includeCopiedToStudyColumns) + public @Nullable TableInfo createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { - NabRunDataTable table = new NabRunDataTable(this, getProtocol()); + NabRunDataTable table = new NabRunDataTable(this, cf, getProtocol()); if (includeCopiedToStudyColumns) { @@ -175,49 +176,49 @@ protected RunListQueryView createRunsQueryView(ViewContext context, QuerySetting } @Override - protected TableInfo createProviderTable(String tableType) + protected TableInfo createProviderTable(String tableType, ContainerFilter cf) { if(tableType != null) { if (DilutionManager.CUTOFF_VALUE_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createCutoffValueTable(); + return createCutoffValueTable(cf); } if (DilutionManager.NAB_SPECIMEN_TABLE_NAME.equalsIgnoreCase(tableType)) { - return createNAbSpecimenTable(); + return createNAbSpecimenTable(cf); } if (DilutionManager.WELL_DATA_TABLE_NAME.equalsIgnoreCase(tableType)) { - NabWellDataTable table = new NabWellDataTable(this, getProtocol()); + NabWellDataTable table = new NabWellDataTable(this, cf, getProtocol()); return table; } if (DilutionManager.DILUTION_DATA_TABLE_NAME.equalsIgnoreCase(tableType)) { - return new NabDilutionDataTable(this, getProtocol()); + return new NabDilutionDataTable(this, cf, getProtocol()); } if (DilutionManager.VIRUS_TABLE_NAME.equalsIgnoreCase(tableType)) { Domain virusDomain = getVirusWellGroupDomain(); if (virusDomain != null) - return new NabVirusDataTable(this, virusDomain); + return new NabVirusDataTable(this, cf, virusDomain); } } - return super.createProviderTable(tableType); + return super.createProviderTable(tableType, cf); } - private NAbSpecimenTable createNAbSpecimenTable() + private NAbSpecimenTable createNAbSpecimenTable(ContainerFilter cf) { - return new NAbSpecimenTable(this); + return new NAbSpecimenTable(this, cf); } - private CutoffValueTable createCutoffValueTable() + private CutoffValueTable createCutoffValueTable(ContainerFilter cf) { - return new CutoffValueTable(this); + return new CutoffValueTable(this, cf); } public Set getTableNames() diff --git a/nab/src/org/labkey/nab/query/NabProviderSchema.java b/nab/src/org/labkey/nab/query/NabProviderSchema.java index 4c72e9f8c8..fcb4357686 100644 --- a/nab/src/org/labkey/nab/query/NabProviderSchema.java +++ b/nab/src/org/labkey/nab/query/NabProviderSchema.java @@ -21,6 +21,7 @@ import org.labkey.api.assay.dilution.SampleInfoMethod; import org.labkey.api.assay.dilution.query.DilutionProviderSchema; import org.labkey.api.data.Container; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.EnumTableInfo; import org.labkey.api.data.TableInfo; import org.labkey.api.data.statistics.StatsService; @@ -90,7 +91,7 @@ protected Set getTableNames(boolean visible) } @Override - public TableInfo createTable(String name) + public TableInfo createTable(String name, ContainerFilter cf) { if (SAMPLE_PREPARATION_METHOD_TABLE_NAME.equalsIgnoreCase(name)) { @@ -113,14 +114,14 @@ public TableInfo createTable(String name) String tableName = AssaySchema.getLegacyProtocolTableName(protocol, NabProtocolSchema.DATA_ROW_TABLE_NAME); if (tableName.equalsIgnoreCase(name)) { - return createDataRowTable(protocol); + return createDataRowTable(protocol, cf); } } - return super.createTable(name); + return super.createTable(name, cf); } - public NabRunDataTable createDataRowTable(ExpProtocol protocol) + public NabRunDataTable createDataRowTable(ExpProtocol protocol, ContainerFilter cf) { - return new NabRunDataTable(new NabProtocolSchema(getUser(), getContainer(), getProvider(), protocol, getTargetStudy()), protocol); + return new NabRunDataTable(new NabProtocolSchema(getUser(), getContainer(), getProvider(), protocol, getTargetStudy()), cf, protocol); } } diff --git a/nab/src/org/labkey/nab/query/NabRunDataTable.java b/nab/src/org/labkey/nab/query/NabRunDataTable.java index eb1a379db8..b88be68740 100644 --- a/nab/src/org/labkey/nab/query/NabRunDataTable.java +++ b/nab/src/org/labkey/nab/query/NabRunDataTable.java @@ -22,6 +22,7 @@ import org.labkey.api.assay.nab.query.CutoffValueTable; import org.labkey.api.assay.nab.query.NAbSpecimenTable; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.JdbcType; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.SimpleFilter; @@ -60,9 +61,9 @@ public class NabRunDataTable extends NabBaseTable { protected final NAbSpecimenTable _nabSpecimenTable; - public NabRunDataTable(final NabProtocolSchema schema, final ExpProtocol protocol) + public NabRunDataTable(final NabProtocolSchema schema, ContainerFilter cf, final ExpProtocol protocol) { - super(schema, new NAbSpecimenTable(schema), protocol); + super(schema, new NAbSpecimenTable(schema, cf), cf, protocol); _nabSpecimenTable = (NAbSpecimenTable) getRealTable(); final AssayProvider provider = AssayService.get().getProvider(protocol); @@ -143,12 +144,12 @@ protected ColumnInfo resolveColumn(String name) // node when this was OntologyManager-backed can still be queried there result = wrapColumn("Properties", getRealTable().getColumn("RowId")); result.setIsUnselectable(true); - LookupForeignKey fk = new LookupForeignKey("RowId") + LookupForeignKey fk = new LookupForeignKey(getContainerFilter(), "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return new NabRunDataTable(_schema, _protocol); + return new NabRunDataTable(_schema, getLookupContainerFilter(), _protocol); } @Override @@ -228,7 +229,8 @@ protected void addPropertyColumns(final NabProtocolSchema schema, final ExpProto // add object ID again, this time as a lookup to a virtual property table that contains our selected NAB properties: - QcAwarePropertyForeignKey fk = new QcAwarePropertyForeignKey(pds, this, schema) // Needed by NewNab only to get defaultHiddenProperties + // TODO ContainerFilter -- add ContainerFilter to QcAwarePropertyForeignKey + QcAwarePropertyForeignKey fk = new QcAwarePropertyForeignKey(schema, this, pds) // Needed by NewNab only to get defaultHiddenProperties { @Override protected ColumnInfo constructColumnInfo(ColumnInfo parent, FieldKey name, PropertyDescriptor pd) @@ -237,13 +239,12 @@ protected ColumnInfo constructColumnInfo(ColumnInfo parent, FieldKey name, Prope if (getInputMaterialPropertyName().equals(pd.getName())) { result.setLabel("Specimen"); - result.setFk(new LookupForeignKey("LSID") + result.setFk(new LookupForeignKey(NabRunDataTable.this.getContainerFilter(), "LSID", null) { public TableInfo getLookupTableInfo() { - ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema); + ExpMaterialTable materials = ExperimentService.get().createMaterialTable(ExpSchema.TableType.Materials.toString(), schema, getLookupContainerFilter()); // Make sure we are filtering to the same set of containers - materials.setContainerFilter(getContainerFilter()); if (sampleSet != null) { materials.setSampleSet(sampleSet, true); @@ -275,7 +276,7 @@ public TableInfo getLookupTableInfo() for (Double value : cutoffValuess) { final Integer intCutoff = (int)Math.floor(value); - final CutoffValueTable cutoffValueTable = new CutoffValueTable(schema); + final CutoffValueTable cutoffValueTable = new CutoffValueTable(schema, getContainerFilter()); cutoffValueTable.removeContainerAndProtocolFilters(); cutoffValueTable.addCondition(new SimpleFilter(FieldKey.fromString("Cutoff"), intCutoff)); ColumnInfo nabSpecimenColumn = cutoffValueTable.getColumn("NabSpecimenId"); diff --git a/nab/src/org/labkey/nab/query/NabVirusDataTable.java b/nab/src/org/labkey/nab/query/NabVirusDataTable.java index 64e2ca3847..b3ae522654 100644 --- a/nab/src/org/labkey/nab/query/NabVirusDataTable.java +++ b/nab/src/org/labkey/nab/query/NabVirusDataTable.java @@ -20,6 +20,7 @@ import org.labkey.api.collections.CaseInsensitiveHashMap; import org.labkey.api.collections.CaseInsensitiveHashSet; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.ContainerForeignKey; import org.labkey.api.data.Parameter; import org.labkey.api.data.StatementUtils; @@ -65,9 +66,9 @@ public class NabVirusDataTable extends FilteredTable implem protected final AssayProvider _provider; private Domain _virusDomain = null; - public NabVirusDataTable(AssayProtocolSchema schema, Domain virusDomain) + public NabVirusDataTable(AssayProtocolSchema schema, ContainerFilter cf, Domain virusDomain) { - super(StorageProvisioner.createTableInfo(virusDomain), schema); + super(StorageProvisioner.createTableInfo(virusDomain), schema, cf); _protocol = _userSchema.getProtocol(); _provider = _userSchema.getProvider(); diff --git a/nab/src/org/labkey/nab/query/NabWellDataTable.java b/nab/src/org/labkey/nab/query/NabWellDataTable.java index c68c0e42e8..4f086e626c 100644 --- a/nab/src/org/labkey/nab/query/NabWellDataTable.java +++ b/nab/src/org/labkey/nab/query/NabWellDataTable.java @@ -19,6 +19,7 @@ import org.labkey.api.collections.CaseInsensitiveHashMap; import org.labkey.api.data.AbstractForeignKey; import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.JdbcType; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.TableInfo; @@ -47,9 +48,10 @@ public class NabWellDataTable extends NabBaseTable public static final String VIRUS_WELLGROUP_NAME = "VirusWellgroup"; public static final String SPECIMEN_WELLGROUP_NAME = "SpecimenWellgroup"; public static final String REPLICATE_WELLGROUP_NAME = "ReplicateWellgroup"; - public NabWellDataTable(final NabProtocolSchema schema, ExpProtocol protocol) + + public NabWellDataTable(final NabProtocolSchema schema, ContainerFilter cf, ExpProtocol protocol) { - super(schema, DilutionManager.getTableInfoWellData(), protocol); + super(schema, DilutionManager.getTableInfoWellData(), cf, protocol); addRunColumn(); addSpecimenColumn(); @@ -158,7 +160,7 @@ private void addWellgroupPropertyColumns(Map wellgrou final ColumnInfo wellgroupNameColumn = getColumn(wellgroupNameColumnName); final TableInfo parentTable = this; - wellgroupNameColumn.setFk(new AbstractForeignKey() + wellgroupNameColumn.setFk(new AbstractForeignKey(getUserSchema(), getContainerFilter()) { // This is a little interesting. The virtual table has an ExprColumn for each property, but since the properties // are all from the plate template, their values are fixed, from the point of view of this protocol @@ -183,7 +185,7 @@ public ColumnInfo createLookupColumn(ColumnInfo parent, String displayField) @Override public TableInfo getLookupTableInfo() { - VirtualTable ret = new VirtualTable(ExperimentService.get().getSchema(), null); + VirtualTable ret = new VirtualTable(ExperimentService.get().getSchema(), null, getUserSchema()); for (Map.Entry> propertyEntry : propertyMap.entrySet()) { SQLFragment sql = new SQLFragment("(CASE "); diff --git a/viability/src/org/labkey/viability/ViabilityAssaySchema.java b/viability/src/org/labkey/viability/ViabilityAssaySchema.java index 9287ff550f..b2a1bd0b86 100644 --- a/viability/src/org/labkey/viability/ViabilityAssaySchema.java +++ b/viability/src/org/labkey/viability/ViabilityAssaySchema.java @@ -105,30 +105,32 @@ public Set getTableNames() return result; } - public TableInfo createProviderTable(String name) + @Override + public TableInfo createProviderTable(String name, ContainerFilter cf) { if (name.equalsIgnoreCase(UserTables.ResultSpecimens.name())) - return createResultSpecimensTable(); + return createResultSpecimensTable(cf); - return super.createProviderTable(name); + return super.createProviderTable(name, cf); } @Override - public FilteredTable createDataTable(boolean includeCopiedToStudyColumns) + public FilteredTable createDataTable(ContainerFilter cf, boolean includeCopiedToStudyColumns) { // UNDONE: add copy to study columns when copy to study is implemented //addCopiedToStudyColumns(table, protocol, schema.getUser(), "rowId", true); - return new ResultsTable(); + return new ResultsTable(cf); } - public ResultSpecimensTable createResultSpecimensTable() + public ResultSpecimensTable createResultSpecimensTable(ContainerFilter cf) { - return new ResultSpecimensTable(); + return new ResultSpecimensTable(cf); } public ExpDataTable createDataFileTable() { - ExpDataTable ret = ExperimentService.get().createDataTable(ExpSchema.TableType.Data.toString(), this); + // TODO ContainerFilter + ExpDataTable ret = ExperimentService.get().createDataTable(ExpSchema.TableType.Data.toString(), this, null); ret.addColumn(ExpDataTable.Column.RowId); ret.addColumn(ExpDataTable.Column.Name); ret.addColumn(ExpDataTable.Column.Flag); @@ -145,9 +147,9 @@ class ViabilityAssayTable extends FilteredTable { ViabilityAssayProvider _provider; - protected ViabilityAssayTable(TableInfo table) + protected ViabilityAssayTable(TableInfo table, ContainerFilter cf) { - super(table, ViabilityAssaySchema.this); + super(table, ViabilityAssaySchema.this, cf); _provider = ViabilityManager.get().getProvider(); _defaultVisibleColumns = new ArrayList<>(); setPublicSchemaName(ViabilityAssaySchema.this.getSchemaName()); @@ -201,9 +203,9 @@ public class ResultsTable extends ViabilityAssayTable { protected Domain _resultsDomain; - public ResultsTable() + public ResultsTable(ContainerFilter cf) { - super(ViabilitySchema.getTableInfoResults()); + super(ViabilitySchema.getTableInfoResults(), cf); setName(AssayProtocolSchema.DATA_TABLE_NAME); _resultsDomain = _provider.getResultsDomain(getProtocol()); @@ -291,11 +293,12 @@ else if (ViabilityAssayProvider.ORIGINAL_CELLS_PROPERTY_NAME.equals(dp.getName() ColumnInfo runColumn = addColumn(wrapColumn("Run", getRealTable().getColumn("RunId"))); runColumn.setHidden(true); - runColumn.setFk(new LookupForeignKey("RowId") + runColumn.setFk(new LookupForeignKey(cf, "RowId", null) { public TableInfo getLookupTableInfo() { - ExpRunTable expRunTable = AssayService.get().createRunTable(getProtocol(), _provider, ViabilityAssaySchema.this.getUser(), ViabilityAssaySchema.this.getContainer()); + ExpRunTable expRunTable = AssayService.get().createRunTable(getProtocol(), _provider, + ViabilityAssaySchema.this.getUser(), ViabilityAssaySchema.this.getContainer(), getLookupContainerFilter()); expRunTable.setContainerFilter(getContainerFilter()); return expRunTable; } @@ -340,12 +343,12 @@ protected ColumnInfo resolveColumn(String name) // node can still be queried there. result = wrapColumn("Properties", getRealTable().getColumn("RowId")); result.setIsUnselectable(true); - LookupForeignKey fk = new LookupForeignKey("RowId") + LookupForeignKey fk = new LookupForeignKey(getContainerFilter(), "RowId", null) { @Override public TableInfo getLookupTableInfo() { - return new ResultsTable(); + return new ResultsTable(getLookupContainerFilter()); } }; fk.setPrefixColumnCaption(false); @@ -383,8 +386,8 @@ public SpecimenAggregateColumn(TableInfo parent, String name, JdbcType type, Col @Override public void declareJoins(String parentAlias, Map map) { - ResultSpecimensTable rs = new ResultSpecimensTable(); - // 9024: propogate container filter + ResultSpecimensTable rs = new ResultSpecimensTable(getContainerFilter()); + // 9024: propagate container filter rs.setContainerFilter(getContainerFilter()); List fields = new ArrayList<>(); FieldKey resultId = FieldKey.fromParts("ResultID"); @@ -494,18 +497,18 @@ public void addQueryFieldKeys(Set keys) public class ResultSpecimensTable extends ViabilityAssayTable { - public ResultSpecimensTable() + public ResultSpecimensTable(ContainerFilter cf) { - super(ViabilitySchema.getTableInfoResultSpecimens()); + super(ViabilitySchema.getTableInfoResultSpecimens(), cf); ColumnInfo resultIDCol = addVisible(wrapColumn(getRealTable().getColumn("ResultID"))); resultIDCol.setLabel("Result"); resultIDCol.setKeyField(true); - resultIDCol.setFk(new LookupForeignKey("RowID") + resultIDCol.setFk(new LookupForeignKey(cf, "RowID", null) { public TableInfo getLookupTableInfo() { - ResultsTable results = new ResultsTable(); + ResultsTable results = new ResultsTable(getLookupContainerFilter()); results.setContainerFilter(new DelegatingContainerFilter(ResultSpecimensTable.this)); return results; } diff --git a/viability/src/org/labkey/viability/ViabilityManager.java b/viability/src/org/labkey/viability/ViabilityManager.java index 11617834c7..79c2ec124d 100644 --- a/viability/src/org/labkey/viability/ViabilityManager.java +++ b/viability/src/org/labkey/viability/ViabilityManager.java @@ -381,8 +381,7 @@ public Long handle(ResultSet rs, Connection conn) throws SQLException @Nullable private static SQLFragment specimenAggregates(ViabilityAssaySchema schema, ExpRun run) { - ViabilityAssaySchema.ResultSpecimensTable rs = schema.createResultSpecimensTable(); - rs.setContainerFilter(ContainerFilter.EVERYTHING); + ViabilityAssaySchema.ResultSpecimensTable rs = schema.createResultSpecimensTable(ContainerFilter.EVERYTHING); List fields = new ArrayList<>(); FieldKey resultId = FieldKey.fromParts("ResultID"); From 0624e85ed069cff6f21b82c9ca98f327925ca967 Mon Sep 17 00:00:00 2001 From: Matthew Bellew Date: Mon, 8 Apr 2019 12:11:17 -0700 Subject: [PATCH 2/2] build custom/external modules and add back some @deprecated constructors for backward-compatibility --- TODO_ContainerFilter.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO_ContainerFilter.md b/TODO_ContainerFilter.md index 28abf58d45..b2b0247601 100644 --- a/TODO_ContainerFilter.md +++ b/TODO_ContainerFilter.md @@ -11,6 +11,7 @@ Find classes that override: - AssayProtocolSchema.createProviderTable(String name) - AssayProtocolSchema.createDataTable(boolean includeCopiedToStudyColumns) - AssayProtocolSchema.createRunsTable() +- AssayResultTable.AssayResultTable(AssayProtocolSchema schema, boolean includeCopiedToStudyColumns) convert schemas: ms2, study, annoucements, flow @@ -35,4 +36,7 @@ Check subclasses of LookupForeignKey. getLookupTableInfo() should use getLookup update MultiValuedForeignKey to take CF, check usages of passed in FK to make sure they are configured with CF -Check that subclasses of QueryView initialize ContainerFilter when they construct TableInfo \ No newline at end of file +Check that subclasses of QueryView initialize ContainerFilter when they construct TableInfo + +How does setting effectiveContainer (when != source container) on QFK affect the ContainerFilter? If effectiveContainer != sourceContainer +maybe it should have the same effect as setting lookupContainer? see for instance, ExperimentsTable in oconnorexperiments \ No newline at end of file