Foundations Apex API Developer Reference

fferpcore.LinkingMessageHandlerResult

global inherited sharing class LinkingMessageHandlerResult

A fferpcore.LinkingMessageHandlerResult structure. This object is returned by LinkingMessageHandler.onMessages(). Information can only be added to this object through Foundations.

Methods

createMessageRequestsFor

global List<fferpcore.MessagingSystemService.MessageRequest> createMessageRequestsFor(String messageType)

This method returns a list of message requests using information provided by Foundations. If this method is called without any input from Foundations then the result will be an empty list.

Input Parameters

Name Type Description
messageType String The message type we want to create messages for.

Return Value

This service returns a list of MessagingSystemService.MessageRequest 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.

global class HCMUpdateResourceHandler implements fferpcore.MessageHandler
{
    public static final String LINK_DEVELOPER_NAME = 'HCM';
    public static final String PRODUCT_DEVELOPER_NAME = 'HCM';
    public static final String RESOURCE_LINK_CONTROL_MESSAGE_TYPE = 'Resource.LinkControl';

    public void onMessages(fferpcore.HandleMessagesRequest request)
    {
        List<fferpcore.DeliveredMessage> messages = request.getMessages();

        fferpcore.SubscriptionDescription description = 
            fferpcore.SubscriptionDescriptionService.getDescription(PRODUCT_DEVELOPER_NAME, UpdateResourceMessage.TYPE_NAME).getDescription();

        fferpcore.LinkingCorrelationStrategy correlation = 
            new fferpcore.SimpleLinkingCorrelationStrategy(HCMFakeWorker__c.EmployeeId__c);

        fferpcore.LinkingMessageHandler linkingMessageHandler = 
            new fferpcore.LinkingMessageHandler(HCMFakeWorker__c.SObjectType, correlation, description, LINK_DEVELOPER_NAME);

        fferpcore.LinkingMessageHandlerResult result = linkingMessageHandler.onMessages(messages);
        
        fferpcore.MessagingSystemService.deliverNow(PRODUCT_DEVELOPER_NAME, result.createMessageRequestsFor(RESOURCE_LINK_CONTROL_MESSAGE_TYPE));
    }
}

//Without getting information through Foundations
fferpcore.LinkingMessageHandlerResult result = new fferpcore.LinkingMessageHandlerResult();

System.assertEquals(0, result.size());

createMessageRequestsFor

global List<fferpcore.MessagingSystemService.MessageRequest> createMessageRequestsFor(fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier)

This method returns a list of message requests using information provided by Foundations. If this method is called without any input from Foundations then the result will be an empty list.

Input Parameters

Name Type Description
messageTypeSpecifier fferpcore.MessagingSystemService.MessageTypeSpecifier The message type, identifier key we want to create messages for.

Return Value

This service returns a list of MessagingSystemService.MessageRequest 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.

global class HCMUpdateResourceHandler implements fferpcore.MessageHandler
{
    public static final String LINK_DEVELOPER_NAME = 'HCM';
    public static final String PRODUCT_DEVELOPER_NAME = 'HCM';
    public static final String RESOURCE_LINK_CONTROL_MESSAGE_TYPE = 'Resource.LinkControl';
    public static final String RESOURCE_LINK_CONTROL_IDENTIFIER = 'HCM Resource Link Control';

    public void onMessages(fferpcore.HandleMessagesRequest request)
    {
        List<fferpcore.DeliveredMessage> messages = request.getMessages();

        fferpcore.SubscriptionDescription description = 
            fferpcore.SubscriptionDescriptionService.getDescription(PRODUCT_DEVELOPER_NAME, UpdateResourceMessage.TYPE_NAME).getDescription();

        fferpcore.LinkingCorrelationStrategy correlation = 
            new fferpcore.SimpleLinkingCorrelationStrategy(HCMFakeWorker__c.EmployeeId__c);

        fferpcore.LinkingMessageHandler linkingMessageHandler = 
            new fferpcore.LinkingMessageHandler(HCMFakeWorker__c.SObjectType, correlation, description, LINK_DEVELOPER_NAME);

        fferpcore.LinkingMessageHandlerResult result = linkingMessageHandler.onMessages(messages);
        
        fferpcore.MessagingSystemService.deliverNow(PRODUCT_DEVELOPER_NAME, result.createMessageRequestsFor(
            new fferpcore.MessagingSystemService.MessageTypeSpecifier(
                RESOURCE_LINK_CONTROL_MESSAGE_TYPE,
                RESOURCE_LINK_CONTROL_IDENTIFIER))
        );
    }
}

//Without getting information through Foundations
fferpcore.LinkingMessageHandlerResult result = new fferpcore.LinkingMessageHandlerResult();

System.assertEquals(0, result.size());
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.