Skip to content

Commit

Permalink
apex-enterprise-patterns#199: created fflib_SObjectSelector2 class to…
Browse files Browse the repository at this point in the history
… respect caller sharing settings
  • Loading branch information
yurybond committed Oct 19, 2018
1 parent a983d55 commit 4f9831e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
73 changes: 73 additions & 0 deletions fflib/src/classes/fflib_SObjectSelector2.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* Copyright (c), FinancialForce.com, inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the FinancialForce.com, inc nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/

/**
* Class providing common database query support for abstracting and encapsulating query logic
**/
public abstract class fflib_SObjectSelector2 extends fflib_SObjectSelectorBase
implements fflib_ISObjectSelector
{
/**
* Constructs the Selector, defaults to not including any FieldSet fields automatically
**/
public fflib_SObjectSelector2()
{
super(false,false,false);
}

/**
* Constructs the Selector
*
* @param includeFieldSetFields Set to true if the Selector queries are to include Fieldset fields as well
**/
public fflib_SObjectSelector2(Boolean includeFieldSetFields)
{
super(includeFieldSetFields, true, false);
}

/**
* Constructs the Selector
*
* @param includeFieldSetFields Set to true if the Selector queries are to include Fieldset fields as well
**/
public fflib_SObjectSelector2(Boolean includeFieldSetFields, Boolean enforceCRUD, Boolean enforceFLS)
{
super(includeFieldSetFields, enforceCRUD, enforceFLS, true);
}

/**
* Constructs the Selector
*
* @param includeFieldSetFields Set to true if the Selector queries are to include Fieldset fields as well
* @param enforceCRUD Enforce CRUD security
* @param enforeFLS Enforce Field Level Security
* @param sortSelectFields Set to false if selecting many columns to skip sorting select fields and improve performance
**/
public fflib_SObjectSelector2(Boolean includeFieldSetFields, Boolean enforceCRUD, Boolean enforceFLS, Boolean sortSelectFields)
{
super(includeFieldSetFields, enforceCRUD, enforceFLS, sortSelectFields);
}
}
5 changes: 5 additions & 0 deletions fflib/src/classes/fflib_SObjectSelector2.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="urn:metadata.tooling.soap.sforce.com" fqn="fflib_SObjectSelector2">
<apiVersion>43.0</apiVersion>
<status>Active</status>
</ApexClass>
1 change: 1 addition & 0 deletions fflib/src/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<members>fflib_SObjectDomainTest</members>
<members>fflib_SObjectMocks</members>
<members>fflib_SObjectSelector</members>
<members>fflib_SObjectSelector2</members>
<members>fflib_SObjectSelectorBase</members>
<members>fflib_SObjectSelectorTest</members>
<members>fflib_SObjectUnitOfWork</members>
Expand Down

0 comments on commit 4f9831e

Please sign in to comment.