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
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,6 @@ public virtual class fflib_AppBinding
|
||||
protected System.Type interfaceType { get; set; }
|
||||
protected String namespacePrefix { get; set; }
|
||||
protected String packageName { get; set; }
|
||||
protected fflib_SharingMode sharingMode { get; set; }
|
||||
|
||||
public Integer compareTo(Object compareTo)
|
||||
{
|
||||
@@ -106,16 +105,6 @@ public virtual class fflib_AppBinding
|
||||
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.
|
||||
*
|
||||
@@ -224,19 +213,4 @@ public virtual class fflib_AppBinding
|
||||
this.bindingSequence = sequence;
|
||||
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)
|
||||
.setPackageName(binding.ApplicationPackage__r.DeveloperName)
|
||||
.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());
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
String systemTypeName = String.valueOf(binding.get(sObjectField));
|
||||
|
||||
-6
@@ -120,12 +120,6 @@ public virtual class fflib_AppBindingResolver
|
||||
return this;
|
||||
}
|
||||
|
||||
public fflib_IAppBindingResolver bySharingMode(fflib_SharingMode sharingMode)
|
||||
{
|
||||
this.bindingToResolve.setSharingMode(sharingMode);
|
||||
return this;
|
||||
}
|
||||
|
||||
public fflib_IAppBindingResolver byNamespacePrefix(String 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.ImplementationType__c,
|
||||
fflib_AppBinding__mdt.InterfaceType__c,
|
||||
fflib_AppBinding__mdt.SharingMode__c,
|
||||
fflib_AppBinding__mdt.Type__c
|
||||
};
|
||||
}
|
||||
|
||||
-6
@@ -94,12 +94,6 @@ public virtual class fflib_DynamicSelectorFactory
|
||||
this.selectorFactory.setMock(sObjectType, selectorInstance);
|
||||
}
|
||||
|
||||
public fflib_DynamicSelectorFactory setSharingMode(fflib_SharingMode sharingMode)
|
||||
{
|
||||
this.sharingMode = sharingMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void loadBindings()
|
||||
{
|
||||
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
||||
|
||||
-6
@@ -66,12 +66,6 @@ public virtual class fflib_DynamicServiceFactory
|
||||
this.serviceFactory.setMock(serviceInterfaceType, serviceImpl);
|
||||
}
|
||||
|
||||
public fflib_DynamicServiceFactory setSharingMode(fflib_SharingMode sharingMode)
|
||||
{
|
||||
this.sharingMode = sharingMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void loadBindings()
|
||||
{
|
||||
fflib_IAppBindings appBindings = new fflib_AppBindings(resolver.resolve());
|
||||
|
||||
-18
@@ -66,13 +66,6 @@ public interface fflib_IAppBinding
|
||||
*/
|
||||
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.
|
||||
*
|
||||
@@ -148,15 +141,4 @@ public interface fflib_IAppBinding
|
||||
* @return An instance of itself to enable method chaining
|
||||
*/
|
||||
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>
|
||||
<field>ImplementationType__c</field>
|
||||
</layoutItems>
|
||||
<layoutItems>
|
||||
<behavior>Required</behavior>
|
||||
<field>SharingMode__c</field>
|
||||
</layoutItems>
|
||||
</layoutColumns>
|
||||
<style>TwoColumnsLeftToRight</style>
|
||||
</layoutSections>
|
||||
|
||||
+2
-4
@@ -179,8 +179,7 @@ public class fflib_DynamicDomainFactoryTest
|
||||
Type__c = 'Domain',
|
||||
BindingObject__c = '',
|
||||
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
||||
ImplementationType__c = MyDomainConstructor.class.getName(),
|
||||
SharingMode__c = 'None'
|
||||
ImplementationType__c = MyDomainConstructor.class.getName()
|
||||
),
|
||||
new fflib_AppBinding__mdt(
|
||||
ApplicationPackage__c = otherApp.Id,
|
||||
@@ -188,8 +187,7 @@ public class fflib_DynamicDomainFactoryTest
|
||||
Type__c = 'Domain',
|
||||
BindingObject__c = '',
|
||||
BindingObjectAlternate__c = ACCOUNT_OBJECT_TYPE.getDescribe().getName(),
|
||||
ImplementationType__c = OtherDomainConstructor.class.getName(),
|
||||
SharingMode__c = 'None'
|
||||
ImplementationType__c = OtherDomainConstructor.class.getName()
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
+2
-4
@@ -37,8 +37,7 @@ public class fflib_DynamicSelectorFactoryTest
|
||||
|
||||
@TestVisible
|
||||
private static final fflib_DynamicSelectorFactory Selector =
|
||||
new fflib_DynamicSelectorFactory(bindingResolver)
|
||||
.setSharingMode(fflib_SharingMode.WithSharing);
|
||||
new fflib_DynamicSelectorFactory(bindingResolver);
|
||||
|
||||
private static final Type MY_SELECTOR_TYPE = fflib_DynamicSelectorFactoryTest.MySelector.class;
|
||||
|
||||
@@ -147,8 +146,7 @@ public class fflib_DynamicSelectorFactoryTest
|
||||
Type__c = 'Selector',
|
||||
BindingObject__c = '',
|
||||
BindingObjectAlternate__c = Schema.Account.SObjectType.getDescribe().getName(),
|
||||
ImplementationType__c = MY_SELECTOR_TYPE.getName(),
|
||||
SharingMode__c = 'With Sharing'
|
||||
ImplementationType__c = MY_SELECTOR_TYPE.getName()
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
-5
@@ -112,7 +112,6 @@ public class fflib_DynamicServiceFactoryTest
|
||||
result.setBindingType(fflib_AppBindingType.Service);
|
||||
result.setInterfaceType(MY_SERVICE_TYPE);
|
||||
result.setImplementationType(MY_SERVICE_TYPE);
|
||||
result.setSharingMode(fflib_SharingMode.WithSharing);
|
||||
result.setSequence(2);
|
||||
return result;
|
||||
}
|
||||
@@ -148,14 +147,12 @@ public class fflib_DynamicServiceFactoryTest
|
||||
Type__c = 'Service',
|
||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
||||
SharingMode__c = 'With Sharing',
|
||||
BindingSequence__c = 1
|
||||
),
|
||||
new fflib_AppBinding__mdt(
|
||||
Type__c = 'Service',
|
||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
||||
SharingMode__c = 'With Sharing',
|
||||
BindingSequence__c = 2
|
||||
)
|
||||
};
|
||||
@@ -172,14 +169,12 @@ public class fflib_DynamicServiceFactoryTest
|
||||
Type__c = 'Service',
|
||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||
ImplementationType__c = MY_SERVICE_TYPE.getName(),
|
||||
SharingMode__c = 'With Sharing',
|
||||
BindingSequence__c = 2
|
||||
),
|
||||
new fflib_AppBinding__mdt(
|
||||
Type__c = 'Service',
|
||||
InterfaceType__c = MY_SERVICE_INTERFACE_TYPE.getName(),
|
||||
ImplementationType__c = MY_ALT_SERVICE_TYPE.getName(),
|
||||
SharingMode__c = 'With Sharing',
|
||||
BindingSequence__c = 1
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user