Skip to content

Deprecate the legacy name map along with the audit union table #6903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.labkey.api.security.roles.CanSeeAuditLogRole;
import org.labkey.api.security.roles.Role;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.settings.OptionalFeatureService;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -50,6 +51,8 @@

public class DefaultAuditTypeTable extends FilteredTable<UserSchema>
{
public static final String LEGACY_UNION_AUDIT_TABLE = "legacyUnionAuditTable";

protected AuditTypeProvider _provider;
protected Map<FieldKey, String> _legacyNameMap;
protected Map<String, String> _dbSchemaToColumnMap;
Expand All @@ -64,7 +67,7 @@ public DefaultAuditTypeTable(AuditTypeProvider provider, TableInfo storage, User
if (_provider.getDescription() != null)
setDescription(_provider.getDescription());

_legacyNameMap = provider.legacyNameMap();
_legacyNameMap = OptionalFeatureService.get().isFeatureEnabled(LEGACY_UNION_AUDIT_TABLE) ? provider.legacyNameMap() : Map.of();

// Create a mapping from the real dbTable names to the legacy query table names for QueryUpdateService.
_dbSchemaToColumnMap = new CaseInsensitiveHashMap<>();
Expand Down
26 changes: 13 additions & 13 deletions api/src/org/labkey/api/data/ContainerDisplayColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ public void testDisplayColumn() throws Exception
fieldKeys.add(FieldKey.fromString("ProjectId"));
fieldKeys.add(FieldKey.fromString("ProjectId/Name"));
fieldKeys.add(FieldKey.fromString("ProjectId/Parent/Name"));
fieldKeys.add(FieldKey.fromString("ContainerId"));
fieldKeys.add(FieldKey.fromString("ContainerId/Name"));
fieldKeys.add(FieldKey.fromString("Container"));
fieldKeys.add(FieldKey.fromString("Container/Name"));
fieldKeys.add(FieldKey.fromString("Comment"));
mpv.addPropertyValue("query.columns", StringUtils.join(fieldKeys, ","));

Expand Down Expand Up @@ -243,14 +243,14 @@ else if (comment.contains(workbook1.getName() + " was created") ||
comment.contains(subFolder2.getName() + " was created"))
{
// These are all containers that have since been deleted, so we can't join to the container row for details
assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ContainerId").optString("value", null));
assertEquals("Incorrect json value for ContainerId column", "<deleted>", row.getJSONObject("ContainerId").getString("displayValue"));
assertNull("Incorrect json value for Container column", row.getJSONObject("Container").optString("value", null));
assertEquals("Incorrect json value for Container column", "<deleted>", row.getJSONObject("Container").getString("displayValue"));

assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ContainerId/Name").optString("value", null));
assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ContainerId/Name").optString("displayValue", null));
assertNull("Incorrect json value for Container column", row.getJSONObject("Container/Name").optString("value", null));
assertNull("Incorrect json value for Container column", row.getJSONObject("Container/Name").optString("displayValue", null));

assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ProjectId/Parent/Name").optString("value", null));
assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ProjectId/Parent/Name").optString("displayValue", null));
assertNull("Incorrect json value for ProjectId column", row.getJSONObject("ProjectId/Parent/Name").optString("value", null));
assertNull("Incorrect json value for ProjectId column", row.getJSONObject("ProjectId/Parent/Name").optString("displayValue", null));
}
else
{
Expand All @@ -262,13 +262,13 @@ else if (comment.contains(workbook1.getName() + " was created") ||

private void validateContainerRow(Container project, JSONObject row)
{
assertEquals("Incorrect json value for ContainerId column", project.getEntityId().toString(), row.getJSONObject("ContainerId").getString("value"));
assertEquals("Incorrect json value for ContainerId column", project.getName(), row.getJSONObject("ContainerId").getString("displayValue"));
assertEquals("Incorrect json value for Container column", project.getEntityId().toString(), row.getJSONObject("Container").getString("value"));
assertEquals("Incorrect json value for Container column", project.getName(), row.getJSONObject("Container").getString("displayValue"));

assertEquals("Incorrect json value for ContainerId column", project.getName(), row.getJSONObject("ContainerId/Name").getString("value"));
assertEquals("Incorrect json value for Container column", project.getName(), row.getJSONObject("Container/Name").getString("value"));

assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ProjectId/Parent/Name").optString("value", null));
assertNull("Incorrect json value for ContainerId column", row.getJSONObject("ProjectId/Parent/Name").optString("displayValue", null));
assertNull("Incorrect json value for ProjectId column", row.getJSONObject("ProjectId/Parent/Name").optString("value", null));
assertNull("Incorrect json value for ProjectId column", row.getJSONObject("ProjectId/Parent/Name").optString("displayValue", null));
}
}
}
5 changes: 2 additions & 3 deletions audit/src/org/labkey/audit/AuditModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.jetbrains.annotations.NotNull;
import org.labkey.api.audit.AuditLogService;
import org.labkey.api.audit.provider.SiteSettingsAuditProvider;
import org.labkey.api.audit.query.DefaultAuditTypeTable;
import org.labkey.api.module.DefaultModule;
import org.labkey.api.module.ModuleContext;
import org.labkey.api.settings.OptionalFeatureFlag;
Expand All @@ -32,8 +33,6 @@

public class AuditModule extends DefaultModule
{
public static final String LEGACY_UNION_AUDIT_TABLE = "legacyUnionAuditTable";

@Override
@NotNull
protected Collection<WebPartFactory> createWebPartFactories()
Expand Down Expand Up @@ -80,7 +79,7 @@ public void doStartup(ModuleContext moduleContext)

AuditController.registerAdminConsoleLinks();
OptionalFeatureService.get().addFeatureFlag(new OptionalFeatureFlag(
LEGACY_UNION_AUDIT_TABLE,
DefaultAuditTypeTable.LEGACY_UNION_AUDIT_TABLE,
"Restore legacy union audit table",
"Restores a legacy query that unions all the event tables together into a single query. This option will be removed in LabKey Server v26.3.",
false,
Expand Down
2 changes: 1 addition & 1 deletion audit/src/org/labkey/audit/query/AuditQuerySchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.LinkedHashSet;
import java.util.Set;

import static org.labkey.audit.AuditModule.LEGACY_UNION_AUDIT_TABLE;
import static org.labkey.api.audit.query.DefaultAuditTypeTable.LEGACY_UNION_AUDIT_TABLE;

public class AuditQuerySchema extends UserSchema
{
Expand Down