Foundations Apex API Developer Reference

fferpcore.RegistrationService

global with sharing class RegistrationService

This class is the initial entry point into Foundations. Products must create at least one RegistrationRequest in order to register a product with Foundations. When a RegistrationRequest has been created, publications and subscriptions can be added to that request to create these objects inside Foundations.
Once these requests have been created, then they must be registered with Foundations using the registerProduct method. This should be done inside your install hook.
If you wish to uninstall a product and all related publications and subscriptions use the unregisterProduct method. This should be done inside your uninstall hook.

Methods

registerProduct

global static void registerProduct(fferpcore.RegistrationService.RegistrationRequest request)

Register a Foundations Product with all of its potential subscriptions and publications. If the product is already registered then the registration will be updated as for an upgrade.

Input Parameters

Name Type Description
request fferpcore.RegistrationService.RegistrationRequest The registration request.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

unregisterProduct

global static void unregisterProduct(String developerName)

Remove a product, its publications and subscribers. It may not be possible to remove all rows due to referential integrity. In this situation the product and any remaining publications/subscribers need to be marked as obsolete.

Input Parameters

Name Type Description
developerName String The name of the product to remove.

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 without sharing class HCMUninstall implements UninstallHandler
{
    global void onUninstall(UninstallContext context)
    {
        fferpcore.RegistrationService.unregisterProduct('HCM');
    }
}

fferpcore.RegistrationService.RegistrationRequest

global class RegistrationRequest

A request to register a Linked Product with Foundations.

Methods

RegistrationRequest

global RegistrationRequest(String developerName, String name, System.Version version)

Constructor that specifies the developer name, name and version for a product we want to register with Foundations.

Input Parameters

Name Type Description
developerName String The developer name of the product associated with this request.
name String The name of the product associated with this request.
version System.Version The version number of the product.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withProductProxy

global fferpcore.RegistrationService.RegistrationRequest withProductProxy(String productProxy)

This fluent method is used to specify a product proxy developer name associated with all publications and subscriptions for this product.

Input Parameters

Name Type Description
productProxy String The developer name of the product proxy.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

getDeveloperName

global String getDeveloperName()

Return Value

The developer name associated with the product this registration represents.

getName

global String getName()

Return Value

The name associated with the product this registration represents.

getVersion

global Version getVersion()

Return Value

The version number associated with the product this registration represents.

getPublicationRequests

global List<fferpcore.RegistrationService.PublicationRequest> getPublicationRequests()

Return Value

Any publications requests associated with this registration.

getSubscriptionRequests

global List<fferpcore.RegistrationService.SubscriptionRequest> getSubscriptionRequests()

Return Value

Any subscriptions requests associated with this registration.

getProductProxy

global String getProductProxy()

Return Value

The product proxy name associated with this registration.

addPublication

global fferpcore.RegistrationService.PublicationRequest addPublication(String messageTypeDeveloperName)

This fluent method is used to add a publication request. When the RegistrationRequest is registered with Foundations this PublicationRequest will become a Publication object associated with the linked product specified in this registration request.

Input Parameters

Name Type Description
messageTypeDeveloperName String The developer name of a the message type we want to associate this publication with.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

addSubscription

global fferpcore.RegistrationService.SubscriptionRequest addSubscription(String messageTypeDeveloperName, Type messageHandler)

This fluent method is used to add a subscription request. When the RegistrationRequest is registered with Foundations this SubscriptionRequest will become a Subscription object associated with the linked product specified in this registration request.

Input Parameters

Name Type Description
messageTypeDeveloperName String The developer name of a the message type we want to associate this subscription with.
messageHandler Type The class which will be called when this subscription receives messages.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

fferpcore.RegistrationService.PublicationRequest

global class PublicationRequest

A request to register a publication with Foundations.

Methods

PublicationRequest

global PublicationRequest(String messageTypeDeveloperName)

Constructor that specifies which message type this publication will be associated with.
This method should not be called directly as it will be called implicitly when a RegistrationRequest adds a publication.

Input Parameters

Name Type Description
messageTypeDeveloperName String The message type this publication will be associated with.

withDescription

global fferpcore.RegistrationService.PublicationRequest withDescription(String value)

This fluent method is used to specify a description for this publication when registered with Foundations.

Input Parameters

Name Type Description
value String A description for the publication.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withDocumentationUrl

global fferpcore.RegistrationService.PublicationRequest withDocumentationUrl(String value)

This fluent method is used to specify a URL pointing to this publications online help page.

Input Parameters

Name Type Description
value String A documentation URL for this publication.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withDescriber

global fferpcore.RegistrationService.PublicationRequest withDescriber(Type describer)

This fluent method is used to specify a describer for this publication when registered with Foundations. The describer class specifies the structure of the messages sent from this publication.

Input Parameters

Name Type Description
describer Type The describer class for this publication.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withIdentifier

global fferpcore.RegistrationService.PublicationRequest withIdentifier(String identifier)

This fluent method is used to specify a identifier associated with this publication.
This identifier cannot be the same for any 2 publications:
- With the same Product
- With the same fferpcore.Message Type
- With the same Product Proxy

Input Parameters

Name Type Description
identifier String Used to set the identifier field on a publication.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withSendingHook

global fferpcore.RegistrationService.PublicationRequest withSendingHook(Type sendingHook)

Specifies the sending hook responsible for delivering the messages.

Input Parameters

Name Type Description
sendingHook Type The class that implements the SendingHook interface.

Return Value

The PublicationRequest. This enables other methods to be invoked.

withReplacedIdentifier

global fferpcore.RegistrationService.PublicationRequest withReplacedIdentifier(String identifier)

Specifies the identifier of an existing publication, which is to be overridden.

Input Parameters

Name Type Description
identifier String The identifier of the original publication to be overridden.

Return Value

The PublicationRequest. This enables other methods to be invoked.

withMessageTypeDescription

global fferpcore.RegistrationService.PublicationRequest withMessageTypeDescription(String description)

Specifies a description for the message type. This is only used if the message type does not currently exist or does not have a description.

Input Parameters

Name Type Description
description String A description of the message type.

Return Value

The PublicationRequest. This enables other methods to be invoked.

withVirtualObject

global fferpcore.RegistrationService.PublicationRequest withVirtualObject(String virtualObject, String provider)

Specify the associated virtual object and provider.

Input Parameters

Name Type Description
virtualObject String The associated virtual object to be published.
provider String The source of the data used to generate the virtual objects.

Return Value

The PublicationRequest. This enables other methods to be invoked.

withSourceObject

global fferpcore.RegistrationService.PublicationRequest withSourceObject(String sourceObject)

Specify the associated source object. For example, Account.

Input Parameters

Name Type Description
sourceObject String The associated source object.

Return Value

The PublicationRequest. This enables other methods to be invoked.

getMessageTypeDeveloperName

global String getMessageTypeDeveloperName()

Return Value

The developer name associated with the message type assigned to this publication.

getMessageTypeDescription

global String getMessageTypeDescription()

Return Value

The description of the message type associated with this publication.

getDescription

global String getDescription()

Return Value

The description assigned to this publication.

getDocumentationUrl

global String getDocumentationUrl()

Return Value

The documentation url assigned to this publication.

getDescriber

global Type getDescriber()

Return Value

The describer class assigned to this publication.

getIdentifier

global String getIdentifier()

Return Value

The identifier associated with this publication request.

getSendingHook

global Type getSendingHook()

Return Value

The class responsible for delivering the messages.

isReplacement

global Boolean isReplacement()

Return Value

A boolean value that indicates whether this publication is to override an existing publication.

getReplacedIdentifier

global String getReplacedIdentifier()

Return Value

The identifier of an existing publication, which is to be overridden.

getVirtualObject

global String getVirtualObject()

Return Value

The virtual object to be published.

getVirtualObjectProvider

global String getVirtualObjectProvider()

Return Value

The source of the data used to generate the virtual objects.

getSourceObject

global String getSourceObject()

Return Value

The associated source object.

fferpcore.RegistrationService.SubscriptionRequest

global class SubscriptionRequest

A request to register a subscription with Foundations.

Methods

SubscriptionRequest

global SubscriptionRequest(String messageTypeDeveloperName, Type messageHandler)

Constructor that specifies which message type this subscription will be associated with and which class will be invoked when this subscription receives messages.
This method should not be called directly as it will be called implicitly when a RegistrationRequest adds a subscription.

Input Parameters

Name Type Description
messageTypeDeveloperName String The message type this subscription will be associated with.
messageHandler Type The class which will be invoked when the subscription receives a messages.

withExcludeFromSelf

global fferpcore.RegistrationService.SubscriptionRequest withExcludeFromSelf(Boolean value)

Input Parameters

Name Type Description
value Boolean Set to true to disallow receipt of messages from the same Foundations Product.

withDeliveryOrder

global fferpcore.RegistrationService.SubscriptionRequest withDeliveryOrder(Integer value)

Use within a product to ensure dependent messages are delivered in the right order, for example Skills after Workers so a Worker exists before Skills are added to it.

Input Parameters

Name Type Description
value Integer Handlers are invoked in increasing order of this value.

withDescription

global fferpcore.RegistrationService.SubscriptionRequest withDescription(String value)

This fluent method is used to specify a description for this subscription when registered with Foundations.

Input Parameters

Name Type Description
value String A description for the subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withDocumentationUrl

global fferpcore.RegistrationService.SubscriptionRequest withDocumentationUrl(String value)

This fluent method is used to specify a URL pointing to this subscriptions online help page.

Input Parameters

Name Type Description
value String A documentation URL for this subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withHandlerData

global fferpcore.RegistrationService.SubscriptionRequest withHandlerData(String value)

This fluent method is used to specify handler data for this subscription when registered with Foundations.

Input Parameters

Name Type Description
value String Handler data for the subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withBulkCapacity

global fferpcore.RegistrationService.SubscriptionRequest withBulkCapacity(Integer value)

This fluent method is used to specify the number of messages can be received at once during a batch job for this subscription when registered with Foundations.

Input Parameters

Name Type Description
value Integer Bulk capacity for the subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withSynchronousCapacity

global fferpcore.RegistrationService.SubscriptionRequest withSynchronousCapacity(Integer value)

This fluent method is used to specify the number of messages that can be received at once during synchronous operation. The subscription is enabled for automatic switching to batch delivery when the number of messages exceeds this threshold.

withDescriber

global fferpcore.RegistrationService.SubscriptionRequest withDescriber(Type value)

This fluent method is used to specify the describer for this subscription when registered with Foundations. The describer class specifies the information this subscription looks for when it receives a message.

Input Parameters

Name Type Description
value Type A description for the subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withIdentifier

global fferpcore.RegistrationService.SubscriptionRequest withIdentifier(String identifier)

This fluent method is used to specify a identifier associated with this subscription. This identifier cannot be the same for any 2 subscriptions:
- With the same Product
- With the same fferpcore.Message Type
- With the same Product Proxy

Input Parameters

Name Type Description
identifier String Used to set the identifier field on a subscription.

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 without sharing class ClickLinkInstall implements InstallHandler
{
    global void onInstall(InstallContext context)
    {
        fferpcore.RegistrationService.RegistrationRequest request = 
            new fferpcore.RegistrationService.RegistrationRequest('HCM', 'HCM Name', new Version(1, 0, 0)).
                withProductProxy('ClickLink');

        request.addPublication('Resource.Update').
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withDescriber(ThisPublicationsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        request.addSubscription('Resource.Update', YourHandlerClass.class).
            withExcludeFromSelf(true).
            withDeliveryOrder(1).
            withDescription('I handle the Resource.Update message type for the HCM_FakeWorker__c object.').
            withDocumentationURL('http://financialforce.com').
            withHandlerData('I am handler data').
            withBulkCapacity(500).
            withDescriber(ThisSubscriptionsDescriber.class).
            withIdentifier('HCM_FakeWorker__c');

        fferpcore.RegistrationService.registerProduct(request);
    }
}

withAutomaticLinkControlOnException

global fferpcore.RegistrationService.SubscriptionRequest withAutomaticLinkControlOnException(String errorLinkDeveloperName, fferpcore.RegistrationService.PublicationRequest errorPublication)

This fluent method is used to specify a publication and link control developer name (id) on which to send error details if an exception is thrown from the delivery handler.

Input Parameters

Name Type Description
errorPublication fferpcore.RegistrationService.PublicationRequest The publication that should send the error message.
errorLinkDeveloperName String The developer name for the link.

withMessageTypeDescription

global fferpcore.RegistrationService.SubscriptionRequest withMessageTypeDescription(String description)

Specifies a description for the message type. This is only used if the message type does not currently exist or does not have a description.

Input Parameters

Name Type Description
description String A description of the message type.

Return Value

The SubscriptionRequest. This enables other methods to be invoked.

withVirtualObject

global fferpcore.RegistrationService.SubscriptionRequest withVirtualObject(String targetObject, String consumer)

Specify the associated target object and consumer.

Input Parameters

Name Type Description
targetObject String The name of the object that is being created.
consumer String The name of the consumer. Used on corresponding VirtualDataObjectTargetMapping records.

Return Value

The SubscriptionRequest. This enables other methods to be invoked.

getMessageTypeDeveloperName

global String getMessageTypeDeveloperName()

Return Value

The developer name of the message type associated with this subscription.

getMessageTypeDescription

global String getMessageTypeDescription()

Return Value

The description of the message type associated with this subscription.

getMessageHandler

global Type getMessageHandler()

Return Value

The message handler class which will be invoked when this subscription receives a message.

isExcludeFromSelf

global Boolean isExcludeFromSelf()

Return Value

Whether or not this subscription will receive messages from a publication which sends messages on the same message type in the same product.

getDeliveryOrder

global Integer getDeliveryOrder()

Return Value

The order that this subscription will receive messages in.

getDescription

global String getDescription()

Return Value

The description assigned to this subscription.

getDocumentationUrl

global String getDocumentationUrl()

Return Value

The documentation url assigned to this subscription.

getHandlerData

global String getHandlerData()

Return Value

The handler data assigned to this subscription.

getBulkCapacity

global Integer getBulkCapacity()

Return Value

The bulk capacity assigned to this subscription.

getDescriber

global Type getDescriber()

Return Value

The describer class assigned to this subscription.

getIdentifier

global String getIdentifier()

Return Value

The identifier associated with this publication request.

getErrorPublication

global fferpcore.RegistrationService.PublicationRequest getErrorPublication()

Return Value

The error publication assigned to this subscription.

getErrorLinkDeveloperName

global String getErrorLinkDeveloperName()

Return Value

The error link control developer name with this publication request.

getSynchronousCapacity

global Integer getSynchronousCapacity()

Return Value

The synchronous capacity before the subscription receives delivieries in batch.

getTargetObject

global String getTargetObject()

Return Value

The name of the object being created.

getVirtualObjectConsumer

global String getVirtualObjectConsumer()

Return Value

The name of the consumer. Used on corresponding VirtualDataObjectTargetMapping records.

© Copyright 2009–2021 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.