mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
CTLE-419: updated SyncProcessConfig record to take in performInserts/performUpdates as params
This commit is contained in:
@ -164,12 +164,8 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
|
||||
/*******************************************************************************
|
||||
** Record to store the config for this process - e.g., what fields & tables are used.
|
||||
*******************************************************************************/
|
||||
public record SyncProcessConfig(String sourceTable, String sourceTableKeyField, String destinationTable, String destinationTableForeignKey)
|
||||
public record SyncProcessConfig(String sourceTable, String sourceTableKeyField, String destinationTable, String destinationTableForeignKey, boolean performInserts, boolean performUpdates)
|
||||
{
|
||||
public static boolean performUpdates = true;
|
||||
public static boolean performInserts = true;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** artificial method, here to make jacoco see that this class is indeed
|
||||
@ -180,74 +176,6 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
|
||||
System.out.println("noop");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for performUpdates
|
||||
**
|
||||
*******************************************************************************/
|
||||
public boolean getPerformUpdates()
|
||||
{
|
||||
return performUpdates;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for performUpdates
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setPerformUpdates(boolean performUpdates)
|
||||
{
|
||||
SyncProcessConfig.performUpdates = performUpdates;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for performUpdates
|
||||
**
|
||||
*******************************************************************************/
|
||||
public SyncProcessConfig withPerformUpdates(boolean performUpdates)
|
||||
{
|
||||
SyncProcessConfig.performUpdates = performUpdates;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for performInserts
|
||||
**
|
||||
*******************************************************************************/
|
||||
public boolean getPerformInserts()
|
||||
{
|
||||
return performInserts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for performInserts
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setPerformInserts(boolean performInserts)
|
||||
{
|
||||
SyncProcessConfig.performInserts = performInserts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for performInserts
|
||||
**
|
||||
*******************************************************************************/
|
||||
public SyncProcessConfig withPerformInserts(boolean performInserts)
|
||||
{
|
||||
SyncProcessConfig.performInserts = performInserts;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -366,12 +294,12 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
|
||||
QRecord existingRecord = existingRecordsByForeignKey.get(sourceKeyValueInTargetFieldType);
|
||||
|
||||
QRecord recordToStore;
|
||||
if(existingRecord != null && config.getPerformUpdates())
|
||||
if(existingRecord != null && config.performUpdates)
|
||||
{
|
||||
recordToStore = existingRecord;
|
||||
okToUpdate.incrementCount();
|
||||
}
|
||||
else if(existingRecord == null && config.getPerformInserts())
|
||||
else if(existingRecord == null && config.performInserts)
|
||||
{
|
||||
recordToStore = new QRecord();
|
||||
okToInsert.incrementCount();
|
||||
|
@ -204,7 +204,7 @@ class TableSyncProcessTest extends BaseTest
|
||||
@Override
|
||||
protected SyncProcessConfig getSyncProcessConfig()
|
||||
{
|
||||
SyncProcessConfig syncProcessConfig = new SyncProcessConfig(TestUtils.TABLE_NAME_PERSON_MEMORY, "id", "peopleSync", "sourcePersonId");
|
||||
SyncProcessConfig syncProcessConfig = new SyncProcessConfig(TestUtils.TABLE_NAME_PERSON_MEMORY, "id", "peopleSync", "sourcePersonId", true, true);
|
||||
syncProcessConfig.noop();
|
||||
return (syncProcessConfig);
|
||||
}
|
||||
|
Reference in New Issue
Block a user