Update IntelliJ Templates
Subclasses with sharing settings are no longer required as SOQL queries can now run in USER_MODE or SYSTEM_MODE.
This commit is contained in:
@@ -1,75 +1,75 @@
|
|||||||
public virtual inherited sharing class ${NAME}
|
public virtual without sharing class ${NAME}
|
||||||
extends fflib_SObjectSelector
|
extends fflib_SObjectSelector
|
||||||
implements I${NAME}
|
implements I${NAME}
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Runs the query in User Mode, respecting FLS, CRUD & sharing rules
|
||||||
|
*
|
||||||
|
* @return New instance of the selector
|
||||||
|
*/
|
||||||
public static I${NAME} newInstance()
|
public static I${NAME} newInstance()
|
||||||
{
|
{
|
||||||
return (I${NAME}) Application.Selector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
return (I${NAME})
|
||||||
|
((fflib_SObjectSelector) Application.Selector.newInstance(Schema.${SObject_API_Name}.SObjectType))
|
||||||
|
.setDataAccess(fflib_SObjectSelector.DataAccess.USER_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the query in System Mode, disabling FLS, CRUD & sharing rules
|
||||||
|
*
|
||||||
|
* @return New instance of the selector
|
||||||
|
*/
|
||||||
public static I${NAME} newWithoutSharingInstance()
|
public static I${NAME} newWithoutSharingInstance()
|
||||||
{
|
{
|
||||||
return (I${NAME}) Application.ElevatedSelector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
return (I${NAME})
|
||||||
}
|
((fflib_SObjectSelector) Application.Selector.newInstance(Schema.${SObject_API_Name}.SObjectType))
|
||||||
|
.setDataAccess(fflib_SObjectSelector.DataAccess.SYSTEM_MODE);
|
||||||
public static I${NAME} newInheritedSharingInstance()
|
|
||||||
{
|
|
||||||
return (I${NAME}) Application.NoSharingSelector.newInstance(Schema.${SObject_API_Name}.SObjectType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
* This should not be used directly by an application but only by fflib
|
||||||
|
*/
|
||||||
public ${NAME}()
|
public ${NAME}()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ${NAME}(Boolean includeFieldSetFields, Boolean enforceCRUD, Boolean enforceFLS)
|
/**
|
||||||
|
* The fields to always include in all queries
|
||||||
|
*
|
||||||
|
* @return Returns a list of default fields that are always queried
|
||||||
|
*/
|
||||||
|
public virtual List<Schema.SObjectField> getSObjectFieldList()
|
||||||
{
|
{
|
||||||
super(includeFieldSetFields, enforceCRUD, enforceFLS);
|
List<SObjectField> sObjectFields = new List<Schema.SObjectField>
|
||||||
}
|
|
||||||
|
|
||||||
public List<Schema.SObjectField> getSObjectFieldList()
|
|
||||||
{
|
|
||||||
return new List<Schema.SObjectField>
|
|
||||||
{
|
{
|
||||||
${SObject_API_Name}.Id
|
${SObject_API_Name}.Id
|
||||||
};
|
};
|
||||||
|
// Uncomment the following line if this selector is extended from another selector
|
||||||
|
// result.addAll(super.getSObjectFieldList());
|
||||||
|
return sObjectFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the SObjectType of the records returned by this selector class
|
||||||
|
*
|
||||||
|
* @return Returns the SObjectType of the returned records
|
||||||
|
*/
|
||||||
public Schema.SObjectType getSObjectType()
|
public Schema.SObjectType getSObjectType()
|
||||||
{
|
{
|
||||||
return Schema.${SObject_API_Name}.SObjectType;
|
return Schema.${SObject_API_Name}.SObjectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets ${SObject_API_Name} records by their Id
|
||||||
|
*
|
||||||
|
* @param idSet The Ids to query
|
||||||
|
*
|
||||||
|
* @return Returns a list of ${SObject_API_Name} records matching the idSet
|
||||||
|
*/
|
||||||
public virtual List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
public virtual List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
||||||
{
|
{
|
||||||
return (List<${SObject_API_Name}>) selectSObjectsById(idSet);
|
return (List<${SObject_API_Name}>) selectSObjectsById(idSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public with sharing class WithSharing extends ${NAME}
|
|
||||||
{
|
|
||||||
// Constructor that will enforce CRUD and FLS
|
|
||||||
public WithSharing()
|
|
||||||
{
|
|
||||||
super(true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
|
||||||
{
|
|
||||||
return super.selectById(idSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public without sharing class WithoutSharing extends ${NAME}
|
|
||||||
{
|
|
||||||
// Constructor that will enforce CRUD and FLS
|
|
||||||
public WithoutSharing()
|
|
||||||
{
|
|
||||||
super(true, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<${SObject_API_Name}> selectById(Set<Id> idSet)
|
|
||||||
{
|
|
||||||
return super.selectById(idSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user