mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-20 14:10:44 +00:00
CE-1180 add option to setPrimaryKeyInInsertedRecords (on the INPUT records)
This commit is contained in:
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user