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:
Wim Velzeboer
2023-09-11 22:14:37 +01:00
parent 17116e3c12
commit a2027017d5
@@ -1,75 +1,75 @@
public virtual inherited sharing class ${NAME}
public virtual without sharing class ${NAME}
extends fflib_SObjectSelector
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()
{
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()
{
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}()
{
super();
}
public ${NAME}(Boolean includeFieldSetFields, Boolean enforceCRUD, Boolean enforceFLS)
{
super(includeFieldSetFields, enforceCRUD, enforceFLS);
}
public List<Schema.SObjectField> getSObjectFieldList()
/**
* 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()
{
return new List<Schema.SObjectField>
List<SObjectField> sObjectFields = new List<Schema.SObjectField>
{
${SObject_API_Name}.Id
};
// Uncomment the following line if this selector is extended from another selector
// result.addAll(super.getSObjectFieldList());
return sObjectFields;
}
public Schema.SObjectType getSObjectType()
/**
* Gets the SObjectType of the records returned by this selector class
*
* @return Returns the SObjectType of the returned records
*/
public Schema.SObjectType getSObjectType()
{
return Schema.${SObject_API_Name}.SObjectType;
}
public virtual List<${SObject_API_Name}> selectById(Set<Id> idSet)
/**
* 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)
{
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);
}
}
}