fferpcore.MessageTypeServiceglobal with sharing class MessageTypeService The service for interacting with Foundations fferpcore.Message Types. Properties
Methods
privilegedGetOrCreateglobal static Map<String, fferpcore__MessageType__c> privilegedGetOrCreate(Set<String> developerNames) This class uses a privileged operation to get or create the message types. Input Parameters
Return ValueThis service returns a map of String, MessageType__c objects. 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. Map<String, fferpcore.MessageType__c> messageTypes = fferpcore.MessageTypeService.privilegedGetOrCreate(new Set<String>{‘name1', 'name2'}); privilegedUpdateArchiveCutoffsglobal static void privilegedUpdateArchiveCutoffs() Update archive cutoff dates on the message types according to retention settings. 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.RegistrationService.RegistrationRequest request = new fferpcore.RegistrationService.RegistrationRequest('developerName', 'Name', new Version(1, 0, 0)); request.addPublication('MessageTypeDeveloperName'); fferpcore.RegistrationService.registerProduct(request); fferpcore.MessageTypeService.updateRetentionSettings(new Map<String, String>{‘MessageTypeDeveloperName' =< '6m'}); fferpcore.MessageTypeService.privilegedUpdateArchiveCutoffs(); fferpcore.MessageType__c messageType = [SELECT Id, ExpiryCutoff__c FROM fferpcore.MesageType__c WHERE DeveloperName__c = 'MessageTypeDeveloperName']; Datetime expiryTime = messageType.ExpiryCutoff__c; getMessageTypeTreesglobal static List<fferpcore.MessageTypeTreeNode> getMessageTypeTrees() This method returns the message type trees. There would normally be one, unless new roots have been created specifically by setting the parent to 'null' after insertion. The structure of the tree can be generated by separating parts of the developer name with '.' Return ValueThis service returns a list of MessageTypeTreeNode objects. 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.RegistrationService.RegistrationRequest request = new fferpcore.RegistrationService.RegistrationRequest('developerName', 'Name', new Version(1, 0, 0)); request.addPublication('Parent1.Parent2.Me'); request.addPublication('Root.Me2'); fferpcore.RegistrationService.registerProduct(request); fferpcore.MessageType__c root = [SELECT Id, Parent__c FROM fferpcore.MesageType__c WHERE DeveloperName__c = 'Root']; root.Parent__c = null; update root; List<fferpcore.MessageTypeTreeNode> nodes = fferpcore.MessageTypeService.getMessageTypeTrees(); System.assertEquals(2, nodes.size()); saveglobal static void save(List<fferpcore.MessageTypeTreeNode> trees) Save changes made through the fferpcore.MessageTypeTreeNode interface. 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. fferpcore.RegistrationService.RegistrationRequest request = new fferpcore.RegistrationService.RegistrationRequest('developerName', 'Name', new Version(1, 0, 0)); request.addPublication('Parent1.Parent2.Me'); request.addPublication('Root.Me2'); fferpcore.RegistrationService.registerProduct(request); fferpcore.MessageType__c root = [SELECT Id, Parent__c FROM fferpcore.MesageType__c WHERE DeveloperName__c = 'Root']; root.Parent__c = null; update root; List<fferpcore.MessageTypeTreeNode> nodes = fferpcore.MessageTypeService.getMessageTypeTrees(); System.assertEquals(2, nodes.size()); //Make a change to a node. ffeerpcore.MessageTypeService.save(nodes); updateRetentionSettingsglobal static void updateRetentionSettings(Map<String, String> settings) Update retention settings for the given developer names. 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. fferpcore.RegistrationService.RegistrationRequest request = new fferpcore.RegistrationService.RegistrationRequest('developerName', 'Name', new Version(1, 0, 0)); request.addPublication('MessageTypeDeveloperName'); fferpcore.RegistrationService.registerProduct(request); fferpcore.MessageTypeService.updateRetentionSettings(new Map<String, String>{‘MessageTypeDeveloperName' => '6m'}); fferpcore.MessageType__c messageType = [SELECT Id, StorageExpiry__c FROM fferpcore.MesageType__c WHERE DeveloperName__c = 'MessageTypeDeveloperName']; System.assertEquals('6m', messageType.StorageExpiry__c); |