-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
198 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<query xmlns="http://labkey.org/data/xml/query"> | ||
<metadata> | ||
<tables xmlns="http://labkey.org/data/xml"> | ||
<table tableName="LookupSets" tableDbType="NOT_IN_DB"> | ||
<titleColumn>SetName</titleColumn> | ||
<columns> | ||
<column columnName="LookupSetId"> | ||
<isHidden>true</isHidden> | ||
</column> | ||
<column columnName="IsInUse"> | ||
<isHidden>true</isHidden> | ||
</column> | ||
</columns> | ||
</table> | ||
</tables> | ||
</metadata> | ||
</query> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<customView xmlns="http://labkey.org/data/xml/queryCustomView"> | ||
<columns> | ||
<column name="SetName"/> | ||
</columns> | ||
<sorts> | ||
<sort column="SetName"/> | ||
</sorts> | ||
</customView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<customView xmlns="http://labkey.org/data/xml/queryCustomView"> | ||
<columns> | ||
<column name="Value"/> | ||
<column name="Displayable"/> | ||
<column name="SortOrder"/> | ||
</columns> | ||
<sorts> | ||
<sort column="SortOrder"/> | ||
<sort column="Value"/> | ||
</sorts> | ||
</customView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE UNIQUE INDEX IDX_LookupSets_SetName | ||
ON snd.LookupSets (SetName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3380,5 +3380,5 @@ public List<Map<String, Object>> getProjectItemsList(Container c, User u, int pr | |
|
||
return projectItems; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,42 @@ | ||
/* | ||
* Copyright (c) 2018-2019 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.snd.query; | ||
|
||
import org.labkey.api.data.ColumnInfo; | ||
import org.labkey.api.data.Container; | ||
import org.labkey.api.data.ContainerFilter; | ||
import org.labkey.api.data.JdbcType; | ||
import org.labkey.api.data.SQLFragment; | ||
import org.labkey.api.data.TableInfo; | ||
import org.labkey.api.query.ExprColumn; | ||
import org.labkey.api.query.SimpleUserSchema.SimpleTable; | ||
import org.labkey.snd.SNDSchema; | ||
import org.labkey.snd.SNDUserSchema; | ||
|
||
import java.util.Map; | ||
public class LookupSetsTable extends SimpleTable<SNDUserSchema> { | ||
|
||
/** | ||
* Created by marty on 9/17/2017. | ||
*/ | ||
public class LookupSetsTable extends SimpleTable<SNDUserSchema> | ||
{ | ||
private static final String CACHE_KEY = LookupSetsTable.class.getName() + "||values"; | ||
private static final String SETNAME_COL = "SetName"; | ||
private static final String LABEL_COL = "Label"; | ||
private static final String DESCRIPTION_COL = "Description"; | ||
private static final String LOOKUPSETID_COL = "LookupSetId"; | ||
private Integer _lookupSetId; | ||
|
||
|
||
public LookupSetsTable(SNDUserSchema schema, TableInfo table, String setName, Map<String, Object> map, ContainerFilter cf) | ||
{ | ||
super(schema, table, cf); | ||
|
||
_lookupSetId = (Integer) map.get(LOOKUPSETID_COL); | ||
|
||
if (map.containsKey(LABEL_COL)) | ||
setTitle((String)map.get(LABEL_COL)); | ||
|
||
if (map.containsKey(DESCRIPTION_COL)) | ||
setDescription((String) map.get(DESCRIPTION_COL)); | ||
|
||
} | ||
|
||
public static String getCacheKey(Container c) | ||
{ | ||
return CACHE_KEY + "||" + c.getId(); | ||
} | ||
/** | ||
* Create the simple table. | ||
* SimpleTable doesn't add columns until .init() has been called to allow derived classes to fully initialize themselves before adding columns. | ||
* | ||
* @param schema | ||
* @param table | ||
*/ | ||
public LookupSetsTable(SNDUserSchema schema, TableInfo table, ContainerFilter cf) { super(schema, table, cf); } | ||
|
||
@Override | ||
public LookupSetsTable init() | ||
{ | ||
public LookupSetsTable init() { | ||
super.init(); | ||
|
||
ColumnInfo col = getRealTable().getColumn(LOOKUPSETID_COL); | ||
addCondition(col, _lookupSetId); | ||
SQLFragment isInUseQuery = new SQLFragment(); | ||
isInUseQuery.append("(CASE WHEN EXISTS (SELECT ls.SetName FROM "); | ||
isInUseQuery.append(SNDSchema.getInstance().getTableInfoLookupSets(), "ls"); | ||
isInUseQuery.append(" INNER JOIN "); | ||
isInUseQuery.append(_userSchema.getTable("PackageAttribute").getFromSQL("pa")); | ||
isInUseQuery.append(" ON ls.SetName = pa.LookupQuery "); | ||
isInUseQuery.append(" WHERE " + ExprColumn.STR_TABLE_ALIAS + ".LookupSetId = ls.LookupSetId) "); | ||
isInUseQuery.append(" THEN 'true' else 'false' END)"); | ||
ExprColumn isInUseColumn = new ExprColumn(this, "IsInUse", isInUseQuery, JdbcType.BOOLEAN); | ||
addColumn(isInUseColumn); | ||
|
||
return this; | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2018-2019 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.snd.query; | ||
|
||
import org.labkey.api.data.ColumnInfo; | ||
import org.labkey.api.data.Container; | ||
import org.labkey.api.data.ContainerFilter; | ||
import org.labkey.api.data.JdbcType; | ||
import org.labkey.api.data.SQLFragment; | ||
import org.labkey.api.data.TableInfo; | ||
import org.labkey.api.query.ExprColumn; | ||
import org.labkey.api.query.SimpleUserSchema.SimpleTable; | ||
import org.labkey.snd.SNDSchema; | ||
import org.labkey.snd.SNDUserSchema; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Created by marty on 9/17/2017. | ||
*/ | ||
public class LookupSetsVirtualTable extends SimpleTable<SNDUserSchema> | ||
{ | ||
private static final String CACHE_KEY = LookupSetsVirtualTable.class.getName() + "||values"; | ||
private static final String SETNAME_COL = "SetName"; | ||
private static final String LABEL_COL = "Label"; | ||
private static final String DESCRIPTION_COL = "Description"; | ||
private static final String LOOKUPSETID_COL = "LookupSetId"; | ||
private Integer _lookupSetId; | ||
|
||
|
||
public LookupSetsVirtualTable(SNDUserSchema schema, TableInfo table, String setName, Map<String, Object> map, ContainerFilter cf) | ||
{ | ||
super(schema, table, cf); | ||
|
||
_lookupSetId = (Integer) map.get(LOOKUPSETID_COL); | ||
|
||
if (map.containsKey(LABEL_COL)) | ||
setTitle((String)map.get(LABEL_COL)); | ||
|
||
if (map.containsKey(DESCRIPTION_COL)) | ||
setDescription((String) map.get(DESCRIPTION_COL)); | ||
|
||
} | ||
|
||
public static String getCacheKey(Container c) | ||
{ | ||
return CACHE_KEY + "||" + c.getId(); | ||
} | ||
|
||
@Override | ||
public LookupSetsVirtualTable init() | ||
{ | ||
super.init(); | ||
|
||
ColumnInfo col = getRealTable().getColumn(LOOKUPSETID_COL); | ||
addCondition(col, _lookupSetId); | ||
|
||
return this; | ||
} | ||
|
||
} |
Oops, something went wrong.