Remove Sharing Mode from Dynamic Application Factories
Sharing mode is no longer required as SOQL queries can now run in USER_MODE or SYSTEM_MODE.
This commit is contained in:
+2
-1
@@ -59,7 +59,8 @@ public virtual class fflib_ClassicSelectorFactory
|
|||||||
* @param sObjectType The SObjectType of the Ids
|
* @param sObjectType The SObjectType of the Ids
|
||||||
*
|
*
|
||||||
* @return The queried records
|
* @return The queried records
|
||||||
* @exception fflib_Application.DeveloperException is thrown if the Ids set is empty
|
*
|
||||||
|
* @throws fflib_Application.DeveloperException is thrown if the Ids set is empty
|
||||||
*/
|
*/
|
||||||
public virtual List<SObject> selectById(Set<Id> recordIds, SObjectType sObjectType)
|
public virtual List<SObject> selectById(Set<Id> recordIds, SObjectType sObjectType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public virtual class fflib_AppBinding
|
|||||||
protected System.Type interfaceType { get; set; }
|
protected System.Type interfaceType { get; set; }
|
||||||
protected String namespacePrefix { get; set; }
|
protected String namespacePrefix { get; set; }
|
||||||
protected String packageName { get; set; }
|
protected String packageName { get; set; }
|
||||||
protected fflib_SharingMode sharingMode { get; set; }
|
|
||||||
|
|
||||||
public Integer compareTo(Object compareTo)
|
public Integer compareTo(Object compareTo)
|
||||||
{
|
{
|
||||||
@@ -106,16 +105,6 @@ public virtual class fflib_AppBinding
|
|||||||
return this.bindingSequence;
|
return this.bindingSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns an enum value fflib_SharingMode that defines the type of sharing used in the implementation class
|
|
||||||
*
|
|
||||||
* @see fflib_SharingMode
|
|
||||||
*/
|
|
||||||
public virtual fflib_SharingMode getSharingMode()
|
|
||||||
{
|
|
||||||
return this.sharingMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the implementation for this binding.
|
* Creates a new instance of the implementation for this binding.
|
||||||
*
|
*
|
||||||
@@ -224,19 +213,4 @@ public virtual class fflib_AppBinding
|
|||||||
this.bindingSequence = sequence;
|
this.bindingSequence = sequence;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets an enum value fflib_SharingMode that defines the type of sharing used in the implementation class
|
|
||||||
*
|
|
||||||
* @param sharingMode A enum value of fflib_SharingMode representing the sharing mode
|
|
||||||
*
|
|
||||||
* @return An instance of itself to enable method chaining
|
|
||||||
*
|
|
||||||
* @see fflib_SharingMode
|
|
||||||
*/
|
|
||||||
public virtual fflib_IAppBinding setSharingMode(fflib_SharingMode sharingMode)
|
|
||||||
{
|
|
||||||
this.sharingMode = sharingMode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
-25
@@ -45,7 +45,6 @@ public with sharing class fflib_AppBindingMetaDataModule
|
|||||||
.setNamespacePrefix(binding.NamespacePrefix)
|
.setNamespacePrefix(binding.NamespacePrefix)
|
||||||
.setPackageName(binding.ApplicationPackage__r.DeveloperName)
|
.setPackageName(binding.ApplicationPackage__r.DeveloperName)
|
||||||
.setSequence(binding.BindingSequence__c)
|
.setSequence(binding.BindingSequence__c)
|
||||||
.setSharingMode(getSharingModeFromString(binding.SharingMode__c))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,30 +93,6 @@ public with sharing class fflib_AppBindingMetaDataModule
|
|||||||
return bindingTypeByStrings.get(binding.Type__c.toUpperCase());
|
return bindingTypeByStrings.get(binding.Type__c.toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
private fflib_SharingMode getSharingModeFromString(String sharingMode)
|
|
||||||
{
|
|
||||||
switch on sharingMode.toUpperCase()
|
|
||||||
{
|
|
||||||
when 'WITH SHARING'
|
|
||||||
{
|
|
||||||
return fflib_SharingMode.WithSharing;
|
|
||||||
}
|
|
||||||
when 'WITHOUT SHARING'
|
|
||||||
{
|
|
||||||
return fflib_SharingMode.WithoutSharing;
|
|
||||||
}
|
|
||||||
when 'INHERITED SHARING'
|
|
||||||
{
|
|
||||||
return fflib_SharingMode.WithoutSharing;
|
|
||||||
}
|
|
||||||
when 'NONE'
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Type getSystemType(fflib_AppBinding__mdt binding, Schema.SObjectField sObjectField)
|
private Type getSystemType(fflib_AppBinding__mdt binding, Schema.SObjectField sObjectField)
|
||||||
{
|
{
|
||||||
String systemTypeName = String.valueOf(binding.get(sObjectField));
|
String systemTypeName = String.valueOf(binding.get(sObjectField));
|
||||||
|
|||||||
-6
@@ -120,12 +120,6 @@ public virtual class fflib_AppBindingResolver
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public fflib_IAppBindingResolver bySharingMode(fflib_SharingMode sharingMode)
|
|
||||||
{
|
|
||||||
this.bindingToResolve.setSharingMode(sharingMode);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public fflib_IAppBindingResolver byNamespacePrefix(String namespacePrefix)
|
public fflib_IAppBindingResolver byNamespacePrefix(String namespacePrefix)
|
||||||
{
|
{
|
||||||
this.bindingToResolve.setNamespacePrefix(namespacePrefix);
|
this.bindingToResolve.setNamespacePrefix(namespacePrefix);
|
||||||
|
|||||||
-1
@@ -46,7 +46,6 @@ public virtual without sharing class fflib_AppBindingsSelector extends fflib_SOb
|
|||||||
fflib_AppBinding__mdt.NamespacePrefix,
|
fflib_AppBinding__mdt.NamespacePrefix,
|
||||||
fflib_AppBinding__mdt.ImplementationType__c,
|
fflib_AppBinding__mdt.ImplementationType__c,
|
||||||
fflib_AppBinding__mdt.InterfaceType__c,
|
fflib_AppBinding__mdt.InterfaceType__c,
|
||||||
fflib_AppBinding__mdt.SharingMode__c,
|
|
||||||
fflib_AppBinding__mdt.Type__c
|
fflib_AppBinding__mdt.Type__c
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
-6
@@ -94,12 +94,6 @@ public virtual class fflib_DynamicSelectorFactory
|
|||||||
this.selectorFactory.setMock(sObjectType, selectorInstance);
|
this.selectorFactory.setMock(sObjectType, selectorInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public fflib_DynamicSelectorFactory setSharingMode(fflib_SharingMode sharingMode)
|
|
||||||
{
|
|
||||||
this.sharingMode = sharingMode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadBindings()
|
private void loadBindings()
|
||||||
{
|
{
|
||||||
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
||||||
|
|||||||
-6
@@ -66,12 +66,6 @@ public virtual class fflib_DynamicServiceFactory
|
|||||||
this.serviceFactory.setMock(serviceInterfaceType, serviceImpl);
|
this.serviceFactory.setMock(serviceInterfaceType, serviceImpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public fflib_DynamicServiceFactory setSharingMode(fflib_SharingMode sharingMode)
|
|
||||||
{
|
|
||||||
this.sharingMode = sharingMode;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadBindings()
|
private void loadBindings()
|
||||||
{
|
{
|
||||||
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
||||||
|
|||||||
-18
@@ -66,13 +66,6 @@ public interface fflib_IAppBinding
|
|||||||
*/
|
*/
|
||||||
Decimal getSequence();
|
Decimal getSequence();
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Returns an enum value fflib_SharingMode that defines the type of sharing used in the implementation class
|
|
||||||
*
|
|
||||||
* @see fflib_SharingMode
|
|
||||||
*/
|
|
||||||
fflib_SharingMode getSharingMode();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of the implementation for this binding.
|
* Creates a new instance of the implementation for this binding.
|
||||||
*
|
*
|
||||||
@@ -148,15 +141,4 @@ public interface fflib_IAppBinding
|
|||||||
* @return An instance of itself to enable method chaining
|
* @return An instance of itself to enable method chaining
|
||||||
*/
|
*/
|
||||||
fflib_IAppBinding setSequence(Decimal sequence);
|
fflib_IAppBinding setSequence(Decimal sequence);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets an enum value fflib_SharingMode that defines the type of sharing used in the implementation class
|
|
||||||
*
|
|
||||||
* @param sharingMode A enum value of fflib_SharingMode representing the sharing mode
|
|
||||||
*
|
|
||||||
* @return An instance of itself to enable method chaining
|
|
||||||
*
|
|
||||||
* @see fflib_SharingMode
|
|
||||||
*/
|
|
||||||
fflib_IAppBinding setSharingMode(fflib_SharingMode sharingMode);
|
|
||||||
}
|
}
|
||||||
-4
@@ -63,10 +63,6 @@
|
|||||||
<behavior>Required</behavior>
|
<behavior>Required</behavior>
|
||||||
<field>ImplementationType__c</field>
|
<field>ImplementationType__c</field>
|
||||||
</layoutItems>
|
</layoutItems>
|
||||||
<layoutItems>
|
|
||||||
<behavior>Required</behavior>
|
|
||||||
<field>SharingMode__c</field>
|
|
||||||
</layoutItems>
|
|
||||||
</layoutColumns>
|
</layoutColumns>
|
||||||
<style>TwoColumnsLeftToRight</style>
|
<style>TwoColumnsLeftToRight</style>
|
||||||
</layoutSections>
|
</layoutSections>
|
||||||
|
|||||||
+2
-4
@@ -179,8 +179,7 @@ public class fflib_DynamicDomainFactoryTest
|
|||||||
Type__c = 'Domain',
|
Type__c = 'Domain',
|
||||||
BindingObject__c = '',
|
BindingObject__c = '',
|
||||||
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
||||||
ImplementationType__c = MyDomainConstructor.class.getName(),
|
ImplementationType__c = MyDomainConstructor.class.getName()
|
||||||
SharingMode__c = 'None'
|
|
||||||
),
|
),
|
||||||
new fflib_AppBinding__mdt(
|
new fflib_AppBinding__mdt(
|
||||||
ApplicationPackage__c = otherApp.Id,
|
ApplicationPackage__c = otherApp.Id,
|
||||||
@@ -188,8 +187,7 @@ public class fflib_DynamicDomainFactoryTest
|
|||||||
Type__c = 'Domain',
|
Type__c = 'Domain',
|
||||||
BindingObject__c = '',
|
BindingObject__c = '',
|
||||||
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
||||||
ImplementationType__c = OtherDomainConstructor.class.getName(),
|
ImplementationType__c = OtherDomainConstructor.class.getName()
|
||||||
SharingMode__c = 'None'
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -37,8 +37,7 @@ public class fflib_DynamicSelectorFactoryTest
|
|||||||
|
|
||||||
@TestVisible
|
@TestVisible
|
||||||
private static final fflib_DynamicSelectorFactory Selector =
|
private static final fflib_DynamicSelectorFactory Selector =
|
||||||
new fflib_DynamicSelectorFactory(bindingResolver)
|
new fflib_DynamicSelectorFactory(bindingResolver);
|
||||||
.setSharingMode(fflib_SharingMode.WithSharing);
|
|
||||||
|
|
||||||
private static final Type MY_SELECTOR_TYPE = fflib_DynamicSelectorFactoryTest.MySelector.class;
|
private static final Type MY_SELECTOR_TYPE = fflib_DynamicSelectorFactoryTest.MySelector.class;
|
||||||
|
|
||||||
@@ -147,8 +146,7 @@ public class fflib_DynamicSelectorFactoryTest
|
|||||||
Type__c = 'Selector',
|
Type__c = 'Selector',
|
||||||
BindingObject__c = '',
|
BindingObject__c = '',
|
||||||
BindingObjectAlternate__c = Schema.Account.SObjectType.getDescribe().getName(),
|
BindingObjectAlternate__c = Schema.Account.SObjectType.getDescribe().getName(),
|
||||||
ImplementationType__c = MY_SELECTOR_TYPE.getName(),
|
ImplementationType__c = MY_SELECTOR_TYPE.getName()
|
||||||
SharingMode__c = 'With Sharing'
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -112,7 +112,6 @@ public class fflib_DynamicServiceFactoryTest
|
|||||||
result.setBindingType(fflib_AppBindingType.Service);
|
result.setBindingType(fflib_AppBindingType.Service);
|
||||||
result.setInterfaceType(MY_SERVICE_TYPE);
|
result.setInterfaceType(MY_SERVICE_TYPE);
|
||||||
result.setImplementationType(MY_SERVICE_TYPE);
|
result.setImplementationType(MY_SERVICE_TYPE);
|
||||||
result.setSharingMode(fflib_SharingMode.WithSharing);
|
|
||||||
result.setSequence(2);
|
result.setSequence(2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -148,14 +147,12 @@ public class fflib_DynamicServiceFactoryTest
|
|||||||
Type__c = 'Service',
|
Type__c = 'Service',
|
||||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||||
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
||||||
SharingMode__c = 'With Sharing',
|
|
||||||
BindingSequence__c = 1
|
BindingSequence__c = 1
|
||||||
),
|
),
|
||||||
new fflib_AppBinding__mdt(
|
new fflib_AppBinding__mdt(
|
||||||
Type__c = 'Service',
|
Type__c = 'Service',
|
||||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||||
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
||||||
SharingMode__c = 'With Sharing',
|
|
||||||
BindingSequence__c = 2
|
BindingSequence__c = 2
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@@ -172,14 +169,12 @@ public class fflib_DynamicServiceFactoryTest
|
|||||||
Type__c = 'Service',
|
Type__c = 'Service',
|
||||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||||
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
||||||
SharingMode__c = 'With Sharing',
|
|
||||||
BindingSequence__c = 2
|
BindingSequence__c = 2
|
||||||
),
|
),
|
||||||
new fflib_AppBinding__mdt(
|
new fflib_AppBinding__mdt(
|
||||||
Type__c = 'Service',
|
Type__c = 'Service',
|
||||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||||
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
||||||
SharingMode__c = 'With Sharing',
|
|
||||||
BindingSequence__c = 1
|
BindingSequence__c = 1
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user