|
1 | | -# virtual FinalizerHandler |
2 | | - |
3 | | -The `FinalizerHandler` class is a utility class that handles the execution of dynamic finalizers. |
4 | | -Finalizers are classes that implement the `TriggerAction.DmlFinalizer` interface and are defined in Custom Metadata. |
5 | | -Finalizers can be used to perform custom actions after all DML operations have completed. |
6 | | -The `FinalizerHandler` class provides the following functionality: |
7 | | -- A way to bypass the execution of specific finalizers. |
8 | | -- A way to check if a specific finalizer is bypassed. |
9 | | -- A way to clear all bypasses. |
10 | | -- A way to handle dynamic finalizers. |
11 | | ---- |
12 | | -To use the `FinalizerHandler` class, you must first create a Custom Metadata type called `DML_Finalizer__mdt`. |
13 | | -The `DML_Finalizer__mdt` Custom Metadata type must have the following fields: |
14 | | -- `Apex_Class_Name__c`: The name of the Apex class that implements the finalizer. |
15 | | -- `Order__c`: The order in which the finalizer should be executed. |
16 | | -- `Bypass_Execution__c`: A flag that indicates whether or not the finalizer should be bypassed. |
17 | | -- `Bypass_Permission__c`: The permission required to bypass the finalizer. |
18 | | -- `Required_Permission__c`: The permission required to execute the finalizer. |
19 | | ---- |
20 | | -Once you have created the `DML_Finalizer__mdt` Custom Metadata type, you can create finalizers by creating records |
21 | | -in the `DML_Finalizer__mdt` object. |
22 | | -To bypass the execution of a specific finalizer, you can call the `bypass` method of the `FinalizerHandler` class. |
23 | | -To check if a specific finalizer is bypassed, you can call the `isBypassed` method of the `FinalizerHandler` class. |
24 | | -To clear all bypasses, you can call the `clearAllBypasses` method of the `FinalizerHandler` class. |
25 | | -To handle dynamic finalizers, you can call the `handleDynamicFinalizers` method of the `FinalizerHandler` class. |
| 1 | +# FinalizerHandler Class |
| 2 | +`virtual` |
| 3 | + |
| 4 | +The `FinalizerHandler` class is a utility class that handles the execution of dynamic finalizers. |
| 5 | + |
| 6 | +Finalizers are classes that implement the `TriggerAction.DmlFinalizer` interface and are defined in Custom Metadata. |
| 7 | +Finalizers can be used to perform custom actions after all DML operations have completed. |
| 8 | + |
| 9 | +The `FinalizerHandler` class provides the following functionality: |
| 10 | + |
| 11 | +- A way to bypass the execution of specific finalizers. |
| 12 | +- A way to check if a specific finalizer is bypassed. |
| 13 | +- A way to clear all bypasses. |
| 14 | +- A way to handle dynamic finalizers. |
| 15 | +--- |
| 16 | +To use the `FinalizerHandler` class, you must first create a Custom Metadata type called `DML_Finalizer__mdt` . |
| 17 | +The `DML_Finalizer__mdt` Custom Metadata type must have the following fields: |
| 18 | + |
| 19 | +- `Apex_Class_Name__c` : The name of the Apex class that implements the finalizer. |
| 20 | +- `Order__c` : The order in which the finalizer should be executed. |
| 21 | +- `Bypass_Execution__c` : A flag that indicates whether or not the finalizer should be bypassed. |
| 22 | +- `Bypass_Permission__c` : The permission required to bypass the finalizer. |
| 23 | +- `Required_Permission__c` : The permission required to execute the finalizer. |
| 24 | +--- |
| 25 | +Once you have created the `DML_Finalizer__mdt` Custom Metadata type, you can create finalizers by creating records |
| 26 | +in the `DML_Finalizer__mdt` object. |
| 27 | + |
| 28 | +To bypass the execution of a specific finalizer, you can call the `bypass` method of the `FinalizerHandler` class. |
| 29 | +To check if a specific finalizer is bypassed, you can call the `isBypassed` method of the `FinalizerHandler` class. |
| 30 | +To clear all bypasses, you can call the `clearAllBypasses` method of the `FinalizerHandler` class. |
| 31 | + |
| 32 | +To handle dynamic finalizers, you can call the `handleDynamicFinalizers` method of the `FinalizerHandler` class. |
26 | 33 | The `handleDynamicFinalizers` method will instantiate and execute all finalizers that are not bypassed. |
27 | 34 |
|
28 | | - |
29 | 35 | **Group** Trigger Actions Framework |
30 | 36 |
|
31 | 37 | ## Methods |
32 | | -### `public static void bypass(String finalizer)` |
| 38 | +### `bypass(finalizer)` |
33 | 39 |
|
34 | 40 | Bypass the execution of a specific finalizer. |
35 | 41 |
|
| 42 | +#### Signature |
| 43 | +```apex |
| 44 | +public static void bypass(String finalizer) |
| 45 | +``` |
| 46 | + |
36 | 47 | #### Parameters |
| 48 | +| Name | Type | Description | |
| 49 | +|------|------|-------------| |
| 50 | +| finalizer | String | The name of the finalizer to bypass. | |
| 51 | + |
| 52 | +#### Return Type |
| 53 | +**void** |
37 | 54 |
|
38 | | -|Param|Description| |
39 | | -|---|---| |
40 | | -|`finalizer`|The name of the finalizer to bypass.| |
| 55 | +--- |
41 | 56 |
|
42 | | -### `public static void clearBypass(String finalizer)` |
| 57 | +### `clearBypass(finalizer)` |
43 | 58 |
|
44 | 59 | Clear the bypass for a specific finalizer. |
45 | 60 |
|
| 61 | +#### Signature |
| 62 | +```apex |
| 63 | +public static void clearBypass(String finalizer) |
| 64 | +``` |
| 65 | + |
46 | 66 | #### Parameters |
| 67 | +| Name | Type | Description | |
| 68 | +|------|------|-------------| |
| 69 | +| finalizer | String | The name of the finalizer to clear the bypass for. | |
47 | 70 |
|
48 | | -|Param|Description| |
49 | | -|---|---| |
50 | | -|`finalizer`|The name of the finalizer to clear the bypass for.| |
| 71 | +#### Return Type |
| 72 | +**void** |
51 | 73 |
|
52 | | -### `public static Boolean isBypassed(String finalizer)` |
| 74 | +--- |
| 75 | + |
| 76 | +### `isBypassed(finalizer)` |
53 | 77 |
|
54 | 78 | Check if a specific finalizer is bypassed. |
55 | 79 |
|
| 80 | +#### Signature |
| 81 | +```apex |
| 82 | +public static Boolean isBypassed(String finalizer) |
| 83 | +``` |
| 84 | + |
56 | 85 | #### Parameters |
| 86 | +| Name | Type | Description | |
| 87 | +|------|------|-------------| |
| 88 | +| finalizer | String | The name of the finalizer to check. | |
57 | 89 |
|
58 | | -|Param|Description| |
59 | | -|---|---| |
60 | | -|`finalizer`|The name of the finalizer to check.| |
| 90 | +#### Return Type |
| 91 | +**Boolean** |
61 | 92 |
|
62 | | -#### Returns |
| 93 | +True if the finalizer is bypassed, false otherwise. |
63 | 94 |
|
64 | | -|Type|Description| |
65 | | -|---|---| |
66 | | -|`Boolean`|True if the finalizer is bypassed, false otherwise.| |
| 95 | +--- |
67 | 96 |
|
68 | | -### `public static void clearAllBypasses()` |
| 97 | +### `clearAllBypasses()` |
69 | 98 |
|
70 | 99 | Clear all bypasses. |
71 | 100 |
|
72 | | -### `public virtual void handleDynamicFinalizers()` |
| 101 | +#### Signature |
| 102 | +```apex |
| 103 | +public static void clearAllBypasses() |
| 104 | +``` |
73 | 105 |
|
74 | | -Handle dynamic finalizers.nstantiates and executes finalizers based on metadata. |
| 106 | +#### Return Type |
| 107 | +**void** |
75 | 108 |
|
76 | 109 | --- |
77 | | -## Classes |
78 | | -### Context |
79 | 110 |
|
80 | | -Context to be passed to the implementation's `.execute` methodis object's definition is empty. We are establishing the interface |
81 | | -to include the context to help future-proof the interface's specifications. |
| 111 | +### `handleDynamicFinalizers()` |
82 | 112 |
|
| 113 | +Handle dynamic finalizers.nstantiates and executes finalizers based on metadata. |
83 | 114 |
|
84 | | ---- |
| 115 | +#### Signature |
| 116 | +```apex |
| 117 | +public virtual void handleDynamicFinalizers() |
| 118 | +``` |
| 119 | + |
| 120 | +#### Return Type |
| 121 | +**void** |
| 122 | + |
| 123 | +## Classes |
| 124 | +### Context Class |
| 125 | + |
| 126 | +Context to be passed to the implementation's `.execute` methodis object's definition is empty. We are establishing the interface |
| 127 | +to include the context to help future-proof the interface's specifications. |
0 commit comments