mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Audit cleanups (process names for automations; no audit if no fields changed;
This commit is contained in:
@ -210,12 +210,15 @@ public class DMLAuditAction extends AbstractQActionFunction<DMLAuditInput, DMLAu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(details.isEmpty())
|
if(details.isEmpty() && DMLType.UPDATE.equals(dmlType))
|
||||||
{
|
{
|
||||||
details.add(new QRecord().withValue("message", "No fields values were changed."));
|
// no, let's just noop.
|
||||||
|
// details.add(new QRecord().withValue("message", "No fields values were changed."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AuditAction.appendToInput(auditInput, table.getName(), record.getValueInteger(table.getPrimaryKeyField()), getRecordSecurityKeyValues(table, record), "Record was " + dmlType.pastTenseVerb + contextSuffix, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuditAction.appendToInput(auditInput, table.getName(), record.getValueInteger(table.getPrimaryKeyField()), getRecordSecurityKeyValues(table, record), "Record was " + dmlType.pastTenseVerb + contextSuffix, details);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,11 +381,20 @@ public class PollingAutomationPerTableRunner implements Runnable
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
RunProcessAction runProcessAction = new RunProcessAction();
|
try
|
||||||
RunProcessOutput runProcessOutput = runProcessAction.execute(runProcessInput);
|
|
||||||
if(runProcessOutput.getException().isPresent())
|
|
||||||
{
|
{
|
||||||
throw (runProcessOutput.getException().get());
|
QContext.pushAction(runProcessInput);
|
||||||
|
|
||||||
|
RunProcessAction runProcessAction = new RunProcessAction();
|
||||||
|
RunProcessOutput runProcessOutput = runProcessAction.execute(runProcessInput);
|
||||||
|
if(runProcessOutput.getException().isPresent())
|
||||||
|
{
|
||||||
|
throw (runProcessOutput.getException().get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
QContext.popAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(action.getCodeReference() != null)
|
else if(action.getCodeReference() != null)
|
||||||
|
@ -265,6 +265,8 @@ public class ScheduleManager
|
|||||||
runProcessInput.setProcessName(process.getName());
|
runProcessInput.setProcessName(process.getName());
|
||||||
runProcessInput.setFrontendStepBehavior(RunProcessInput.FrontendStepBehavior.SKIP);
|
runProcessInput.setFrontendStepBehavior(RunProcessInput.FrontendStepBehavior.SKIP);
|
||||||
|
|
||||||
|
QContext.pushAction(runProcessInput);
|
||||||
|
|
||||||
RunProcessAction runProcessAction = new RunProcessAction();
|
RunProcessAction runProcessAction = new RunProcessAction();
|
||||||
runProcessAction.execute(runProcessInput);
|
runProcessAction.execute(runProcessInput);
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,17 @@ class DMLAuditActionTest extends BaseTest
|
|||||||
assertTrue(auditDetailList.stream().noneMatch(r -> r.getValueString("message").contains("Favorite Shape")));
|
assertTrue(auditDetailList.stream().noneMatch(r -> r.getValueString("message").contains("Favorite Shape")));
|
||||||
MemoryRecordStore.getInstance().reset();
|
MemoryRecordStore.getInstance().reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// confirm if nothing changed on an edit, that no audit. //
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
{
|
||||||
|
qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY).setAuditRules(new QAuditRules().withAuditLevel(AuditLevel.FIELD));
|
||||||
|
new DMLAuditAction().execute(new DMLAuditInput().withTableActionInput(updateInput).withRecordList(recordList).withOldRecordList(recordList));
|
||||||
|
List<QRecord> auditList = TestUtils.queryTable("audit");
|
||||||
|
assertEquals(0, auditList.size());
|
||||||
|
MemoryRecordStore.getInstance().reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user