CE-1406 in ensureRecordSecurityLockIsRepresented, getTable using table name, not a (potential) alias; avoid NPE on exposedJoins; whitespace; add cloneable in JoinOn

This commit is contained in:
2024-07-08 14:34:00 -05:00
parent 27c693f0c4
commit 27a6c0d53c
2 changed files with 24 additions and 5 deletions

View File

@ -378,7 +378,7 @@ public class JoinsContext
{ {
securityFieldTableAlias = matchedQueryJoin.getJoinTableOrItsAlias(); securityFieldTableAlias = matchedQueryJoin.getJoinTableOrItsAlias();
} }
tmpTable = instance.getTable(securityFieldTableAlias); tmpTable = instance.getTable(aliasToTableNameMap.getOrDefault(securityFieldTableAlias, securityFieldTableAlias));
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// set the baseTableOrAlias for the next iteration to be this join's joinTableOrAlias // // set the baseTableOrAlias for the next iteration to be this join's joinTableOrAlias //
@ -1118,7 +1118,7 @@ public class JoinsContext
if(useExposedJoins) if(useExposedJoins)
{ {
QTableMetaData mainTable = QContext.getQInstance().getTable(mainTableName); QTableMetaData mainTable = QContext.getQInstance().getTable(mainTableName);
for(ExposedJoin exposedJoin : mainTable.getExposedJoins()) for(ExposedJoin exposedJoin : CollectionUtils.nonNullList(mainTable.getExposedJoins()))
{ {
if(exposedJoin.getJoinTable().equals(joinTableName)) if(exposedJoin.getJoinTable().equals(joinTableName))
{ {
@ -1159,6 +1159,7 @@ public class JoinsContext
} }
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/

View File

@ -26,7 +26,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.joins;
** Specification for (at least part of) how two tables join together - e.g., ** Specification for (at least part of) how two tables join together - e.g.,
** leftField = rightField. Used as part of a list in a QJoinMetaData. ** leftField = rightField. Used as part of a list in a QJoinMetaData.
*******************************************************************************/ *******************************************************************************/
public class JoinOn public class JoinOn implements Cloneable
{ {
private String leftField; private String leftField;
private String rightField; private String rightField;
@ -131,4 +131,22 @@ public class JoinOn
return (this); return (this);
} }
/*******************************************************************************
**
*******************************************************************************/
@Override
public JoinOn clone()
{
try
{
JoinOn clone = (JoinOn) super.clone();
return clone;
}
catch(CloneNotSupportedException e)
{
throw new AssertionError();
}
}
} }