├── sfdx-source ├── untracked │ └── README.md ├── reference-implementation-sales │ ├── main │ │ ├── README.md │ │ ├── classes │ │ │ ├── domains │ │ │ │ ├── ILeads.cls-meta.xml │ │ │ │ ├── Leads.cls-meta.xml │ │ │ │ ├── ILeads.cls │ │ │ │ └── Leads.cls │ │ │ ├── selectors │ │ │ │ ├── LeadsSelector.cls-meta.xml │ │ │ │ ├── ILeadsSelector.cls-meta.xml │ │ │ │ ├── ILeadsSelector.cls │ │ │ │ └── LeadsSelector.cls │ │ │ ├── services │ │ │ │ ├── Sales_AccountsService.cls-meta.xml │ │ │ │ └── Sales_AccountsService.cls │ │ │ └── event-consumers │ │ │ │ ├── Sales_PlatformEventsConsumer.cls-meta.xml │ │ │ │ └── Sales_PlatformEventsConsumer.cls │ │ └── schema │ │ │ └── customMetadata │ │ │ ├── ApplicationFactory_DomainBinding.LeadSObjectBinding.md-meta.xml │ │ │ ├── ApplicationFactory_SelectorBinding.LeadSObjectBinding.md-meta.xml │ │ │ ├── ApplicationFactory_UnitOfWorkBinding.Lead_UOW_Binding.md-meta.xml │ │ │ └── PlatformEvents_Subscription.Sales_PlatformEventsConsumer.md-meta.xml │ └── test │ │ └── README.md ├── reference-implementation-common │ ├── main │ │ ├── README.md │ │ ├── classes │ │ │ ├── domains │ │ │ │ ├── Accounts.cls-meta.xml │ │ │ │ ├── IAccounts.cls-meta.xml │ │ │ │ ├── IAccounts.cls │ │ │ │ └── Accounts.cls │ │ │ ├── eventpublishers │ │ │ │ ├── AccountModsEventPublisher.cls-meta.xml │ │ │ │ └── AccountModsEventPublisher.cls │ │ │ ├── services │ │ │ │ ├── AccountsService.cls-meta.xml │ │ │ │ ├── IAccountsService.cls-meta.xml │ │ │ │ ├── AccountsServiceImpl.cls-meta.xml │ │ │ │ ├── IAccountsService.cls │ │ │ │ ├── AccountsService.cls │ │ │ │ └── AccountsServiceImpl.cls │ │ │ └── selectors │ │ │ │ ├── AccountsSelector.cls-meta.xml │ │ │ │ ├── ContactsSelector.cls-meta.xml │ │ │ │ ├── IAccountsSelector.cls-meta.xml │ │ │ │ ├── IContactsSelector.cls-meta.xml │ │ │ │ ├── IAccountsSelector.cls │ │ │ │ ├── IContactsSelector.cls │ │ │ │ ├── ContactsSelector.cls │ │ │ │ └── AccountsSelector.cls │ │ ├── triggers │ │ │ ├── Accounts.trigger-meta.xml │ │ │ └── Accounts.trigger │ │ └── schema │ │ │ └── customMetadata │ │ │ ├── ApplicationFactory_ServiceBinding.IAccountsServiceBinding.md-meta.xml │ │ │ ├── ApplicationFactory_SelectorBinding.AccountSObjectBinding.md-meta.xml │ │ │ ├── ApplicationFactory_SelectorBinding.ContactSObjectBinding.md-meta.xml │ │ │ ├── ApplicationFactory_UnitOfWorkBinding.Account_UOW_Binding.md-meta.xml │ │ │ ├── ApplicationFactory_UnitOfWorkBinding.Contact_UOW_Binding.md-meta.xml │ │ │ └── ApplicationFactory_DomainBinding.AccountSObjectBinding.md-meta.xml │ └── test │ │ ├── README.md │ │ └── classes │ │ ├── selectors │ │ ├── AccountsSelectorTest.cls-meta.xml │ │ └── AccountsSelectorTest.cls │ │ └── services │ │ ├── AccountsServiceTest.cls-meta.xml │ │ └── AccountsServiceTest.cls ├── reference-implementation-service │ ├── main │ │ ├── README.md │ │ ├── classes │ │ │ ├── domains │ │ │ │ ├── Cases.cls-meta.xml │ │ │ │ ├── ICases.cls-meta.xml │ │ │ │ ├── ICases.cls │ │ │ │ └── Cases.cls │ │ │ └── selectors │ │ │ │ ├── CasesSelector.cls-meta.xml │ │ │ │ ├── ICasesSelector.cls-meta.xml │ │ │ │ ├── ICasesSelector.cls │ │ │ │ └── CasesSelector.cls │ │ └── schema │ │ │ └── customMetadata │ │ │ ├── ApplicationFactory_SelectorBinding.CaseSObjectBinding.md-meta.xml │ │ │ ├── ApplicationFactory_DomainBinding.CaseSObjectBinding.md-meta.xml │ │ │ └── ApplicationFactory_UnitOfWorkBinding.Case_UOW_Binding.md-meta.xml │ └── test │ │ └── README.md ├── reference-implementation-marketing │ ├── main │ │ ├── README.md │ │ ├── classes │ │ │ ├── domains │ │ │ │ ├── Campaigns.cls-meta.xml │ │ │ │ ├── ICampaigns.cls-meta.xml │ │ │ │ ├── ICampaigns.cls │ │ │ │ └── Campaigns.cls │ │ │ ├── selectors │ │ │ │ ├── CampaignsSelector.cls-meta.xml │ │ │ │ ├── ICampaignsSelector.cls-meta.xml │ │ │ │ ├── SelectBySloganSelectorMethod.cls-meta.xml │ │ │ │ ├── SelectBySloganSelectorMethod.cls │ │ │ │ ├── ICampaignsSelector.cls │ │ │ │ └── CampaignsSelector.cls │ │ │ ├── criteria │ │ │ │ ├── AccountNameContainsFishCriteria.cls-meta.xml │ │ │ │ └── AccountNameContainsFishCriteria.cls │ │ │ ├── supplementers │ │ │ │ ├── MarketingFieldsForAccountsSupplementer.cls-meta.xml │ │ │ │ └── MarketingFieldsForAccountsSupplementer.cls │ │ │ └── actions │ │ │ │ ├── DefaultAccountSloganBasedOnNameAction.cls-meta.xml │ │ │ │ └── DefaultAccountSloganBasedOnNameAction.cls │ │ ├── schema │ │ │ ├── objects │ │ │ │ └── Account │ │ │ │ │ ├── fields │ │ │ │ │ └── Slogan__c.field-meta.xml │ │ │ │ │ └── fieldSets │ │ │ │ │ └── SelectorInclusion_AccountFieldsMarketing.fieldSet-meta.xml │ │ │ └── customMetadata │ │ │ │ ├── ApplicationFactory_UnitOfWorkBinding.Campaign_UOW_Binding.md-meta.xml │ │ │ │ ├── ApplicationFactory_DomainBinding.CampaignSObjectBinding.md-meta.xml │ │ │ │ ├── ApplicationFactory_SelectorBinding.CampaignSObjectBinding.md-meta.xml │ │ │ │ ├── SelectorConfig_FieldSetInclusion.AccountFieldsFromMarketing.md-meta.xml │ │ │ │ ├── DomainProcessBinding.FishCompanySlogans10_20Action.md-meta.xml │ │ │ │ └── DomainProcessBinding.FishCompanySlogans10_10Criteria.md-meta.xml │ │ └── permissionsets │ │ │ └── MarketingPackageSObjectsAndFieldsVIEW.permissionset-meta.xml │ └── test │ │ ├── README.md │ │ ├── classes │ │ ├── AccountSloganRelatedTest.cls-meta.xml │ │ ├── AccountSupplementationTest.cls-meta.xml │ │ ├── AccountSupplementationTest.cls │ │ └── AccountSloganRelatedTest.cls │ │ └── customMetadata │ │ ├── SelectorConfig_FieldSetInclusion.Accounts_SelectorInclusion.md-meta.xml │ │ └── TestDataSupplementer.Account_ReferenceImplementation.md-meta.xml └── other │ └── settings │ └── Security.settings-meta.xml ├── .github ├── pull_request_template.md ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md └── workflows │ ├── manage.sf.api.versions.yml │ └── deploy.and.test.yml ├── config ├── enterprise-project-scratch-def.json └── project-scratch-def.json ├── .forceignore ├── .gitignore ├── sfdx-project.json └── README.md /sfdx-source/untracked/README.md: -------------------------------------------------------------------------------- 1 | Any temp metadata files go here. -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/README.md: -------------------------------------------------------------------------------- 1 | Files for "reference implementation sales" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/README.md: -------------------------------------------------------------------------------- 1 | Files for "reference implementation common" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/test/README.md: -------------------------------------------------------------------------------- 1 | Test files for "reference implementation sales" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/README.md: -------------------------------------------------------------------------------- 1 | Files for "reference implementation service" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/test/README.md: -------------------------------------------------------------------------------- 1 | Test files for "reference implementation common" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/README.md: -------------------------------------------------------------------------------- 1 | Files for "reference implementation marketing" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/test/README.md: -------------------------------------------------------------------------------- 1 | Test files for "reference implementation service" go here -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/README.md: -------------------------------------------------------------------------------- 1 | Test files for "reference implementation marketing" go here -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Enhancement or Bug Fix** 2 | 3 | Is this PR an enhancement or a bugfix? 4 | 5 | 6 | **List all related issues** 7 | 8 | * 9 | 10 | **Describe the changes proposed in this pull request** 11 | -------------------------------------------------------------------------------- /config/enterprise-project-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "Acme Enterprise Company", 3 | "edition": "Enterprise", 4 | "settings": { 5 | "lightningExperienceSettings": { 6 | "enableS1DesktopEnabled": true 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /config/project-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "Developer Company", 3 | "edition": "Developer", 4 | "features": [], 5 | "settings": { 6 | "lightningExperienceSettings": { 7 | "enableS1DesktopEnabled": true 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/domains/Accounts.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/triggers/Accounts.trigger-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/domains/ILeads.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/domains/Leads.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/domains/Cases.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/domains/ICases.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/test/classes/selectors/AccountsSelectorTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/domains/Campaigns.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/domains/IAccounts.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/domains/ICampaigns.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/selectors/LeadsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/eventpublishers/AccountModsEventPublisher.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/AccountsService.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/selectors/ILeadsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/selectors/CasesSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/selectors/ICasesSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/AccountsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/ContactsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/IAccountsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/IContactsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/IAccountsService.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/services/Sales_AccountsService.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/AccountsServiceImpl.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/test/classes/services/AccountsServiceTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/CampaignsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/ICampaignsSelector.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/classes/AccountSloganRelatedTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/classes/AccountSupplementationTest.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/SelectBySloganSelectorMethod.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/criteria/AccountNameContainsFishCriteria.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/supplementers/MarketingFieldsForAccountsSupplementer.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/event-consumers/Sales_PlatformEventsConsumer.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/actions/DefaultAccountSloganBasedOnNameAction.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 63.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /.forceignore: -------------------------------------------------------------------------------- 1 | # List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status 2 | # More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm 3 | # 4 | 5 | # .forceignore v2 6 | 7 | .profile-meta.xml 8 | .settings-meta.xml 9 | package.xml 10 | README.md -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/objects/Account/fields/Slogan__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Slogan__c 4 | false 5 | 6 | 255 7 | false 8 | false 9 | Text 10 | false 11 | 12 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/test/classes/selectors/AccountsSelectorTest.cls: -------------------------------------------------------------------------------- 1 | @IsTest(IsParallel=true) 2 | private class AccountsSelectorTest 3 | { 4 | @IsTest 5 | private static void shouldReturnEmptyListWhenSelectByIdDoesNotExist() 6 | { 7 | IAccountsSelector selector = AccountsSelector.newInstance(); 8 | System.assert( selector.selectById( new Set{fflib_IDGenerator.generate(Account.SObjectType)} ).isEmpty() 9 | , 'Expected null because record id value does not exist'); 10 | } 11 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # General Project related 2 | .DS_Store 3 | target/ 4 | temp/ 5 | /deploy/* 6 | /debug/ 7 | **/dep-dir.txt 8 | *.prefs 9 | build.properties 10 | 11 | # Eclipse IDE Related 12 | .project 13 | .settings/ 14 | salesforce.schema 15 | Referenced Packages/ 16 | 17 | # VS Code IDE Related 18 | .vscode/ 19 | .history/ 20 | 21 | # SFDX Related 22 | .sfdx/ 23 | .sf/ 24 | !sfdx-source/untracked/README.md 25 | sfdx-source/untracked/ 26 | .execanon 27 | 28 | # NPM Related 29 | package.json 30 | /node_modules 31 | package-lock.json 32 | 33 | # Intellij Related 34 | .idea/ 35 | IlluminatedCloud -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/objects/Account/fieldSets/SelectorInclusion_AccountFieldsMarketing.fieldSet-meta.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | SelectorInclusion_AccountFieldsMarketing 4 | Validation of selector fieldset inclusion feature. 5 | 6 | Slogan__c 7 | false 8 | false 9 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/permissionsets/MarketingPackageSObjectsAndFieldsVIEW.permissionset-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Provides that ability to view all fields within the marketing package 4 | 5 | false 6 | Account.Slogan__c 7 | true 8 | 9 | false 10 | 11 | 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/eventpublishers/AccountModsEventPublisher.cls: -------------------------------------------------------------------------------- 1 | public class AccountModsEventPublisher { 2 | public static void publishChangedAccount( Set accountIdSet ) { 3 | // Setup and save the AT4DXMessage__e 4 | AT4DXMessage__e platformEventbus = new AT4DXMessage__e(); 5 | platformEventbus.EventName__c = 'ACCOUNT_RECORD_MODIFICATION'; 6 | platformEventbus.Category__c = Account.getSObjectType().getDescribe().getName(); 7 | 8 | // Serialize the accountIdSet 9 | platformEventbus.Payload__c = JSON.serialize( accountIdSet ); 10 | 11 | Database.SaveResult sr = EventBus.publish(platformEventbus); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_ServiceBinding.IAccountsServiceBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingInterface__c 7 | IAccountsService 8 | 9 | 10 | To__c 11 | AccountsServiceImpl 12 | 13 | 14 | -------------------------------------------------------------------------------- /sfdx-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageDirectories": [ 3 | { 4 | "path": "sfdx-source/other", 5 | "default": false 6 | }, 7 | { 8 | "path": "sfdx-source/reference-implementation-common", 9 | "default": false 10 | }, 11 | { 12 | "path": "sfdx-source/reference-implementation-marketing", 13 | "default": false 14 | }, 15 | { 16 | "path": "sfdx-source/reference-implementation-sales", 17 | "default": false 18 | }, 19 | { 20 | "path": "sfdx-source/reference-implementation-service", 21 | "default": false 22 | }, 23 | { 24 | "path": "sfdx-source/untracked", 25 | "default": true 26 | } 27 | ], 28 | "namespace": "", 29 | "sfdcLoginUrl": "https://login.salesforce.com", 30 | "sourceApiVersion": "63.0" 31 | } -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/schema/customMetadata/ApplicationFactory_DomainBinding.LeadSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Lead 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | Leads.Constructor 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/schema/customMetadata/ApplicationFactory_SelectorBinding.LeadSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Lead 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | LeadsSelector 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/schema/customMetadata/ApplicationFactory_UnitOfWorkBinding.Lead_UOW_Binding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Lead 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | BindingSequence__c 15 | 60.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/schema/customMetadata/ApplicationFactory_SelectorBinding.CaseSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Case 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | CasesSelector 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/schema/customMetadata/ApplicationFactory_DomainBinding.CaseSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Case 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | Cases.Constructor 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/schema/customMetadata/ApplicationFactory_UnitOfWorkBinding.Case_UOW_Binding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Case 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | BindingSequence__c 15 | 40.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_SelectorBinding.AccountSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObjectAlternate__c 7 | 8 | 9 | 10 | BindingSObject__c 11 | Account 12 | 13 | 14 | To__c 15 | AccountsSelector 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_SelectorBinding.ContactSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Contact 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | ContactsSelector 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_UnitOfWorkBinding.Account_UOW_Binding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Account 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | BindingSequence__c 15 | 10.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_UnitOfWorkBinding.Contact_UOW_Binding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Contact 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | BindingSequence__c 15 | 20.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/schema/customMetadata/ApplicationFactory_DomainBinding.AccountSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObjectAlternate__c 7 | 8 | 9 | 10 | BindingSObject__c 11 | Account 12 | 13 | 14 | To__c 15 | Accounts.Constructor 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/ApplicationFactory_UnitOfWorkBinding.Campaign_UOW_Binding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Campaign 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | BindingSequence__c 15 | 50.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/ApplicationFactory_DomainBinding.CampaignSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Campaign 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | Campaigns.Constructor 16 | 17 | 18 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/ApplicationFactory_SelectorBinding.CampaignSObjectBinding.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Campaign 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | To__c 15 | CampaignsSelector 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/workflows/manage.sf.api.versions.yml: -------------------------------------------------------------------------------- 1 | name: Manage SF API Versions 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | api-version: 6 | description: 'api version in the format XX e.g 58' 7 | required: true 8 | type: string 9 | jobs: 10 | update: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: apex-enterprise-patterns/manage-sf-api-version@v1.0.0 15 | with: 16 | api-version: ${{inputs.api-version}} 17 | - uses: peter-evans/create-pull-request@v5 18 | with: 19 | title: 'Bump API Versions to ${{inputs.api-version}}.0' 20 | body: 'Automatically bumped by GitHub Actions ' 21 | branch: 'devops/bump-api-versions-v${{inputs.api-version}}.0' 22 | commit-message: 'chore: bump api to v${{inputs.api-version}}.0' 23 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/customMetadata/SelectorConfig_FieldSetInclusion.Accounts_SelectorInclusion.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObjectAlternate__c 7 | 8 | 9 | 10 | BindingSObject__c 11 | Account 12 | 13 | 14 | FieldsetName__c 15 | SelectorInclusion 16 | 17 | 18 | IsActive__c 19 | true 20 | 21 | 22 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/customMetadata/TestDataSupplementer.Account_ReferenceImplementation.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | BindingSObject__c 7 | Account 8 | 9 | 10 | BindingSObjectAlternate__c 11 | 12 | 13 | 14 | Sequence__c 15 | 50.0 16 | 17 | 18 | SupplementingClass__c 19 | MarketingFieldsForAccountsSupplementer 20 | 21 | 22 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/SelectorConfig_FieldSetInclusion.AccountFieldsFromMarketing.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | FieldsetName__c 7 | SelectorInclusion_AccountFieldsMarketing 8 | 9 | 10 | IsActive__c 11 | true 12 | 13 | 14 | BindingSObject__c 15 | Account 16 | 17 | 18 | BindingSObjectAlternate__c 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | (A clear and concise description of what the bug is.) 12 | 13 | **To Reproduce** 14 | 15 | (Please provide a public github repo with a full SFDX project that demonstrates the problem. If the repro case can be followed with a single example Apex class against a scratch org with just the at4dx-samplecode project deployed into it, you don't need to provide a github repo) 16 | 17 | Steps to reproduce the behavior: 18 | 1. Create a scratch org as follows.... 19 | 2. Run the following Anonymous Apex.... 20 | 3. See error 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots and text of error observed** 26 | If applicable, add screenshots to help explain your problem. Also, paste the text of the raw error into the issue as well so that it can be found by others via search. 27 | 28 | **Version** 29 | Did you try to reproduce the problem against the latest at4dx-samplecode code? 30 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/SelectBySloganSelectorMethod.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * AT4DX Selector Method Injection class used to select accounts by the Account.Slogan__c custom field 3 | * specific to reference-implementation-marketing section of code 4 | * 5 | * @Usage 6 | * SelectBySloganSelectorMethod.Parameters queryParams = new SelectBySloganSelectorMethod.Parameters(); 7 | * queryParams.sloganNameSet = new Set{ 'fishy' }; 8 | * List accounts = AccountsSelector.newInstance().selectInjection( SelectBySloganSelectorMethod.class, queryParams ); 9 | */ 10 | public inherited sharing class SelectBySloganSelectorMethod 11 | extends AbstractSelectorMethodInjectable 12 | implements ISelectorMethodInjectable 13 | { 14 | public List selectQuery() 15 | { 16 | SelectBySloganSelectorMethod.Parameters params = (SelectBySloganSelectorMethod.Parameters)getParams(); 17 | 18 | Set sloganNameSet = params.sloganNameSet; 19 | 20 | return Database.query( newQueryFactory().setCondition( Account.Slogan__c + ' in :sloganNameSet').toSOQL() ); 21 | } 22 | 23 | public class Parameters 24 | implements ISelectorMethodParameterable 25 | { 26 | public Set sloganNameSet; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/schema/customMetadata/PlatformEvents_Subscription.Sales_PlatformEventsConsumer.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | Consumer__c 7 | Sales_PlatformEventsConsumer 8 | 9 | 10 | EventBus__c 11 | AT4DXMessage__e 12 | 13 | 14 | EventCategory__c 15 | Account 16 | 17 | 18 | Event__c 19 | ACCOUNT_RECORD_MODIFICATION 20 | 21 | 22 | Execute_Synchronous__c 23 | false 24 | 25 | 26 | IsActive__c 27 | true 28 | 29 | 30 | MatcherRule__c 31 | MatchEventBusAndCategoryAndEventName 32 | 33 | 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AT4DX Sample Code 2 | 3 | The files in this project are various example implementations of the *Advanced Techniques for Salesforce DX* (aka AT4DX) framework. 4 | 5 | **Dependencies:** Must deploy [AT4DX](https://github.com/apex-enterprise-patterns/at4dx) before deploying this code. 6 | * For more information on how to setup the AT4DX Framework, please refer to the [Environment Setup WIKI page](https://github.com/apex-enterprise-patterns/at4dx/wiki/Environment-Setup). 7 | * To install the AT4DX Framework, excute the following command after the environment is setup. 8 | * sfdx shane:github:src:install -c -g apex-enterprise-patterns -r at4dx -p sfdx-source/core -u at4dxsamplecode 9 | 10 | For more information on the AT4DX framework and related concepts, please refer to the [AT4DX](https://github.com/apex-enterprise-patterns/at4dx) project. 11 | 12 | Project Folders 13 | --------------- 14 | The "core" framework is found in [AT4DX](https://github.com/apex-enterprise-patterns/at4dx) project. This includes the following: 15 | 16 | | Folder | Description | 17 | | ------ | ----------- | 18 | | **core** | Core library, contains | 19 | 20 | The "samples" of how to use the framework can be found in this project. 21 | 22 | | Folder | Description | 23 | | ------ | ----------- | 24 | | **reference-implementation-common** | Sample application using the API and Components to inject Apex, VF and Lightning at runtime | 25 | | **reference-implementation-sales** | Sample package providing impls for various bindings above | 26 | | **reference-implementation-marketing** | Sample package providing impls for various bindings above | 27 | | **reference-implementation-service** | Sample basic trigger framework leveraging the API | 28 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/domains/ILeads.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ILeads 28 | extends IApplicationSObjectDomain 29 | { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/domains/ICases.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ICases 28 | extends IApplicationSObjectDomain 29 | { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/domains/IAccounts.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface IAccounts 28 | extends IApplicationSObjectDomain 29 | { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/domains/ICampaigns.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ICampaigns 28 | extends IApplicationSObjectDomain 29 | { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/IAccountsService.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface IAccountsService 28 | { 29 | void createWithName( String name ); 30 | } 31 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/selectors/ILeadsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ILeadsSelector 28 | extends IApplicationSObjectSelector 29 | { 30 | List selectById( Set idSet ); 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/selectors/ICasesSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ICasesSelector 28 | extends IApplicationSObjectSelector 29 | { 30 | List selectById( Set idSet ); 31 | } 32 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/ICampaignsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface ICampaignsSelector 28 | extends IApplicationSObjectSelector 29 | { 30 | List selectById( Set idSet ); 31 | } -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/triggers/Accounts.trigger: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | trigger Accounts on Account 28 | (after delete, after insert, after update, before delete, before insert, before update) 29 | { 30 | fflib_SObjectDomain.triggerHandler(Accounts.class); 31 | } -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/IAccountsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface IAccountsSelector 28 | extends IApplicationSObjectSelector 29 | { 30 | List selectById( Set idSet ); 31 | List selectByName( Set nameSet ); 32 | } 33 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/IContactsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public interface IContactsSelector 28 | extends IApplicationSObjectSelector 29 | { 30 | List selectById( Set idSet ); 31 | List selectByName( Set nameSet ); 32 | } 33 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/classes/AccountSupplementationTest.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | @IsTest 28 | class AccountSupplementationTest 29 | { 30 | @IsTest 31 | static void test() 32 | { 33 | Account acct = new Account(); 34 | TestDataSupplementer.supplement(new List {acct}); 35 | 36 | System.assertEquals('Hello world!', acct.Slogan__c); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/services/Sales_AccountsService.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public class Sales_AccountsService 28 | { 29 | // private static IAccountsService service() 30 | // { 31 | // return (IAccountsService) Application.Service.newInstance( IAccountsService.class ); 32 | // } 33 | 34 | public static void proocessAccountChanges( Set accountIdSet ) 35 | { 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/supplementers/MarketingFieldsForAccountsSupplementer.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | @IsTest 28 | public class MarketingFieldsForAccountsSupplementer 29 | implements ITestDataSupplement 30 | { 31 | public void supplement(List accountSObjectList) 32 | { 33 | for (Account acct : (List) accountSObjectList) 34 | { 35 | acct.Slogan__c = 'Hello world!'; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.github/workflows/deploy.and.test.yml: -------------------------------------------------------------------------------- 1 | name: Create a Scratch Org, Push Source and Run Apex Tests 2 | 3 | on: 4 | push: 5 | pull_request_target: 6 | workflow_dispatch: 7 | 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | ref: ${{github.event.pull_request.head.ref}} 18 | repository: ${{github.event.pull_request.head.repo.full_name}} 19 | - name: Install SF CLI and authorize DevHub 20 | uses: apex-enterprise-patterns/setup-sfdx@v2 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety 21 | with: 22 | sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }} 23 | - name: Install the required plugins 24 | run: echo y | sf plugins install shane-sfdx-plugins 25 | - name: Setup the config parameters needed 26 | run: sf config set target-dev-hub SFDX-ENV --global #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here 27 | - name: Create the scratch org 28 | run: sf org create scratch --definition-file config/project-scratch-def.json --set-default --duration-days 1 --no-track-source 29 | - name: Install required dependency frameworks 30 | run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks 31 | - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common --path sfdx-source/apex-common 32 | - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo force-di --path force-di 33 | - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo at4dx --path sfdx-source/core 34 | - name: Deploy and compile the codebase 35 | run: sf project deploy start 36 | - name: Run the core framework tests 37 | run: sf apex run test --wait 5 38 | - name: Destroy scratch org 39 | run: sf org delete scratch --no-prompt 40 | if: always() 41 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/AccountsService.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public class AccountsService 28 | { 29 | private static IAccountsService service() 30 | { 31 | return (IAccountsService) Application.Service.newInstance( IAccountsService.class ); 32 | } 33 | 34 | public static void createWithName( String name ) 35 | { 36 | System.debug('Calling IAccountsService.createWithName(String) method'); 37 | service().createWithName( name ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/actions/DefaultAccountSloganBasedOnNameAction.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public class DefaultAccountSloganBasedOnNameAction 28 | extends DomainProcessAbstractAction 29 | { 30 | public override void runInProcess() 31 | { 32 | Account accountRecord = null; 33 | 34 | for ( SObject record : this.records ) 35 | { 36 | accountRecord = (Account)record; 37 | accountRecord.Slogan__c = accountRecord.name + ' is a fishy business'; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/event-consumers/Sales_PlatformEventsConsumer.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public class Sales_PlatformEventsConsumer extends PlatformEventAbstractConsumer { 28 | public override void runInProcess() { 29 | Set accountIdSet = new Set(); 30 | 31 | for (SObject sobj : events) { 32 | AT4DXMessage__e evt = (AT4DXMessage__e) sobj; 33 | accountIdSet.addAll((Set) JSON.deserialize(evt.Payload__c, Set.class)); 34 | } 35 | 36 | Sales_AccountsService.proocessAccountChanges(accountIdSet); 37 | } 38 | } -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/DomainProcessBinding.FishCompanySlogans10_20Action.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | ClassToInject__c 7 | DefaultAccountSloganBasedOnNameAction 8 | 9 | 10 | Description__c 11 | Default the slogan for the qualified records 12 | 13 | 14 | DomainMethodToken__c 15 | 16 | 17 | 18 | ExecuteAsynchronous__c 19 | false 20 | 21 | 22 | IsActive__c 23 | true 24 | 25 | 26 | LogicalInverse__c 27 | false 28 | 29 | 30 | OrderOfExecution__c 31 | 10.2 32 | 33 | 34 | PreventRecursive__c 35 | false 36 | 37 | 38 | ProcessContext__c 39 | TriggerExecution 40 | 41 | 42 | RelatedDomainBindingSObjectAlternate__c 43 | 44 | 45 | 46 | RelatedDomainBindingSObject__c 47 | Account 48 | 49 | 50 | TriggerOperation__c 51 | Before_Insert 52 | 53 | 54 | Type__c 55 | Action 56 | 57 | 58 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/schema/customMetadata/DomainProcessBinding.FishCompanySlogans10_10Criteria.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | ClassToInject__c 7 | AccountNameContainsFishCriteria 8 | 9 | 10 | Description__c 11 | Test if the fish account name contains the word "fish" 12 | 13 | 14 | DomainMethodToken__c 15 | 16 | 17 | 18 | ExecuteAsynchronous__c 19 | false 20 | 21 | 22 | IsActive__c 23 | true 24 | 25 | 26 | LogicalInverse__c 27 | false 28 | 29 | 30 | OrderOfExecution__c 31 | 10.1 32 | 33 | 34 | PreventRecursive__c 35 | false 36 | 37 | 38 | ProcessContext__c 39 | TriggerExecution 40 | 41 | 42 | RelatedDomainBindingSObject__c 43 | Account 44 | 45 | 46 | RelatedDomainBindingSObjectAlternate__c 47 | 48 | 49 | TriggerOperation__c 50 | Before_Insert 51 | 52 | 53 | Type__c 54 | Criteria 55 | 56 | 57 | -------------------------------------------------------------------------------- /sfdx-source/other/settings/Security.settings-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AlphaNumeric 6 | NinetyDays 7 | 3 8 | FifteenMinutes 9 | TenAttempts 10 | 8 11 | false 12 | false 13 | DoesNotContainPassword 14 | 15 | 16 | false 17 | true 18 | true 19 | true 20 | true 21 | true 22 | false 23 | false 24 | true 25 | true 26 | false 27 | true 28 | true 29 | false 30 | true 31 | true 32 | false 33 | true 34 | true 35 | false 36 | true 37 | false 38 | true 39 | true 40 | TwentyFourHours 41 | 42 | 43 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/domains/Leads.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class Leads 28 | extends ApplicationSObjectDomain 29 | implements ILeads 30 | { 31 | public static ILeads newInstance(List records) 32 | { 33 | return (ILeads) Application.Domain.newInstance(records); 34 | } 35 | 36 | public static ILeads newInstance(Set recordIds) 37 | { 38 | return (ILeads) Application.Domain.newInstance(recordIds); 39 | } 40 | 41 | public Leads(List records) 42 | { 43 | super(records); 44 | 45 | // don't enforce CRUD security for Lead records 46 | this.Configuration.disableTriggerCRUDSecurity(); 47 | } 48 | 49 | public class Constructor 50 | implements fflib_SObjectDomain.IConstructable 51 | { 52 | public fflib_SObjectDomain construct(List sObjectList) 53 | { 54 | return new Leads(sObjectList); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/domains/Cases.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class Cases 28 | extends ApplicationSObjectDomain 29 | implements ICases 30 | { 31 | public static ICases newInstance(List records) 32 | { 33 | return (ICases) Application.Domain.newInstance(records); 34 | } 35 | 36 | public static ICases newInstance(Set recordIds) 37 | { 38 | return (ICases) Application.Domain.newInstance(recordIds); 39 | } 40 | 41 | public Cases(List records) 42 | { 43 | super(records); 44 | 45 | // don't enforce CRUD security for Case records 46 | this.Configuration.disableTriggerCRUDSecurity(); 47 | } 48 | 49 | public class Constructor 50 | implements fflib_SObjectDomain.IConstructable 51 | { 52 | public fflib_SObjectDomain construct(List sObjectList) 53 | { 54 | return new Cases(sObjectList); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/domains/Accounts.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class Accounts 28 | extends ApplicationSObjectDomain 29 | implements IAccounts 30 | { 31 | public static IAccounts newInstance(List records) 32 | { 33 | return (IAccounts) Application.Domain.newInstance(records); 34 | } 35 | 36 | public static IAccounts newInstance(Set recordIds) 37 | { 38 | return (IAccounts) Application.Domain.newInstance(recordIds); 39 | } 40 | 41 | public Accounts(List records) 42 | { 43 | super(records); 44 | 45 | // don't enforce CRUD security for Account records 46 | this.Configuration.disableTriggerCRUDSecurity(); 47 | } 48 | 49 | public class Constructor 50 | implements fflib_SObjectDomain.IConstructable 51 | { 52 | public fflib_SObjectDomain construct(List sObjectList) 53 | { 54 | return new Accounts(sObjectList); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-sales/main/classes/selectors/LeadsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class LeadsSelector 28 | extends ApplicationSObjectSelector 29 | implements ILeadsSelector 30 | { 31 | public static ILeadsSelector newInstance() 32 | { 33 | return (ILeadsSelector) Application.Selector.newInstance( Lead.SObjectType ); 34 | } 35 | 36 | public Schema.sObjectType getSObjectType() 37 | { 38 | return Lead.SObjectType; 39 | } 40 | 41 | public override List getSObjectFieldList() 42 | { 43 | return new List { 44 | Lead.Id, 45 | Lead.Name 46 | }; 47 | } 48 | 49 | private List getAdditionalSObjectFieldList() 50 | { 51 | return new List { }; 52 | } 53 | 54 | public List selectById(Set idSet) 55 | { 56 | return (List) selectSObjectsById( idSet == null ? new Set() : idSet ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/domains/Campaigns.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class Campaigns 28 | extends ApplicationSObjectDomain 29 | implements ICampaigns 30 | { 31 | public static ICampaigns newInstance(List records) 32 | { 33 | return (ICampaigns) Application.Domain.newInstance(records); 34 | } 35 | 36 | public static ICampaigns newInstance(Set recordIds) 37 | { 38 | return (ICampaigns) Application.Domain.newInstance(recordIds); 39 | } 40 | 41 | public Campaigns(List records) 42 | { 43 | super(records); 44 | 45 | // don't enforce CRUD security for Campaign records 46 | this.Configuration.disableTriggerCRUDSecurity(); 47 | } 48 | 49 | public class Constructor 50 | implements fflib_SObjectDomain.IConstructable 51 | { 52 | public fflib_SObjectDomain construct(List sObjectList) 53 | { 54 | return new Campaigns(sObjectList); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-service/main/classes/selectors/CasesSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class CasesSelector 28 | extends ApplicationSObjectSelector 29 | implements ICasesSelector 30 | { 31 | public static ICasesSelector newInstance() 32 | { 33 | return (ICasesSelector) Application.Selector.newInstance( Case.SObjectType ); 34 | } 35 | 36 | public Schema.sObjectType getSObjectType() 37 | { 38 | return Case.SObjectType; 39 | } 40 | 41 | public override List getSObjectFieldList() 42 | { 43 | return new List { 44 | Case.Id, 45 | Case.CaseNumber 46 | }; 47 | } 48 | 49 | private List getAdditionalSObjectFieldList() 50 | { 51 | return new List { }; 52 | } 53 | 54 | public List selectById(Set idSet) 55 | { 56 | return (List) selectSObjectsById( idSet == null ? new Set() : idSet ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/criteria/AccountNameContainsFishCriteria.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public class AccountNameContainsFishCriteria 28 | implements IDomainProcessCriteria 29 | { 30 | private list records = new list(); 31 | 32 | public IDomainProcessCriteria setRecordsToEvaluate(List records) 33 | { 34 | this.records.clear(); 35 | this.records.addAll( (list)records ); 36 | 37 | return this; 38 | } 39 | 40 | public List run() 41 | { 42 | list qualifiedRecords = new list(); 43 | 44 | // Loop through the Account records. 45 | for ( Account record : this.records ) 46 | { 47 | // We are only interested in Account records that have the word fish in their name 48 | if ( record.Name.containsIgnoreCase('fish') ) 49 | { 50 | qualifiedRecords.add( record ); 51 | } 52 | } 53 | 54 | return qualifiedRecords; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/main/classes/selectors/CampaignsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class CampaignsSelector 28 | extends ApplicationSObjectSelector 29 | implements ICampaignsSelector 30 | { 31 | public static ICampaignsSelector newInstance() 32 | { 33 | return (ICampaignsSelector) Application.Selector.newInstance( Campaign.SObjectType ); 34 | } 35 | 36 | public Schema.sObjectType getSObjectType() 37 | { 38 | return Campaign.SObjectType; 39 | } 40 | 41 | public override List getSObjectFieldList() 42 | { 43 | return new List { 44 | Campaign.Id, 45 | Campaign.Name 46 | }; 47 | } 48 | 49 | private List getAdditionalSObjectFieldList() 50 | { 51 | return new List { }; 52 | } 53 | 54 | public List selectById(Set idSet) 55 | { 56 | return (List) selectSObjectsById( idSet == null ? new Set() : idSet ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/ContactsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class ContactsSelector 28 | extends ApplicationSObjectSelector 29 | implements IContactsSelector 30 | { 31 | public static IContactsSelector newInstance() 32 | { 33 | return (IContactsSelector) Application.Selector.newInstance( Contact.SObjectType ); 34 | } 35 | 36 | public Schema.sObjectType getSObjectType() 37 | { 38 | return Contact.SObjectType; 39 | } 40 | 41 | public override List getSObjectFieldList() 42 | { 43 | return new List { 44 | Contact.Id, 45 | Contact.Name 46 | }; 47 | } 48 | 49 | private List getAdditionalSObjectFieldList() 50 | { 51 | return new List { 52 | 53 | }; 54 | } 55 | 56 | public List selectById(Set idSet) 57 | { 58 | return (List) selectSObjectsById( idSet == null ? new Set() : idSet ); 59 | } 60 | 61 | public List selectByName( Set nameSet ) 62 | { 63 | return Database.query( newQueryFactory().setCondition( Contact.Name + ' in :nameSet').toSOQL() ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/selectors/AccountsSelector.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class AccountsSelector 28 | extends ApplicationSObjectSelector 29 | implements IAccountsSelector 30 | { 31 | public static IAccountsSelector newInstance() 32 | { 33 | return (IAccountsSelector) Application.Selector.newInstance( Account.SObjectType ); 34 | } 35 | 36 | public Schema.sObjectType getSObjectType() 37 | { 38 | return Account.SObjectType; 39 | } 40 | 41 | public override List getSObjectFieldList() 42 | { 43 | return new List { 44 | Account.Id, 45 | Account.Name 46 | }; 47 | } 48 | 49 | private List getAdditionalSObjectFieldList() 50 | { 51 | return new List { }; 52 | } 53 | 54 | public List selectById(Set idSet) 55 | { 56 | return (List) selectSObjectsById( idSet == null ? new Set() : idSet ); 57 | } 58 | 59 | public List selectByName( Set nameSet ) 60 | { 61 | fflib_QueryFactory qf = newQueryFactory(); 62 | 63 | for (FieldSet fs : sObjectFieldSetList) 64 | { 65 | qf.selectFieldSet(fs); 66 | } 67 | 68 | qf.setCondition( Account.Name + ' in :nameSet'); 69 | return Database.query(qf.toSOQL()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/main/classes/services/AccountsServiceImpl.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | public with sharing class AccountsServiceImpl 28 | implements IAccountsService 29 | { 30 | public AccountsServiceImpl() { 31 | 32 | } 33 | 34 | public void createWithName( String nameOfAccount ) 35 | { 36 | System.debug('AccountsServiceImpl.createWithName(String) method was called'); 37 | 38 | List accountsFound = AccountsSelector.newInstance().selectByName( new Set{ nameOfAccount } ); 39 | 40 | if ( accountsFound.isEmpty() ) 41 | { 42 | System.debug('No Accounts found with name of \'' + nameOfAccount + '\'. Creating one now.'); 43 | IApplicationSObjectUnitOfWork uow = Application.UnitOfWork.newInstance(); 44 | uow.registerNew( new Account(name = nameOfAccount) ); 45 | uow.registerNew( new Account(name = nameOfAccount) ); 46 | uow.registerNew( new Account(name = nameOfAccount) ); 47 | List fourRecords = new List(); 48 | fourRecords.add( new Account(name = nameOfAccount) ); 49 | fourRecords.add( new Account(name = nameOfAccount) ); 50 | fourRecords.add( new Account(name = nameOfAccount) ); 51 | fourRecords.add( new Account(name = nameOfAccount) ); 52 | uow.registerNew( fourRecords ); 53 | uow.commitWork(); 54 | } 55 | else 56 | { 57 | System.debug('Found Account ID ' + accountsFound[0].Id ); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-marketing/test/classes/AccountSloganRelatedTest.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | @isTest 28 | private class AccountSloganRelatedTest 29 | { 30 | @isTest 31 | static void givenNewAccountWhenCreatedWithFishNameThenSloganIsDefaulted() 32 | { 33 | // given 34 | 35 | // when 36 | Test.startTest(); 37 | Account bluefishAccount = new Account(); 38 | 39 | bluefishAccount.name = 'bluefish'; 40 | 41 | insert bluefishAccount; 42 | 43 | Test.stopTest(); 44 | 45 | // then 46 | 47 | list accountRecordsQueried = AccountsSelector.newInstance().selectById( new Set{ bluefishAccount.Id } ); 48 | 49 | System.assert( ! accountRecordsQueried.isEmpty() ); 50 | System.assert( accountRecordsQueried.size() == 1 ); 51 | 52 | Account accountRecordQueried = accountRecordsQueried[0]; 53 | 54 | System.assert( String.isNotBlank( accountRecordQueried.Slogan__c ) ); 55 | 56 | } 57 | 58 | @isTest 59 | static void givenNewAccountWhenCreatedWithFishNameThenSelectorMethodInjection() 60 | { 61 | // given 62 | fflib_ApexMocks mocks = new fflib_ApexMocks(); 63 | 64 | String slogan = 'The Big Blue Fish is a fishy business'; 65 | 66 | // Setup the test record to be returned by the mock selector 67 | Account bluefishAccount = new Account(); 68 | bluefishAccount.Id = fflib_IDGenerator.generate( Account.SObjectType ); 69 | bluefishAccount.name = 'bluefish'; 70 | bluefishAccount.slogan__c = slogan; 71 | 72 | List testRecords = new List(); 73 | testRecords.add(bluefishAccount); 74 | 75 | // Setup the mocks needed for the test 76 | IAccountsSelector mockAccountsSelector = (IAccountsSelector) mocks.mock( IAccountsSelector.class ); 77 | 78 | // Setup the injection parameter class 79 | SelectBySloganSelectorMethod.Parameters queryParams = new SelectBySloganSelectorMethod.Parameters(); 80 | queryParams.sloganNameSet = new Set{ slogan }; 81 | 82 | // Stub the mocks 83 | mocks.startStubbing(); 84 | 85 | fflib_MethodReturnValue mockAccountsSelectorMethodReturnValue = mocks.when(mockAccountsSelector.selectInjection(SelectBySloganSelectorMethod.class, queryParams)); 86 | mockAccountsSelectorMethodReturnValue.thenReturn(testRecords); 87 | mocks.when(mockAccountsSelector.sObjectType()).thenReturn(Account.SObjectType); 88 | 89 | mocks.stopStubbing(); 90 | 91 | Application.Selector.setMock(mockAccountsSelector); 92 | 93 | // when 94 | Test.startTest(); 95 | 96 | List accountsQueried = AccountsSelector.newInstance().selectInjection( SelectBySloganSelectorMethod.class, queryParams); 97 | 98 | Test.stopTest(); 99 | 100 | // then 101 | System.debug('accountsQueried size: ' + accountsQueried.size()); 102 | ((IAccountsSelector)mocks.verify(mockAccountsSelector)).selectInjection( SelectBySloganSelectorMethod.class, queryParams); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /sfdx-source/reference-implementation-common/test/classes/services/AccountsServiceTest.cls: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020, John M. Daniel, John Storey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the John M. Daniel, nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 20 | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | **/ 26 | 27 | @isTest 28 | private class AccountsServiceTest 29 | { 30 | @isTest 31 | private static void givenNewAccountsServiceImplWhenCreateWithNameThenNewImplExecutes() 32 | { 33 | fflib_ApexMocks mocks = new fflib_ApexMocks(); 34 | IAccountsSelector mockAccountsSelector = (IAccountsSelector) mocks.mock( IAccountsSelector.class ); 35 | IContactsSelector mockContactsSelector = (IContactsSelector) mocks.mock( IContactsSelector.class ); 36 | 37 | // given 38 | mocks.startStubbing(); 39 | 40 | String testAccountName = 'red'; 41 | 42 | Account testAcct = new Account(); 43 | testAcct.Id = fflib_IDGenerator.generate( Account.SObjectType ); 44 | testAcct.Name = testAccountName; 45 | 46 | Contact testContact = new Contact(); 47 | testContact.id = fflib_IDGenerator.generate( Contact.SObjectType ); 48 | testContact.FirstName = testAccountName; 49 | testContact.LastName = 'fish'; 50 | testContact.AccountId = testAcct.Id; 51 | 52 | //mocks.when( mockAccountsService.createWithName(testAccountName) ); 53 | 54 | mocks.when( mockAccountsSelector.sObjectType() ).thenReturn( Account.SObjectType ); 55 | mocks.when( mockAccountsSelector.selectByName( new Set{ testAccountName } ) ).thenReturn(new List{ testAcct }); 56 | 57 | mocks.when( mockContactsSelector.sObjectType() ).thenReturn( Contact.SObjectType ); 58 | mocks.when( mockContactsSelector.selectById( new Set{ testContact.Id } ) ).thenReturn(new List{ testContact }); 59 | 60 | mocks.stopStubbing(); 61 | 62 | //Application.Service.setMock(mmcommon_IPersonAccountsService.class, mockPersonAccountsService); 63 | system.debug('AccountsServiceTest flag 1'); 64 | Application.Selector.setMock(mockAccountsSelector); 65 | system.debug('AccountsServiceTest flag 2'); 66 | 67 | // When 68 | 69 | Test.startTest(); 70 | 71 | AccountsService.createWithName(testAccountName); 72 | 73 | // Call the ContactsSelector PRIOR TO SETTING THE MOCK. Expected result is that the mock testContact record will not be found in the database. 74 | System.assert( ContactsSelector.newInstance().selectById( new Set{ testContact.Id } ).isEmpty() ); 75 | 76 | Application.Selector.setMock(mockContactsSelector); 77 | 78 | // Call the ContactsSelector AFTER TO SETTING THE MOCK. Expected results is that the mock testContact record will be returned by the selector. 79 | System.assert( ! ContactsSelector.newInstance().selectById( new Set{ testContact.Id } ).isEmpty() ); 80 | 81 | Test.stopTest(); 82 | 83 | // Then 84 | ((IAccountsSelector) mocks.verify( mockAccountsSelector )).selectByName( new Set{ testAccountName } ); // should have been called by the AccountsService.createWithName(testAccountName); method call 85 | ((IContactsSelector) mocks.verify( mockContactsSelector )).selectById( new Set{ testContact.Id } ); 86 | } 87 | 88 | @isTest 89 | private static void givenNewAccountsServiceImplWhenCreateWithNameAndNoAccountFoundThenNewAccountCreated() 90 | { 91 | fflib_ApexMocks mocks = new fflib_ApexMocks(); 92 | IAccountsSelector mockAccountsSelector = (IAccountsSelector) mocks.mock( IAccountsSelector.class ); 93 | IApplicationSObjectUnitOfWork mockUOW = (IApplicationSObjectUnitOfWork) mocks.mock( IApplicationSObjectUnitOfWork.class ); 94 | 95 | // given 96 | mocks.startStubbing(); 97 | 98 | String testAccountName = 'red'; 99 | 100 | Account testAcct = new Account(); 101 | testAcct.Id = fflib_IDGenerator.generate( Account.SObjectType ); 102 | testAcct.Name = testAccountName; 103 | 104 | mocks.when( mockAccountsSelector.sObjectType() ).thenReturn( Account.SObjectType ); 105 | // Have the AccountsSelector return the empty list so that the UOW can be explored 106 | mocks.when( mockAccountsSelector.selectByName( new Set{ testAccountName } ) ).thenReturn(new List()); 107 | 108 | // mocks.when( mockUOW.commitWork() ).then( ); 109 | 110 | mocks.stopStubbing(); 111 | 112 | Application.Selector.setMock(mockAccountsSelector); 113 | Application.UnitOfWork.setMock(mockUOW); 114 | 115 | // When 116 | Test.startTest(); 117 | 118 | AccountsService.createWithName(testAccountName); 119 | 120 | Test.stopTest(); 121 | 122 | // Then 123 | ((IApplicationSObjectUnitOfWork)mocks.verify(mockUOW, 1)).commitWork(); 124 | 125 | ((IApplicationSObjectUnitOfWork)mocks.verify(mockUOW, 3)).registerNew( new Account(name = testAccountName) ); 126 | 127 | List fourRecords = new List(); 128 | fourRecords.add( new Account(name = testAccountName) ); 129 | fourRecords.add( new Account(name = testAccountName) ); 130 | fourRecords.add( new Account(name = testAccountName) ); 131 | fourRecords.add( new Account(name = testAccountName) ); 132 | 133 | ((IApplicationSObjectUnitOfWork)mocks.verify(mockUOW, 1)).registerNew( fourRecords ); 134 | } 135 | } --------------------------------------------------------------------------------