-
Notifications
You must be signed in to change notification settings - Fork 13
FeatureFlagDataProvider
STATUS: ACTIVE
This class is responsible for querying / fetching FeatureFlag data. This is separate from the FeatureFlag flag class to facilitate proper unit testing. (and just good design)
Group FeatureFlag
Default constructor. Pulls the custom metadata records without soql.
Fetch the feature flags from custom metadata.
memoized map of feature flags by id
private mPerCustomPermissionOverridesByFeatureFlag
→ Map<String,List<FF_Enabled_For_Custom_Permission__mdt>>
TESTVISIBLE
memoized map of per-custom permission overrides by feature flag name
TESTVISIBLE
Memoized map of per-permission set overrides by feature flag name
Fetch the per-custom permission overrides from custom metadata.
Fetch the per-permission set overrides from custom metadata.
Returns a map of known feature flag metadata records keyed by the record id, rather than the record's label.
public perCustomPermissionOverridesByFeatureFlag
→ Map<String,List<FF_Enabled_For_Custom_Permission__mdt>>
Used to correlate related metadata records for per-custom permission enablement of features without having to burn a soql query to do so.
Used to correlate related metadata records for per-permission set enablement of features without having to burn a soql query to do so.
Returns set of ids corresponding to permission set ids that provide feature enablement for the indicated feature flag
Param | Description |
---|---|
featureFlagName |
Name of the feature flag to calculate Perm Set Ids |
Type | Description |
---|---|
Set |
Set<Id> of permission set ids |
Returns set of Strings representing custom permission names that provide feature enablement for the indicated feature flag
Param | Description |
---|---|
featureFlagName |
Name of the feature flag to calculate custom permission names |
Type | Description |
---|---|
Set |
Set<String> of custom permission names |
Used to find a users' assigned permission set ids. This is intentionally tied to the executing users' userId.
Type | Description |
---|---|
List |
List<Id> a list of permission set id's assigned to the current user |
TESTVISIBLE
Allows testers to inject custom metadata records that are not present in the org
Param | Description |
---|---|
flags |
Map of flags to override this class' loading of custom metadata for flags |
private void overridePerPermSetOverrides(Map<String,Feature_Flag_Enabled_For__mdt> perPermSetOverrides)
TESTVISIBLE
Allows testers to inject custom metadata records that are not present in the org
Param | Description |
---|---|
perPermSetOverrides |
Map of flags to override this class' loading of custom metadata for per-permission set enablement of features |
private void overridePerCustomPermissionOverrides(Map<String,FF_Enabled_For_Custom_Permission__mdt> perCustomPermissionOverrides)
TESTVISIBLE
Allows testers to inject custom metadata records that are not present in the org
Param | Description |
---|---|
perCustomPermissionOverrides |
Map of flags to override this class' loading of custom metadata for per-custom-permission enablement of features |
private static Map rekeyMapByFeatureFlagName(Map<String,SObject> incomingMap, Map<String,List<SObject>> memoizedMap, Map<String,Feature_Flag__mdt> correlatingMap, String keyField)
SUPPRESSWARNINGS
given an incoming map, create and return a new map where the keys are a from the correlation map and the values are the values of the incoming map. Uses a memoized map for building and is intended to be used with a memoization pattern.
Param | Description |
---|---|
incomingMap |
This is the map that will provide the values to the resulting map. |
memoizedMap |
This is the 'working' or memoized map that is iteratively built and ultimately returned. |
correlatingMap |
This map provides the keys for the returned map |
keyField |
This is the field used to correlate the incoming map with the corresponding correlation map |
Type | Description |
---|---|
Map<String,List> | Map<String, List<sObject>> |