Last active
April 26, 2019 07:50
-
-
Save rsoesemann/43529fb435a6e0c69bcddb61d8231e6b to your computer and use it in GitHub Desktop.
(fflib) Domain classes should have no logic besides User Story-related commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class Opportunities extends fflib_SObjectDomain { | |
public Opportunities(List<Opportunity> records) { | |
super(records); | |
} | |
public override void onAfterInsert() { | |
new ApplyDefaultCurrency(recors).execute(); | |
new CalculateRevenueForecast(records) | |
.andThen(new PublishLeadScore().forNew(records)).execute(); | |
} | |
public override void onAfterUpdate(Map<Id,SObject> old) { | |
new EnhanceContactData(records).execute(); | |
new CalculateRevenueForecast(records) | |
.andThen(new PublishLeadScore().forChanged(records)).execute(); | |
} | |
public override void onValidate() { | |
new VerifyThatUser().hasAdvancedPermission(records); | |
new VerifyThat(records) | |
.complyWith(new AccountInformationRules()) | |
.haveNoPotentialDuplicates(); | |
} | |
public override void onAfterDelete() { | |
new RemovedDependantRecords(records).execute(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment