Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Force.com Enterprise Architecture

You're reading from   Force.com Enterprise Architecture Blend industry best practices to architect and deliver packaged Force.com applications that cater to enterprise business needs

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher
ISBN-13 9781782172994
Length 402 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Andrew Fawcett Andrew Fawcett
Author Profile Icon Andrew Fawcett
Andrew Fawcett
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Building, Publishing, and Supporting Your Application 2. Leveraging Platform Features FREE CHAPTER 3. Application Storage 4. Apex Execution and Separation of Concerns 5. Application Service Layer 6. Application Domain Layer 7. Application Selector Layer 8. User Interface 9. Providing Integration and Extensibility 10. Asynchronous Processing and Big Data Volumes 11. Source Control and Continuous Integration Index

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)
{
  assertIsAccessible();
  return Database.query(buildQuerySObjectById());
}
private String buildQuerySObjectById()
{ 
  return String.format(
    'SELECT {0} FROM {1} WHERE id in :idSet ORDER BY {2}', 
     new List<String> 
       {getFieldListString(),getSObjectName(),getOrderBy()}); 
}

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image