Skip to content

Commit

Permalink
Categories schema (#6187)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-matthewb authored Jan 7, 2025
1 parent 4c13492 commit a328f48
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion api/src/org/labkey/api/query/SimpleUserSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public String getDomainURI(String queryName)
public static class SimpleTable<SchemaType extends UserSchema> extends FilteredTable<SchemaType> implements UpdateableTableInfo
{
protected ColumnInfo _objectUriCol;
protected ColumnInfo _objectIdCol;
protected Domain _domain;
protected boolean _readOnly;

Expand Down Expand Up @@ -370,6 +371,14 @@ else if (col.getFk() != null)
wrap.setShownInDetailsView(false);
wrap.setHidden(true);
}
if (null == _objectIdCol && colName.equalsIgnoreCase("objectId") && isObjectIdLookup(pkColName, fk.getLookupTableName(), fk.getLookupSchemaName()))
{
_objectIdCol = wrap;
wrap.setShownInInsertView(false);
wrap.setShownInUpdateView(false);
wrap.setShownInDetailsView(false);
wrap.setHidden(true);
}
}
}
}
Expand All @@ -384,7 +393,16 @@ protected Collection<FieldKey> addDomainColumns()
for (DomainProperty dp : domain.getProperties())
{
PropertyDescriptor pd = dp.getPropertyDescriptor();
PropertyColumn propColumn = new PropertyColumn(pd, _objectUriCol, getContainer(), _userSchema.getUser(), true);
PropertyColumn propColumn;
if (null != _objectIdCol)
{
propColumn = new PropertyColumn(pd, _objectIdCol, getContainer(), _userSchema.getUser(), true);
propColumn.setParentIsObjectId(true);
}
else
{
propColumn = new PropertyColumn(pd, _objectUriCol, getContainer(), _userSchema.getUser(), true);
}
if (getColumn(propColumn.getName()) == null)
{
addColumn(propColumn);
Expand Down Expand Up @@ -415,6 +433,13 @@ private boolean isObjectUriLookup(String pkColName, String tableName, String sch
"exp".equalsIgnoreCase(schemaName);
}

private boolean isObjectIdLookup(String pkColName, String tableName, String schemaName)
{
return "ObjectId".equalsIgnoreCase(pkColName) &&
"Object".equalsIgnoreCase(tableName) &&
"exp".equalsIgnoreCase(schemaName);
}

public ColumnInfo getObjectUriColumn()
{
return _objectUriCol;
Expand Down

0 comments on commit a328f48

Please sign in to comment.