Foundations Apex API Developer Reference

fferpcore.SubscriptionDescriptionService

global with sharing class SubscriptionDescriptionService

A fferpcore.SubscriptionDescriptionService structure.

Methods

getDescription

global static fferpcore.SubscriptionDescriptionService.GetDescriptionResult getDescription(Id subscriptionId)

Returns an GetDescriptionResult containing the description of the subscription identified by the Id parameter. The description includes the standard and custom mappings of the subscription.

Input Parameters

Name Type Description
subscriptionId Id The Id of the subscription to be described.

Return Value

This service returns an SubscriptionDescriptionService.GetDescriptionResult object.

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.

String productDeveloperName = 'developerName';
String messageTypeDeveloperName = 'Message Type Developer Name';

fferpcore.RegistrationService.RegistrationRequest request = 
    new fferpcore.RegistrationService.RegistrationRequest(productDeveloperName, 'Name', new Version(1, 0, 0));
request.addSubscription(messageTypeDeveloperName, messageHandlerImpl.class).withDescriber(SubscriptionDescriberImpl.class);
fferpcore.RegistrationService.registerProduct(request);

Id subscriptionId = [SELECT Id 
                       FROM MessagingSubscription__c  
                      WHERE OwnerProduct__r.DeveloperName__c = :productDeveloperName 
                        AND MessageType__r.DeveloperName__c = :messageTypeDeveloperName].Id;

fferpcore.SubscriptionDescriptionService.GetDescriptionResult descriptionResult = 
    fferpcore.SubscriptionDescriptionService.getDescription(subscriptionId); 

getDescription

global static fferpcore.SubscriptionDescriptionService.GetDescriptionResult getDescription(String productDeveloper, String messageType)

Returns an GetDescriptionResult containing description of the subscription identified by the productDeveloper and messageTypes parameters. The description includes the standard and custom mappings of the subscription.

Input Parameters

Name Type Description
productDeveloper String The developer name of the product.
messageType String The developer name of the message type.

Return Value

This service returns an SubscriptionDescriptionService.GetDescriptionResult object.

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.addSubscription('Message Type Developer Name', messageHandlerImpl.class).withDescriber(SubscriptionDescriberImpl.class);
fferpcore.RegistrationService.registerProduct(request);

fferpcore.SubscriptionDescriptionService.GetDescriptionResult descriptionResult = 
    fferpcore.SubscriptionDescriptionService.getDescription(subscriptionId);  

fferpcore.SubscriptionDescriptionService.GetDescriptionResult

global inherited sharing class GetDescriptionResult

A GetDescriptionResult structure.

Methods

GetDescriptionResult

global GetDescriptionResult(fferpcore.SubscriptionDescription description)

Constructs an fferpcore.SubscriptionDescriptionService.GetDescriptionResult containing the specified SubscriptionDescription.

Input Parameters

Name Type Description
description fferpcore.SubscriptionDescription The subscription description to be held in the result.

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.

//Construct a subscription describer that extends fferpcore.SubscriptionDescriber
ExampleDescriber describer = new ExampleDescriber();

fferpcore.SubscriptionDescriptionService.GetDescriptionResult result;
try
{
    fferpcore.SubscriptionDescription subscriptionDescription = describer.describe();
    result = new fferpcore.SubscriptionDescriptionService.GetDescriptionResult(subscriptionDescription);
}
catch (Exeception e)
{
    result = new fferpcore.SubscriptionDescriptionService.GetDescriptionResult(e.getMessage());
}

GetDescriptionResult

global GetDescriptionResult(String error)

Constructs an fferpcore.SubscriptionDescriptionService.GetDescriptionResult containing the specified error text. It can be used to indicate there was an error creating the description of a subscription.

Input Parameters

Name Type Description
error String Text describing the error.

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.

//Construct a subscription describer that extends fferpcore.SubscriptionDescriber
ExampleDescriber describer = new ExampleDescriber();

fferpcore.SubscriptionDescriptionService.GetDescriptionResult result;
try
{
    fferpcore.SubscriptionDescription subscriptionDescription = describer.describe();
    result = new fferpcore.SubscriptionDescriptionService.GetDescriptionResult(subscriptionDescription);
}
catch (Exeception e)
{
    result = new fferpcore.SubscriptionDescriptionService.GetDescriptionResult(e.getMessage());
}

getDescription

global fferpcore.SubscriptionDescription getDescription()

Returns an fferpcore.SubscriptionDescription containing the standard and custom mappings of the subscription. If there has been an error generating the description then null is returned.

Return Value

This service returns an SubscriptionDescription object.

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.addSubscription('Message Type Developer Name', messageHandlerImpl.class).withDescriber(SubscriptionDescriberImpl.class);
fferpcore.RegistrationService.registerProduct(request);

fferpcore.SubscriptionDescriptionService.GetDescriptionResult result = 
    fferpcore.SubscriptionDescriptionService.getDescription(subscriptionId).getDescription();  

fferpcore.SubscriptionDescription description = result.getDescription();

getError

global String getError()

Returns a string containing a description of any errors encountered when creating the GetDescriptionResult. If there was no error then null is returned.

Return Value

This service returns a String object.

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.addSubscription('Message Type Developer Name', messageHandlerImpl.class).withDescriber(SubscriptionDescriberImpl.class);
fferpcore.RegistrationService.registerProduct(request);

String errorText = 
    fferpcore.SubscriptionDescriptionService.getDescription('developerName', 'Message Type Developer Name').getError(); 

getDescriptionNotNull

global fferpcore.SubscriptionDescription getDescriptionNotNull()

Returns an GetDescriptionResult containing a description of the subscription identified by the productDeveloper and messageTypes parameters. The description includes the standard and custom mappings of the subscription. If there has been an error generating the description then an fferpcore.Exceptions.MessagingException is thrown.

Return Value

This service returns a SubscriptionDescription object.

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.addSubscription('Message Type Developer Name', messageHandlerImpl.class).withDescriber(SubscriptionDescriberImpl.class);
fferpcore.RegistrationService.registerProduct(request);

fferpcore.SubscriptionDescription description = 
    fferpcore.SubscriptionDescriptionService.getDescription('developerName', 'Message Type Developer Name').getDescriptionNotNull();  
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.