Book Image Enterprise Architecture

By : Andrew Fawcett
Book Image Enterprise Architecture

By: Andrew Fawcett

Overview of this book

Table of Contents (20 chapters) Enterprise Architecture
About the Author
About the Reviewers

Implementing the custom query logic

If we take a look at the implementation of the fflib_SObjectSelector.selectSObjectById base class method (at the time of writing this book), it is quite simple and gives a template as to the way we can implement custom Selector methods; it also highlights other base class methods we can use:

public List<SObject> selectSObjectsById(Set<Id> idSet)
  return Database.query(buildQuerySObjectById());
private String buildQuerySObjectById()
  return String.format(
    'SELECT {0} FROM {1} WHERE id in :idSet ORDER BY {2}', 
     new List<String> 

The getFieldListString method calls the getSObjectFieldList and getSObjectFieldSetList methods implemented in the preceding code. It basically takes the SObjectField lists that result from these methods and builds a single comma-delimited list of fields ready to be inserted into the SOQL query string. Also, note...