fferpcore.PluggableTriggerglobal inherited sharing class PluggableTrigger extends fflib_SObjectDomain A domain class for an Apex trigger which executes any pluggable triggers (classes implementing PluggableTriggerApi.Plugin). It is intended to be instantiated from an Apex trigger with the methods invoked according to the trigger operation, for example, onBeforeInsert() when Trigger.OperationType equals BEFORE_INSERT. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. trigger BillingDocumentTrigger on BillingDocument__c( before insert, before update, before delete, after insert, after update, after delete, after undelete ) { List<SObject> domainRecords; switch on Trigger.operationType { when BEFORE_DELETE, AFTER_DELETE { domainRecords = Trigger.old; } when else { domainRecords = Trigger.new; } } try { fferpcore.PluggableTrigger target = new fferpcore.PluggableTrigger.Constructor().construct(domainRecords); switch on Trigger.operationType { when BEFORE_INSERT { target.onBeforeInsert(); } when AFTER_INSERT { target.onAfterInsert(); } when BEFORE_UPDATE { target.onBeforeUpdate(); } when AFTER_UPDATE { target.onAfterUpdate(); } when BEFORE_DELETE { target.onBeforeDelete(); } when AFTER_DELETE { target.onAfterDelete(); } } } catch (Exception e) { for (SObject record : domainRecords) { record.addError(e); } } } Methods
PluggableTriggerglobal PluggableTrigger(List<SObject> sObjectList, List<fferpcore.PluggableTriggerApi.Plugin> plugins) Construct this domain class. Input Parameters
onBeforeInsertglobal override void onBeforeInsert() Invokes onBeforeInsert() on each pluggable trigger. onBeforeUpdateglobal override void onBeforeUpdate(Map<Id, SObject> existingRecords) Invokes onBeforeUpdate() on each pluggable trigger. Input Parameters
onBeforeDeleteglobal override void onBeforeDelete() Invokes onBeforeDelete() on each pluggable trigger. onAfterInsertglobal override void onAfterInsert() Invokes onAfterInsert() on each pluggable trigger. onAfterUpdateglobal override void onAfterUpdate(Map<Id, SObject> existingRecords) Invokes onAfterUpdate() on each pluggable trigger. Input Parameters
onAfterDeleteglobal override void onAfterDelete() Invokes onAfterDelete() on each pluggable trigger. onAfterUndeleteglobal override void onAfterUndelete() Invokes onAfterUndelete() on each pluggable trigger. fferpcore.PluggableTrigger.Constructorglobal inherited sharing class Constructor implements fflib_SObjectDomain.IConstructable Responsible for finding and constructing any pluggable triggers. MethodsConstructorglobal Constructor() constructglobal fferpcore.PluggableTrigger construct(List<SObject> objects) Constructs the pluggable triggers. Input Parameters
|