Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored again - core logic lives in abstract class SObjectRepository
Implement a refactor of my recent refactor. Perhaps create IRefactorFactory for future refactor scalability * Started to refactor my refactor from earlier this week - This is starting to grow bigger than I anticipated, but it's fun, so I'll proceed for now - This refactor is all new classes - the old refactor has been left untouched for now * Changed orderBy() to build store the individual 'order by' field strings, instead of trying to track the field & sort * Simplified how conditions are added - Ran into problems with scope & variable binding, so I'm now taking the approach of delegating the query execution to the concrete SObject repository classes so they can execute the queries with the variables in context. - Tried to show how to leverage the Schema namespace to reference fields so that custom fields can't be deleted when reference by a repo class * Added control for sorting nulls * Fixed a bug with the getLeadById method If only there was a way to write automated tests that could check these things for me... *sign* perhaps one day :-P * Added SObjectRepository.addCommonQueryFields() This adds some of the common SF fields to the set, if they exist for the specified SObject Type * Fixed a comment, added a line break for readability * Forgot to add StringUtils.cls * Minified the enums - no need for them to take up so many lines * Renamed parse to addFieldSetMembers This makes it consistent with addCommonQueryFields() * Added a boolean to disable adding the common fields Only fields in the field set will be included in the query * Relocated and renamed buildQuery() to getQuery() * Updated calls from buildQuery() to getQuery() * Added an example of disabling the common query fields in LeadRepository.cls * Changed which sample static method calls setAsUpdate() * Forgot to commit the latest version of ISObjectRepository.cls * Added a second field set to Lead.object * Forgot to commit CollectionUtils.cls * Made things 47.3% less silly - scrapped using static methods Now, any packaged query methods should be added as public methods. These should call any private/protected builder methods and return the results of the query, casted to the appropriate data type * Changed some method names in LeadRepository.cls Playing around with what naming convention would work best * Added TaskRepository.cls as another example class * Added 'IsClosed' to the list of common fields (available on task, opportunity & case) * Added a comment to LeadRepository.cls to describe usage If you don't want external code to have this control, only have make the LeadRepository() constructor public and internally set the field set to use * Fixed SObjectRepository so FOR UPDATE is only used when there is no ORDER BY I was unintenionally checking limitCount instead of the orderByList * Fixed the getList method so it actually... ya know, returns a list * Deleted the previous implementation of the project because I hate it now * Added CollectionUtils_Test.cls * Updated CollectionUtils_Test.cls to API v38.0 * Added new test classes, finished some existing test classes * Added another test method in LeadRepository_Tests.cls
- Loading branch information