-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathExampleRepoFactory.cls
More file actions
22 lines (20 loc) · 860 Bytes
/
ExampleRepoFactory.cls
File metadata and controls
22 lines (20 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public without sharing class ExampleRepoFactory extends RepoFactory {
// your app can expand on the repositories provided by the base instance here, like so
public IAggregateRepository getOppRepo() {
List<Schema.SObjectField> queryFields = new List<Schema.SObjectField>{
Opportunity.IsWon,
Opportunity.StageName
// etc ...
};
IAggregateRepository oppRepo = this.facade.getRepo(Opportunity.SObjectType, queryFields, this);
oppRepo.addParentFields(
new List<Schema.SObjectField>{ Opportunity.AccountId },
new List<Schema.SObjectField>{ Account.Id }
);
return oppRepo;
}
public IHistoryRepository getOppFieldHistoryRepo() {
return this.facade.getRepo(OpportunityFieldHistory.SObjectType, new List<Schema.SObjectField>(), this)
.setParentField(OpportunityFieldHistory.OpportunityId);
}
}