fferpcore.TransformSubscriptionMappingglobal with sharing class TransformSubscriptionMapping extends SubscriptionDescription.Mapping A field mapping for Declarative Subscription that applies a Transform to its input data using the DataTransformationService. It takes one or two keys from the message and transforms the data via DataTransformationTable and outputs a single value. This class extends fferpcore.SubscriptionDescription.Mapping Methods
TransformSubscriptionMappingglobal TransformSubscriptionMapping(String targetField, Id transformTableId, List<List<String>> keyPaths)
Input Parameters
TransformSubscriptionMappingglobal TransformSubscriptionMapping(SObjectField targetField, Id transformTableId, List<List<String>> keyPaths)
Input Parameters
performImmediateActionsglobal override void performImmediateActions(fferpcore.SubscriptionDescription.ApplyMappingRequest request) This method takes a mapping request and stores it to be processed when performBulkActions is called. Mapping requests are grouped by record, therefore if request is the first request for a new record, the final request for the previous record is saved. Otherwise, the latest request for the current record is updated with the new transform request if it is valid. Input Parameters
Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. private void applyTrasformMappingRequests( List<fferpcore.TransformSubscriptionMapping> mappings, List<fferpcore.SubscriptionDescription.ApplyMappingRequest> requests) { for(fferpcore.SubscriptionDescription.Mapping mapping : mappings) { for(fferpcore.SubscriptionDescription.ApplyMappingRequest request : requests) { mapping.performImmediateAcctions(request); } mapping.performBulkActions(); } } performBulkActionsglobal override void performBulkActions() This method takes the collated TransformSubscriptionMappings and performs the transformation on all of them simultaneously. It then will apply the results to all relevant requests. This method should only be called once all immediate actions have been performed. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. private void applyTrasformMappingRequests( List<fferpcore.TransformSubscriptionMapping> mappings, List<fferpcore.SubscriptionDescription.ApplyMappingRequest> requests) { for(fferpcore.SubscriptionDescription.Mapping mapping : mappings) { for(fferpcore.SubscriptionDescription.ApplyMappingRequest request : requests) { mapping.performImmediateAcctions(request); } mapping.performBulkActions(); } } getTargetFieldsglobal override Set<String> getTargetFields() Return ValueA set of Strings that contain the single target field for the mapping. Used to display the target field on the UI. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. fferpcore_DataTransformationTable__c transfomationTable = new fferpcore_DataTransformationTable__c(); insert transfomationTable; List<List<String>> keypaths = new List<List<String>>{ new List<String>{'example', 'path1'}, new List<String>{'example', 'path2'} }; fferpcore.TransformSubscriptionMapping mapping = fferpcore.TransformSubscriptionMapping(Account.Name, transfomationTable.Id, keypaths); System.assert(new Set<String>{'Name', mapping.getTargetFields()); System.assert(keypaths, mapping.getMessageKeys()); getMessageKeysglobal override List<List<String>> getMessageKeys() Return ValueA List of List of Strings that contain the message keys used for the transformation. Used to display the target field on the UI. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. fferpcore_DataTransformationTable__c transfomationTable = new fferpcore_DataTransformationTable__c(); insert transfomationTable; List<List<String>> keypaths = new List<List<String>>{ new List<String>{'example', 'path1'}, new List<String>{'example', 'path2'} }; fferpcore.TransformSubscriptionMapping mapping = fferpcore.TransformSubscriptionMapping(Account.Name, transfomationTable.Id, keypaths); System.assert(new Set<String>{'Name', mapping.getTargetFields()); System.assert(keypaths, mapping.getMessageKeys()); |