From ac7a57cda1ea1d60329601086929d03da8616d1e Mon Sep 17 00:00:00 2001 From: Kamil Date: Sat, 24 Aug 2024 15:34:59 +0200 Subject: [PATCH 1/2] chore: rough implementation of logical inverse --- .../DomainProcessCoordinator.cls | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls b/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls index a226e01..197b4c1 100644 --- a/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls +++ b/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls @@ -366,8 +366,23 @@ public class DomainProcessCoordinator ((IDomainProcessWithParamsCriteria)criteriaClazz).setParams(params); } - // TODO: Still need to figure out how to make use of currentDomainProcess.LogicalInverse__c here. - qualifiedRecords = criteriaClazz.run(); + List criteriaRunResult = criteriaClazz.run(); + if (currentDomainProcess.LogicalInverse__c == true) + { + for (SObject currentSObject : criteriaRunResult) { + for (Integer i = 0; i < qualifiedRecords.size(); i++) { + SObject currentQualifiedRecord = qualifiedRecords[i]; + if (currentSObject == currentQualifiedRecord) { + qualifiedRecords.remove(i); + break; + } + } + } + } + else + { + qualifiedRecords = criteriaRunResult; + } } catch (Exception e) { From 2bbb33fd30d7c9afbcd0d95f599be7b67b1d4d0d Mon Sep 17 00:00:00 2001 From: Kamil Date: Sat, 24 Aug 2024 15:59:47 +0200 Subject: [PATCH 2/2] style: update the style to match the rest of the project --- .../DomainProcessCoordinator.cls | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls b/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls index 197b4c1..004fc7b 100644 --- a/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls +++ b/sfdx-source/core/main/classes/framework-domain-process-injection/DomainProcessCoordinator.cls @@ -369,10 +369,13 @@ public class DomainProcessCoordinator List criteriaRunResult = criteriaClazz.run(); if (currentDomainProcess.LogicalInverse__c == true) { - for (SObject currentSObject : criteriaRunResult) { - for (Integer i = 0; i < qualifiedRecords.size(); i++) { + for (SObject currentSObject : criteriaRunResult) + { + for (Integer i = 0; i < qualifiedRecords.size(); i++) + { SObject currentQualifiedRecord = qualifiedRecords[i]; - if (currentSObject == currentQualifiedRecord) { + if (currentSObject == currentQualifiedRecord) + { qualifiedRecords.remove(i); break; }