mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
add ability to set and trace processTracerKeyRecord in bulk load
This commit is contained in:
@ -257,7 +257,11 @@ public class RunBackendStepInput extends AbstractActionInput
|
||||
public <E extends QRecordEntity> List<E> getRecordsAsEntities(Class<E> entityClass) throws QException
|
||||
{
|
||||
List<E> rs = new ArrayList<>();
|
||||
for(QRecord record : processState.getRecords())
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// note - important to call getRecords here, which is overwritten in subclasses! //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
for(QRecord record : getRecords())
|
||||
{
|
||||
rs.add(QRecordEntity.fromQRecord(entityClass, record));
|
||||
}
|
||||
@ -601,7 +605,7 @@ public class RunBackendStepInput extends AbstractActionInput
|
||||
***************************************************************************/
|
||||
public void traceMessage(ProcessTracerMessage message)
|
||||
{
|
||||
if(processTracer != null)
|
||||
if(processTracer != null && message != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -55,6 +55,8 @@ public class BulkInsertExtractStep extends AbstractExtractStep
|
||||
@Override
|
||||
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
runBackendStepInput.traceMessage(BulkInsertStepUtils.getProcessTracerKeyRecordMessage(runBackendStepInput));
|
||||
|
||||
int rowsAdded = 0;
|
||||
int originalLimit = Objects.requireNonNullElse(getLimit(), Integer.MAX_VALUE);
|
||||
|
||||
|
@ -35,6 +35,7 @@ import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.savedbulkloadprofiles.SavedBulkLoadProfile;
|
||||
import com.kingsrook.qqq.backend.core.processes.implementations.bulk.insert.model.BulkLoadProfile;
|
||||
import com.kingsrook.qqq.backend.core.processes.implementations.bulk.insert.model.BulkLoadProfileField;
|
||||
import com.kingsrook.qqq.backend.core.processes.tracing.ProcessTracerKeyRecordMessage;
|
||||
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.json.JSONArray;
|
||||
@ -190,4 +191,29 @@ public class BulkInsertStepUtils
|
||||
runProcessInput.addValue("isHeadless", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public static void setProcessTracerKeyRecordMessage(RunProcessInput runProcessInput, ProcessTracerKeyRecordMessage processTracerKeyRecordMessage)
|
||||
{
|
||||
runProcessInput.addValue("processTracerKeyRecordMessage", processTracerKeyRecordMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public static ProcessTracerKeyRecordMessage getProcessTracerKeyRecordMessage(RunBackendStepInput runBackendStepInput)
|
||||
{
|
||||
Serializable value = runBackendStepInput.getValue("processTracerKeyRecordMessage");
|
||||
if(value instanceof ProcessTracerKeyRecordMessage processTracerKeyRecordMessage)
|
||||
{
|
||||
return (processTracerKeyRecordMessage);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* QQQ - Low-code Application Framework for Engineers.
|
||||
* Copyright (C) 2021-2025. Kingsrook, LLC
|
||||
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
* contact@kingsrook.com
|
||||
* https://github.com/Kingsrook/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.kingsrook.qqq.backend.core.processes.tracing;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Specialization of process tracer message, to indicate a 'key record' that was
|
||||
** used as an input or trigger to a process.
|
||||
*******************************************************************************/
|
||||
public class ProcessTracerKeyRecordMessage extends ProcessTracerMessage
|
||||
{
|
||||
private final String tableName;
|
||||
private final Integer recordId;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public ProcessTracerKeyRecordMessage(String tableName, Integer recordId)
|
||||
{
|
||||
super("Process Key Record is " + tableName + " " + recordId);
|
||||
this.tableName = tableName;
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for tableName
|
||||
*******************************************************************************/
|
||||
public String getTableName()
|
||||
{
|
||||
return (this.tableName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for recordId
|
||||
*******************************************************************************/
|
||||
public Integer getRecordId()
|
||||
{
|
||||
return (this.recordId);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user