CE-1180 add option to setPrimaryKeyInInsertedRecords (on the INPUT records)

This commit is contained in:
2024-05-10 12:51:20 -05:00
parent c9e9d62098
commit f009d50631
3 changed files with 70 additions and 2 deletions

View File

@ -157,6 +157,17 @@ public class ReplaceAction extends AbstractQActionFunction<ReplaceInput, Replace
output.setDeleteOutput(deleteOutput);
}
if(input.getSetPrimaryKeyInInsertedRecords())
{
for(int i = 0; i < insertList.size(); i++)
{
if(i < insertOutput.getRecords().size())
{
insertList.get(i).setValue(primaryKeyField, insertOutput.getRecords().get(i).getValue(primaryKeyField));
}
}
}
if(weOwnTheTransaction)
{
transaction.commit();

View File

@ -39,8 +39,9 @@ public class ReplaceInput extends AbstractTableActionInput
private UniqueKey key;
private List<QRecord> records;
private QQueryFilter filter;
private boolean performDeletes = true;
private boolean allowNullKeyValuesToEqual = false;
private boolean performDeletes = true;
private boolean allowNullKeyValuesToEqual = false;
private boolean setPrimaryKeyInInsertedRecords = false;
private boolean omitDmlAudit = false;
@ -271,4 +272,35 @@ public class ReplaceInput extends AbstractTableActionInput
return (this);
}
/*******************************************************************************
** Getter for setPrimaryKeyInInsertedRecords
*******************************************************************************/
public boolean getSetPrimaryKeyInInsertedRecords()
{
return (this.setPrimaryKeyInInsertedRecords);
}
/*******************************************************************************
** Setter for setPrimaryKeyInInsertedRecords
*******************************************************************************/
public void setSetPrimaryKeyInInsertedRecords(boolean setPrimaryKeyInInsertedRecords)
{
this.setPrimaryKeyInInsertedRecords = setPrimaryKeyInInsertedRecords;
}
/*******************************************************************************
** Fluent setter for setPrimaryKeyInInsertedRecords
*******************************************************************************/
public ReplaceInput withSetPrimaryKeyInInsertedRecords(boolean setPrimaryKeyInInsertedRecords)
{
this.setPrimaryKeyInInsertedRecords = setPrimaryKeyInInsertedRecords;
return (this);
}
}