Foundations Apex API Developer Reference

fferpcore.Context

global abstract inherited sharing class Context

This class represents a context for creating new Sources which in turn can be used to create new Nodes. A fferpcore.Context may represent an SObjectType, currently the only type of context supported.
Contexts are descriptive, used at design time. At runtime they correspond to DataSource.Row, and describe the fferpcore.DataSource.Row that the Sources they create will operate on.

Enums

SourceType

Value Description
FROM_CONTEXT Source of the data is a field on the current context.
LITERAL Source is a static value that is defined by the publication.
PASSTHROUGH A Source designed to pass through the input context.
CORRELATION Source of the data is a field, unless null, in which case it uses a fallback field.
COMPOSITE Source of the data is the result of multiple sources chained together.
FALLBACK Source of the data is the result of the first source provided that has a value.

Methods

getClass

global abstract Type getClass()

This method is provided to support serialization to Javascript. This method returns the class type of the associated context. This method must be implemented by a class that implements Context.

Return Value

This service returns a Type 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.

public class ContextImpl extends fferpcore.Context
{
    public override type getClass()
    {
        return ContextImpl.class;
    }

    ...
}

fferpcore.Context contextExample = new ContextImpl();

System.assertEquals(ContextImpl.class, contextExample.getClass());

getInitMemento

global abstract String getInitMemento()

This method is provided to support serialization to Javascript. This method returns a string that describes the SObject to which the context is associated. This method must be implemented by a class that implements Context.

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.

public class ContextImpl extends fferpcore.Context
{   //In this example we have specifically designated ContextImpl to reference ExampleObject__c 
    public override string getInitMemento()
    {
        return ExampleObject__c.getDescribe().getName();
    }
}

fferpcore.Context contextExample = new ContextImpl();

System.assertEquals('ExampleObject__c', contextExample.getInitMemento());

initialise

global abstract void initialise(String memento)

This method is provided to support deserialization from Javascript. This method restores the state of the context ready for use. This method must be implemented by a class that implements Context.

Input Parameters

Name Type Description
memento String A memento previously returned by the getInitMemento() method.

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.

public class ContextImpl extends fferpcore.Context
{
    public override void initialise(String memento)
    {
        m_sObjectType = Schema.getGlobalDescribe().get(memento);
        if(m_sObjectType == null)
        {
            throw new Exceptions.MessagingException('SObjectType ' + memento + ' not recognised.');
        }
    }
    ...
}

fferpcore.Context contextExample = new ContextImpl();

contextExample.initialise('ExampleObject__c');

System.assertEquals('ExampleObject__c', contextExample.getInitMemento());

getDisplayDescription

global abstract fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method must be implemented by a class that implements Context.

Return Value

Information for display of this Source to the user.

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.

public class ContextImpl extends fferpcore.Context
{
    public override fferpcore.Context.DisplayDescription getDisplayDescription()
    {
        Schema.DescribeSObjectResult describe = ExampleObject.describe();
        return new fferpcore.Context.DisplayDescription(
            'ContextImpl',
            'ExampleObject__c', describe.getName(),
            'Example Object Label', describe.getLabel()
        );
    }
}

fferpcore.Context contextExample = new ContextImpl();

fferpcore.Context.DisplayDescription description = contextExample.getDisplayDescription();

getPotentialChildren

global abstract List<fferpcore.Context.Source> getPotentialChildren()

This method returns a complete list of the fields on this particular SObject. Fields on related objects are not included. Each field is described as a fferpcore.Context.Source in the returned list. This method must be implemented by a class that implements Context.

Return Value

The potential children for this context.

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.

/** 
 * We will assume the following fields only on ExampleObject__c:
 * Name
 * Email__c
 * Phone__c
 * Address__c
 * In reality use this would return all standard Salesforce fields eg. CreatedById etc
 */
public class ContextImpl extends fferpcore.Context
{
    public override List<fferpcore.Context.Source> getPotentialChildren()
    {
        List<Source> ret = new List<Source>();
        Map<String, Schema.SObjectField> fieldMap = getFieldMap();
        for(String key : fieldMap.keySet())
        {
            ret.add(makeSource(fieldMap, key));
        }
        return ret;
    }

    private Source makeSource(Map<String, Schema.SObjectField> fieldMap, String key)
    {
        Schema.SObjectField field = fieldMap.get(key);
        if(field != null)
        {
            return new fferpcore.Context.SObjectSource(key, field);
        }
        return null;
    }
    ...
}

fferpcore.Context contextExample = new ContextImpl();

List<fferpcore.Context.Source> returnValue = contextExample.getPotentialChildren();

System.assertEquals(4, returnValue.size());

getSource

global abstract fferpcore.Context.Source getSource(String key)

This method looks up a source by its key. This method must be implemented by a class that implements Context.

Input Parameters

Name Type Description
key String The key should be the API name of the field you want to find.

Return Value

Look up a source by its key.

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.

/** 
 * We will assume the following fields only on ExampleObject__c:
 * Name
 * Email__c
 * Phone__c
 * Address__c
 * In actual use this would return all standard Salesforce fields eg. CreatedById etc
 */
public class ContextImpl extends fferpcore.Context
{
    public override Source getSource(String key)
    {
        return makeSource(getFieldMap(), key);
    }

    private Source makeSource(Map<String, Schema.SObjectField> fieldMap, String key)
    {
        Schema.SObjectField field = fieldMap.get(key);
        if(field != null)
        {
            return new fferpcore.Context.SObjectSource(key, field);
        }
        return null;
    }
    ...
}

fferpcore.Context contextExample = new ContextImpl();

fferpcore.Context.Source returnValue = contextExample.getSource('Name');

System.assertEquals('Name', returnValue.getKey());

fferpcore.Context.DisplayDescription

global inherited sharing class DisplayDescription implements ObjectIO.SerializableObject

A class that contains information about contexts and sources to be displayed on the user interface.

Properties

Name Type Description
elementType String A display name for the type of this this is. For example "SObject Field"
nameLabel String The label to use for the name. For example "API Name"
name String A short name by which this item is known. For example "Phone__c"
relationshipName String A short name by which this item is known when used as a relationship. For example "Phone__r"
descriptionLabel String The label to use for the description. For example "Label"
description String A longer more readable description of the item. For example "Work Phone Number"

Methods

DisplayDescription

global DisplayDescription(String elementType, String nameLabel, String name, String descriptionLabel, String description)

Constructs a Context.DisplayDescription.

Input Parameters

Name Type Description
elementType String The display name for the type this item relates to. For example, "SObject Field".
nameLabel String The label to use for the name. For example, "API Name".
name String A short name by which this item is known. For example, "Phone__c".
descriptionLabel String The label to use for the description. For example, "Label".
description String A longer, more readable description of the item. For example, "Work Phone Number".

DisplayDescription

global DisplayDescription(String elementType, String nameLabel, String name, String relationshipName, String descriptionLabel, String description)

Constructs a Context.DisplayDescription.

Input Parameters

Name Type Description
elementType String The display name for the type this item relates to. For example, "SObject Field".
nameLabel String The label to use for the name. For example, "API Name".
name String A short name by which this item is known. For example, "Phone__c".
relationshipName String A short name by which this item is known when used as a relationship. For example, "Phone__r".
descriptionLabel String The label to use for the description. For example, "Label".
description String A longer, more readable description of the item. For example, "Work Phone Number".

fferpcore.Context.SObjectContext

global virtual inherited sharing class SObjectContext extends Context implements VirtualDataObject.Accessible

An SObjectContext structure. This class/type extends Context.

This class implements the following interfaces:

Methods

SObjectContext

global SObjectContext()

The default is for internal use only and is not recommended for use. Use the constructor that takes SObjectType as an argument instead.

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.Context.SObjectContext context = new fferpcore.Context.SObjectContext();

SObjectContext

global SObjectContext(Schema.SObjectType type)

This constructor relates this object with a specific SObject type. The methods from this class will make use of that SObject type.

Input Parameters

Name Type Description
type Schema.SObjectType The SObject to which this context refers.

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.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

System.assertEquals('ExampleObject__c', context.getInitMemento());

getSObjectType

global SObjectType getSObjectType()

Return Value

The SObject type of this context.

getClass

global virtual override Type getClass()

This method is provided to support serialization to Javascript. This method returns the class type of the associated context.

Return Value

This service returns a Type 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.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

System.assertEquals(fferpcore.Context.SObjectContext.class, context.getClass());

getInitMemento

global virtual override String getInitMemento()

This method is provided to support serialization to Javascript. This method returns a string that describes the SObject with which the context is associated.

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.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

System.assertEquals('ExampleObject__c', context.getInitMemento());

initialise

global virtual override void initialise(String memento)

This method is provided to support deserialization from Javascript. This method creates a new context ready for use.

Input Parameters

Name Type Description
memento String The name of the SObject to create.

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.Context.SObjectContext context = new fferpcore.Context.SObjectContext();

context.initialise('ExampleObject__c');

System.assertEquals('ExampleObject__c', context.getInitMemento());

getDisplayDescription

global virtual override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display.

Return Value

This service returns a DisplayDescription 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.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

fferpcore.Context.DisplayDescription description = context.getDisplayDescription();

getPotentialChildren

global virtual override List<fferpcore.Context.Source> getPotentialChildren()

This method returns a complete list of the fields on this particular SObject that are in the form of a Context.Source.

Return Value

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

/**
 * We will assume the following fields only on ExampleObject__c:
 * Name
 * Email__c
 * Phone__c
 * Address__c
 * In reality use this would return all standard Salesforce fields eg. CreatedById etc
 */

fferpcore.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

List<fferpcore.Context.Source> returnValue = context.getPotentialChildren();

System.assertEquals(4, returnValue.size());

getSource

global virtual override fferpcore.Context.Source getSource(String key)

This method looks up a source by using its key if that key is related to the current context.

Input Parameters

Name Type Description
key String The key should be the API name of the field you want to find

Return Value

This service returns a Source 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.

/**
 * We will assume the following fields only on ExampleObject__c:
 * Name
 * Email__c
 * Phone__c
 * Address__c
 * In actual use this would return all standard Salesforce fields eg. CreatedById etc
 */

fferpcore.Context.SObjectContext context = new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType);

fferpcore.Context.Source returnValue = context.getSource('Name');

System.assertEquals('Name', returnValue.getKey());

fferpcore.Context.Source

global abstract inherited sharing class Source

This class represents the source of information for each of the nodes. This is an abstract class and all abstract methods must be implemented for use.

Methods

getKey

global virtual String getKey()

This method returns the key by which the originating fferpcore.Context knows this Source. If the source is standalone like StaticSource or PassthroughSource this method returns null. If this source can be specified from the context like SObjectSource then the key associated with this source is returned.

Return Value

The key by which the originating Context knows this Source, or null for the Root Source or a Source that stands alone such as Static or Passthrough Sources.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    ...
}

SourceImpl source = new SourceImpl();

System.assertEquals(null, source.getKey());

getDisplayDescription

global abstract fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method must be implemented by a class that implements Context.Source.

Return Value

Information for display of this Source to the user.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    public override fferpcore.Context.DisplayDescription getDisplayDescription()
    {
        Schema.DescribeSObjectResult describe = ExampleObject.describe();
        return new fferpcore.Context.DisplayDescription(
            'SourceImpl',
            'ExampleObject__c', describe.getName(),
            'Example Object Label', describe.getLabel()
        );
    }
}

fferpcore.Context.Source sourceExample = new SourceImpl();

fferpcore.Context.DisplayDescription description = sourceExample.getDisplayDescription();

setInputContext

global virtual void setInputContext(fferpcore.Context parent)

This method passes the parent context down to any potential child sources. The default behavior of this method is to do nothing. This is required for some sources. An example Source which does this is Context.PassthroughSource.

Input Parameters

Name Type Description
parent fferpcore.Context The context of the parent to pass down.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    public fferpcore.Context m_inputContext;
    public override void setInputContext(fferpcore.Context context)
    {
        m_inputContext = context;
    }

    public override fferpcore.Context getOutputContext()
    {
        return m_inputContext;
    }
    ...
}

fferpcore.Context.Source sourceExample = new SourceImpl();

sourceExample.setInputContext(new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType));

ferpcore.Context.SObjectContext context = sourceExample.getOutputContext();

prepare

global virtual fferpcore.DataSource prepare(fferpcore.DataSource dataSource)

This method prepares the input fferpcore.DataSource so that it knows which data is required to build this Source. If the fferpcore.DataSource contains complex data, the fferpcore.DataSource for its child data is returned. Otherwise null is returned.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource that represents the source of information from which to populate the fields in the message.

Return Value

The datasource for child data if this DataSource returns complex data. Otherwise null.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    public override fferpcore.DataSource prepare(fferpcore.DataSource dataSource)
    {
        dataSource.requireField(m_field);
        if(canGetComplexData())
        {
            return dataSource.requireLookupField(m_field);
        }
        return null;
    }
}

public class DataSourceImpl extends fferpcore.DataSource
{
    ...
}

fferpcore.Context.Source sourceExample = new SourceImpl();

DataSourceImpl data = sourceExample.prepare(new DataSourceImpl());

prepare

global virtual fferpcore.DataSource prepare(fferpcore.DataSource dataSource, Intent intent)

Prepare the given fferpcore.DataSource so this Source can obtain and update the necessary data.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource to be prepared.
intent Intent For what purpose is this source being used? Read, write, or both.

Return Value

The DataSource for the lookup or child data. Otherwise null.

canGetScalarData

global virtual Boolean canGetScalarData()

This method returns true if this source is capable of providing Scalar data, e.g. 'Foo'. By default, this method returns false. An example Source which overrides this method is Context.StaticSource.

Return Value

True if this source is capable of providing Scalar data.

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.

//In this example we will not override this method
public class SourceImpl extends fferpcore.Context.Source
{
    ...
}

fferpcore.Context.Source sourceExample = new SourceImpl();

System.assert(!sourceExample.canGetScalarData());

getScalarDataType

global virtual fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source. By default, this method returns null. An example Source which overrides this method is Context.StaticSource.

Return Value

The data type name for the scalar data.

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.

//In this example this method returns a datatype for an Integer with a size of 10 with no precision
public class SourceImpl extends fferpcore.Context.Source
{
    public override fferpcore.DataType getScalarDataType()
    {
        return new fferpcore.DataType(Schema.DisplayType.Integer, 10, null);
    }
}

fferpcore.Context.Source sourceExample = new SourceImpl();

fferpcore.DataType dataType = sourceExample.getScalarDataType();

System.assertEquals('Integer(10)', dataType.toString());

getData

global virtual Object getData(fferpcore.DataSource.Row row)

This method returns the scalar data relating to the DataSource.Row.
This is only applicable if canGetScalarData is true.
An example Source which does this is Context.StaticSource.

Return Value

Scalar data relating to the DataSource.Row. Only applicable if canGetScalarData is true.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    private Object m_data;

    SourceImpl(Object data)
    {
        m_data = data;
    }

    public override Object getData(fferpcore.DataSource.Row row)
    {
        return m_data;
    }
}

public class DataSourceImpl extends fferpcore.DataSource
{
    ...

    public class RowImpl extends fferpcore.DataSource.Row
    {
        RowImpl()
        {

        }
        ...
    }
}

fferpcore.MessageDescription.Node node = new fferpcore.MessageDescription.ScalarNode(new SourceImpl('Example'));

fferpcore.Context.Source exampleSource = node.getSource();

getData

global virtual Object getData(fferpcore.VirtualDataObject.Record record)

This method returns the scalar data relating to the VirtualDataObject.Record.
This is only applicable if canGetScalarData is true.
An example source that does this is Context.StaticSource.

Return Value

Scalar data relating to the VirtualDataObject.Record. Only applicable if canGetScalarData is true.

getDataOptional

global virtual fferpcore.OptionalValue getDataOptional(fferpcore.DataSource.Row row)

Input Parameters

Name Type Description
row fferpcore.DataSource.Row The DataSource.Row containing the data.

Return Value

Null if the row has no value, otherwise an OptionalValue containing the data.

canGetComplexData

global virtual Boolean canGetComplexData()

This method returns whether this source is capable of providing complex data for child nodes. By default, this method returns false.

Return Value

True if this source is capable of providing complex data for child nodes.

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.

//In this example we will use a source which is similar to SObjectSource
public class SourceImpl extends fferpcore.Context.Source
{
    public override Boolean canGetComplexData()
    {
        return true;
    }
}

fferpcore.Context.Source source = SourceImpl();

System.assert(source.canGetComplexData());

canGetListData

global virtual Boolean canGetListData()

This method returns whether a source is capable of providing data for list nodes. By default, this method returns false.

Return Value

True if this source is capable of providing data for list nodes.

getOutputContext

global virtual fferpcore.Context getOutputContext()

This method returns the current context of this source. For example, an SObjectSource will return the current SObject that is associated with the source. In order for this to be returned, the class itself must be able to support complex data. By default, this method returns null.

Return Value

Context describing the complex data. Only applicable if canGetComplexData is true.

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.

//In this example we will use a source which is similar to SObjectSource
public class SourceImpl extends fferpcore.Context.Source
{
    private fferpcore.Context m_outputContext;

    public override fferpcore.Context getOutputContext()
    {
        if(m_outputContext == null)
        {
            m_outputContext = canGetComplexData() ?
                new fferpcore.Context.SObjectContext(
                //The SObject we want + the field we use to uniquely identify
                ) : null;
        }
        return m_outputContext;
    }
}

public fferpcore.MessageDescription.Node getBody()
{
    return new fferpcore.MessageDescription.MapNode(new SourceImpl());
}

fferpcore.MessageDescription description = new fferpcore.MessageDescription(
            new fferpcore.Context.SObjectSource(HCMFakeWorker__c.EmployeeId__c),
            getBody(),
            new fferpcore.Context.SObjectContext(Accout.SObjectType)
        );

fferpcore.Context context = description.getBody().getSource().getOutputContext();

getChildRow

global virtual fferpcore.DataSource.Row getChildRow(fferpcore.DataSource.Row inputRow)

This method should be implemented to return a wrapper for the field to which this source refers.
By default, this returns the input row.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

Row for children to build from. Only applicable if canGetComplexData is true.

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.

/**
 * Without providing an implementation for this method, this method will return the input row despite any modifications to the object.
 */
public class ExampleSource extends fferpcore.Context.Source
{
    //Doesn't override getChildRow

    //implements required methods
}

fferpcore.Context.Source mySource = new ExampleSource();

fferpcore.DataSource.Row inputRow = getRow(); //get row from somewhere
fferpcore.DataSource.Row returnedRow = mySource.getChildRow(inputRow);

System.assertEquals(row, returnedRow)

getChildRow

global virtual fferpcore.VirtualDataObject.Record getChildRow(fferpcore.VirtualDataObject.Record record)

This method should be implemented to return a wrapper for the field to which this source refers.
By default, this returns the input record.

Input Parameters

Name Type Description
record fferpcore.VirtualDataObject.Record The current record on the DataSource from which to get the information.

Return Value

Record for children to build from. Only applicable if canGetComplexData is true.

getChildRowOptional

global virtual fferpcore.OptionalValue getChildRowOptional(fferpcore.DataSource.Row inputRow)

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

Null if the row has no child row, otherwise an OptionalValue containing the data.

getListRows

global virtual Iterator<fferpcore.DataSource.Row> getListRows(fferpcore.DataSource.Row inputRow)

This method should be implemented to return an iterator of rows for the child records that this source references.
By default, this returns null.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

Iterator of child rows to build from. Only applicable if canGetListData is true.

getListRows

global virtual fferpcore.VirtualDataObject.RecordList getListRows(fferpcore.VirtualDataObject.Record record)

This method should be implemented to return a record list for the child records that this source references.
By default, this returns null.

Input Parameters

Name Type Description
record fferpcore.VirtualDataObject.Record The current record from which to get the information.

Return Value

Record list to build from. Only applicable if canGetListData is true.

getType

global abstract fferpcore.Context.SourceType getType()

This method should be used as an indication of whether this is one of the Foundations static sources, or whether it came from a Context. This method must be implemented by a class that implements Context.Source.

Return Value

Indication of whether this is one of the Foundations static sources, or whether it came from a Context.

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.

public class SourceImpl extends fferpcore.Context.Source
{
    public override fferpcore.Context.SourceType getType()
    {
        return fferpcore.Context.SourceType.FROM_CONTEXT;
    }
}

fferpcore.Context.Source sourceExample = new SourceImpl();

System.assertEquals(fferpcore.Context.SourceType.FROM_CONTEXT, sourceExample.getType());

hasAccess

global virtual Boolean hasAccess()

Checks whether the current user has access to this data. For example, if this Source represents an SObjectField then the user must have read access to that field. The default implementation of this method returns true.

Return Value

True if the current user would normally have access to this data.

putData

global virtual void putData(fferpcore.DataSource.Row row, Object data)

Set the data at this Source on the given DataSource.Row.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row Row on which to update the data.
data Object Data to be set.

addError

global virtual void addError(fferpcore.DataSource.Row row, String errorMessage)

Add an error at this Source on the given DataSource.Row.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row Row on which to set the error.
errorMessage String Description of the error.

getAsAccessible

global virtual fferpcore.VirtualDataObject.Accessible getAsAccessible()

Return Value

The accessibility of the Source.

fferpcore.Context.SObjectSource

global inherited sharing class SObjectSource extends Source

The source of the data is a field on an SObject. fferpcore.Message descriptions will normally be created using this type.

This class extends fferpcore.Context.Source

Methods

SObjectSource

global SObjectSource(Schema.SObjectField field)

This constructor a field which can be used to associate this source with a particular field on an SObject.

Input Parameters

Name Type Description
field Schema.SObjectField The field on the SObject we want to associate this source 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.

fferpcore.Context.SObjectSource source = new fferpcore.Context.SObjectSource(ExampleObject__c.ExampleField__c);

getKey

global override String getKey()

This method returns the key by which the originating fferpcore.Context knows this Source. This method is used by the Publication Description user interface.

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.

//Inside your PublicationDescriber Implementation
global class HCMResourceUpdateDescriber extends fferpcore.PublicationDescriber
{
    private static final SObjectType SOBJECT_TYPE = HCMFakeWorker__c.SObjectType;

    global override fferpcore.MessageDescription describe()
    {
        return new fferpcore.MessageDescription(
            getCorrelation(),
            getBody(),
            new fferpcore.Context.SObjectContext(SOBJECT_TYPE)
        );
    }

    public fferpcore.Context.Source getCorrelation()
    {
        return new fferpcore.Context.SObjectSource(HCMFakeWorker__c.EmployeeId__c);
    }

    public fferpcore.MessageDescription.Node getBody()
    {
        return new fferpcore.MessageDescription.MapNode()
            .withChild('Example', new fferpcore.MessageDescription.ScalarNode(new fferpcore.Context.SObjectSource('Key', ExampleObject__c.Field__c)));
    }
}

fferpcore.MessageDescription description = new HCMResourceUpdateDescriber().describe();
fferpcore.MessageDescription.MapNode body = (fferpcore.MessageDescription.MapNode) description.getBody();

System.assertEquals(1, body.getChildren().size());
System.assertEquals('Key', body.getChildren()[0].getSource().getKey());

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription 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.Context.SObjectSource source = new fferpcore.Context.SObjectSource(ExampleObject__c.FieldExample__c);

fferpcore.Context.DisplayDescription description = source.getDisplayDescription();

canGetScalarData

global override Boolean canGetScalarData()

This method returns true since an SObjectField can always return scalar data. Objects specified as a lookup appear as IDs. This is a method which has been written for use on the Publication user interface.

Return Value

This service returns a Boolean 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.Context.SObjectSource source = new fferpcore.Context.SObjectSource(Account.Name);

System.assert(source.canGetScalarData());

getScalarDataType

global override fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source.

Return Value

This service returns a DataType 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.

//We will assume EmployeeId__c is a string of length 5
fferpcore.Context.SObjectSource source = new fferpcore.Context.SObjectSource(HCMFakeWorker__c.EmployeeId__c);

System.assertEquals('String(5)', source.getScalarDataType());

canGetComplexData

global override Boolean canGetComplexData()

This method returns whether or not this source is capable of providing complex data for child nodes.

Return Value

This service returns a Boolean 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.

public fferpcore.MessageDescription.Node getBody()
{
    return new fferpcore.MessageDescription.MapNode(new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Name));
}

fferpcore.MessageDescription description = new fferpcore.MessageDescription(
            new fferpcore.Context.SObjectSource(HCMFakeWorker__c.EmployeeId__c),
            getBody(),
            new fferpcore.Context.SObjectContext(SOBJECT_TYPE)
        );

System.assert(!description.getBody().getSource().canGetComplexData());

getOutputContext

global override fferpcore.Context getOutputContext()

This method returns the context that this source is currently in. An SObjectSource will return the current SObject that is associated with the source.

Return Value

This service returns a Context 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.

public fferpcore.MessageDescription.Node getBody()
{
    return new fferpcore.MessageDescription.MapNode(new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Name));
}

fferpcore.MessageDescription description = new fferpcore.MessageDescription(
            new fferpcore.Context.SObjectSource(HCMFakeWorker__c.EmployeeId__c),
            getBody(),
            new fferpcore.Context.SObjectContext(SOBJECT_TYPE)
        );

fferpcore.Context context = description.getBody().getSource().getOutputContext();

getChildRow

global override fferpcore.DataSource.Row getChildRow(fferpcore.DataSource.Row inputRow)

This method returns a wrapper for the field to which this source refers. For example, if this source is in reference to the name field of an SObject, the information from that field will be returned.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

This service returns a DataSource.Row 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.

public class RowExample extends DataSource.Row
{
    private SObject m_record;
    private DataSourceExample m_DataSource;

    //This method will return a DataSource containing information about the field we are trying 
    //to look at
    public override fferpcore.DataSource.Row getRelation(SObjectField field)
    {
        Id objectId = (Id) m_record.get(field);

        //We will assume this class exists
        DataSourceExample example = 
        m_DataSource.m_relationalDataSources.get(field);

        return example.getRow(objectId);
    }
    ...
}

RowExample row = new RowExample();

fferpcore.Context.SObjectSource source = new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Name);

fferpcore.DataSource.Row returnedRow = source.getChildRow(row);

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is an SObjectSource without having to perform type checks on the object.

Return Value

This service returns a SourceType 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.Context.SObjectSource source = new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Name);

if(source.getType() == fferpcore.Context.SourceType.FROM_CONTEXT)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.LITERAL)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.PASSTHROUGH)
{
    ...
}

prepare

global override fferpcore.DataSource prepare(fferpcore.DataSource dataSource)

This method prepares the input fferpcore.DataSource so that it knows which fields are required to build the message. It returns the fferpcore.DataSource if the source is a reference to another SObject. Otherwise, it returns null.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource that represents the source of information from which to populate the fields in the message.

Return Value

This service returns a DataSource 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.

public class DataSourceImpl extends fferpcore.DataSource
{
    ...
}

fferpcore.Context.SObjectSource sourceExample = new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Name);

DataSourceImpl data = sourceExample.prepare(new DataSourceImpl());

System.assertEquals(null, data);

getData

global override Object getData(fferpcore.DataSource.Row row)

This method returns the data relating to the DataSource.Row. It reads the information about the field specified in the initial constructor of an SObjectSource and returns it. If the field cannot be found, it returns null.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row A wrapper to access the data.

Return Value

This service returns an Object 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.

//Department__c is a relationship field on the HCMFakeWorker__c object
public class DataSourceImpl extends fferpcore.DataSource
{
    ...

    public class RowImpl extends fferpcore.DataSource.Row
    {
        RowImpl()
        {
            ...
            //If this can't find information for this source
            return null;
        }
        ...
    }
}

fferpcore.Context.SObjectSource sourceExample1 = new fferpcore.Context.SObjectSource(HCMFakeWorker__c.Department__c);
DataSourceImpl data = sourceExample1.prepare(new DataSourceImpl());

fferpcore.Context.SObjectSource sourceExample2 = new fferpcore.Context.SObjectSource(Department__c.Name);
sourceExample2.prepare(data);

Iterator<DataSourceImpl.RowImpl> it = data.runQuery();

DataSourceImpl.RowImpl row = it.next();

Object obj = sourceExample1.getData(row);

fferpcore.Context.StaticSource

global inherited sharing class StaticSource extends Source

Source is a static value that is defined by the publication. fferpcore.PublicationDescriber must provide a description as it cannot be automatically generated.

This class extends fferpcore.Context.Source

Methods

StaticSource

global StaticSource(String description)

This constructor creates a StaticSource with no data. It can be used to put an empty node in the message.

Input Parameters

Name Type Description
description String The name of this source.

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.

/**
 * Create the description for our message
 */
public fferpcore.MessageDescription.Node getBody()
{
    return new fferpcore.MessageDescription.MapNode()
        .withChild(UpdateResourceMessage.LINK_CONTROL_KEY, fferpcore.LinkControlBody.getOutgoingDescriptionNode(PSAFakeResource__c.SObjectType, 'PSA'))
        .withScalarChild(UpdateResourceMessage.NAME_KEY, PSAFakeResource__c.Name)
        .withChild(UpdateResourceMessage.ADDRESS_KEY, new fferpcore.MessageDescription.MapNode()
            .withScalarChild(UpdateResourceMessage.ADDRESS_LINE_1_KEY, PSAFakeResource__c.Address1__c)
            .withScalarChild(UpdateResourceMessage.ADDRESS_LINE_2_KEY, PSAFakeResource__c.Address2__c))
        .withScalarChild(new fferpcore.Context.StaticSource('Placeholder'))
        .withScalarChild(new fferpcore.Context.StaticSource('Goodbye', 'Message End'));
}

StaticSource

global StaticSource(Object data, String description)

This constructor creates a static source with the specified data and description. It can be used to provide constant values in messages.

Input Parameters

Name Type Description
data Object The data value for this node.
description String The name of this source.

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.

/**
 * Create the description for our message
 */
public fferpcore.MessageDescription.Node getBody()
{
    return new fferpcore.MessageDescription.MapNode()
        .withChild(UpdateResourceMessage.LINK_CONTROL_KEY, fferpcore.LinkControlBody.getOutgoingDescriptionNode(PSAFakeResource__c.SObjectType, 'PSA'))
        .withScalarChild(UpdateResourceMessage.NAME_KEY, PSAFakeResource__c.Name)
        .withChild(UpdateResourceMessage.ADDRESS_KEY, new fferpcore.MessageDescription.MapNode()
            .withScalarChild(UpdateResourceMessage.ADDRESS_LINE_1_KEY, PSAFakeResource__c.Address1__c)
            .withScalarChild(UpdateResourceMessage.ADDRESS_LINE_2_KEY, PSAFakeResource__c.Address2__c))
        .withScalarChild(new fferpcore.Context.StaticSource('Placeholder'))
        .withScalarChild(new fferpcore.Context.StaticSource('Goodbye', 'Message End'));
}

getKey

global override String getKey()

On a StaticSource, this method always returns null. On other types of source, this method returns the key by which the originating fferpcore.Context knows this Source.

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.Context.StaticSource source = new fferpcore.Context.StaticSource(6, 'Sides on a cube');
System.assertEquals(null, source.getKey());

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription 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.Context.StaticSource source = new fferpcore.Context.StaticSource('blue', 'Example color');

fferpcore.Context.DisplayDescription description = source.getDisplayDescription();

canGetScalarData

global override Boolean canGetScalarData()

Returns true to indicate this node can hold scalar type data.

Return Value

The default implementation of this method returns true.

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.Context.StaticSource source = new fferpcore.Context.StaticSource(6, 'Sides on a cube');
System.assertEquals(true, source.canGetScalarData());

getScalarDataType

global override fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source. As a StaticSource can hold data of any type (the constructor takes an Object parameter), the default return value is 'new DataType(Schema.DisplayType.anytype, null, null)'.

Return Value

This service returns a DataType 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.Context.StaticSource source = new fferpcore.Context.StaticSource(6, 'Sides on a cube');
DataType dt = source.getScalarDataType();
System.debug('Data is type: ' + String.valueOf(dt));

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a StaticSource without having to perform type checks on the object.

Return Value

This service returns a SourceType 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.Context.StaticSource source = new fferpcore.Context.StaticSource('Goodbye', 'Message End');

if(source.getType() == fferpcore.Context.SourceType.FROM_CONTEXT)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.LITERAL)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.PASSTHROUGH)
{
    ...
}

getData

global Object getData()

This method returns the data this StaticSource was constucted with.

Return Value

This service returns an Object 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.Context.StaticSource source = new fferpcore.Context.StaticSource(6, 'Sides on a cube');
System.assertEquals(6, source.getData());

getDescription

global String getDescription()

Returns the description specified when this StaticSource was constructed.

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.

/**
 * Find some details of the provided StaticSources
 */
public void logDetails(List<fferpcore.Context.StaticSource> sources)
{
    for (fferpcore.Context.StaticSource source : sources)
    {
        System.debug(source.getDescription + ': ' + String.valueOf(source.getData()))
    }
}

getData

global override Object getData(fferpcore.DataSource.Row row)

This method returns the data this StaticSource was constucted with. The fferpcore.DataSource.Row parameter has no effect.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row This parameter is ignored.

Return Value

This service returns an Object 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.Context.StaticSource source = new fferpcore.Context.StaticSource(6, 'Sides on a cube');
fferpcore.DataSource.Row row = new DataSourceImpl.RowImpl();
System.assertEquals(6, source.getData(row));

fferpcore.Context.PassthroughSource

global inherited sharing class PassthroughSource extends Source

A PassthroughSource structure. A Passthrough source retains and passes the context received to any nodes beneath it. Passthrough sources can only be put onto MapNodes. This class/type extends Context.Source.

This class extends fferpcore.Context.Source

Methods

PassthroughSource

global PassthroughSource()

The default constructor for a PassthroughSource.

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.MessageDescription.MapNode node = new fferpcore.MessageDescription.MapNode(new fferpcore.Context.PassthroughSource());

System.assertEquals(fferpcore.Context.SourceType.PASSTHROUGH, node.getSource().getType());

PassthroughSource

global PassthroughSource(String description)

The default constructor for a PassthroughSource.

Input Parameters

Name Type Description
description String The description we want to give to this source.

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.MessageDescription.MapNode node = new fferpcore.MessageDescription.MapNode(new fferpcore.Context.PassthroughSource('Foo'));

fferpcore.Context.Source source = node.getSource();

System.assertEquals(fferpcore.Context.SourceType.PASSTHROUGH, source.getType());

System.assertEquals('Foo', source.getDisplayDescription().description);

getKey

global override String getKey()

This method returns null as a passthrough source is not known by the current context. This method will return null no matter what.

Return Value

The key by which the originating Context knows this Source, or null for the Root Source or a Source that stands alone such as Static or Passthrough Sources.

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

Information for display of this Source to the user.

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.Context.StaticSource source = new fferpcore.Context.StaticSource('blue', 'Example color');

fferpcore.Context.DisplayDescription description = source.getDisplayDescription();

prepare

global override fferpcore.DataSource prepare(fferpcore.DataSource parentSource)

This method returns the same datasource that was input. This is because a Passthrough Source retains the same context that was given to it so the fferpcore.DataSource does not have to do any work.

Input Parameters

Name Type Description
parentSource fferpcore.DataSource The DataSource that we want to get setup to get information from.

Return Value

This service returns a DataSource 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.

This method always returns the input DataSource despite what happens to the object

setInputContext

global override void setInputContext(fferpcore.Context ctx)

This method passes the parent context down to any potential child sources.

Input Parameters

Name Type Description
ctx fferpcore.Context The context of the parent we want to pass down.

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.Context.PassthroughSource sourceExample = new fferpcore.Context.PassthroughSource();

sourceExample.setInputContext(new fferpcore.Context.SObjectContext(ExampleObject__c.SObjectType));

ferpcore.Context.SObjectContext context = sourceExample.getOutputContext();

canGetComplexData

global override Boolean canGetComplexData()

This method returns true since a Passthrough Source is capable of providing complex data for any child nodes. Unlike StaticSources which cannot provide complex data as they simply represent a fixed value.

Return Value

True if this source is capable of providing complex data for child nodes.

getOutputContext

global override fferpcore.Context getOutputContext()

Returns the output context associated with this node. For a PassthroughSource, the output context is always the same as the input context.

Return Value

Context describing the complex data. Only applicable if canGetComplexData is true.

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.Context.PassthroughSource source = new fferpcore.Context.PassthroughSource('Example');
fferpcore.Context.SObjectContext context = new fferpcore.Context.SObjectContext(Account.SObjectType);
source.setInputContext(context);
System.assertEquals(context, source.getOutputContext());

getChildRow

global override fferpcore.DataSource.Row getChildRow(fferpcore.DataSource.Row inputRow)

Returns the fferpcore.DataSource.Row for children to build from. This is only applicable if canGetComplexData is true. The default behavior is to return the input parameter without modification.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

Row for children to build from. Only applicable if canGetComplexData is true.

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.

//When called on a PassthroughSource, getChildRow always returns the input parameter.

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a PassthroughSource without having to perform type checks on the object.

Return Value

This service returns a SourceType 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.Context.PassthroughSource source = new fferpcore.Context.PassthroughSource('pts');

if(source.getType() == fferpcore.Context.SourceType.FROM_CONTEXT)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.LITERAL)
{
    ...
}
else if (source.getType() == fferpcore.Context.SourceType.PASSTHROUGH)
{
    ...
}

fferpcore.Context.CorrelationSource

global inherited sharing class CorrelationSource extends Source

The source of the data is a field on an SObject. Unless empty, when it uses an additional fallback field.

This class extends fferpcore.Context.Source

Methods

CorrelationSource

global CorrelationSource(SObjectField field, SObjectField fallbackField)

Construct the source using the primary and fallback fields from an SObject.

Input Parameters

Name Type Description
field SObjectField The field on the SObject we want to associate this source with.
fallbackField SObjectField The fallback field to use if the original field is empty.

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription object.

canGetScalarData

global override Boolean canGetScalarData()

Returns true to indicate this node can hold scalar type data.

Return Value

The default implementation of this method returns true.

getScalarDataType

global override fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source.

Return Value

This service returns a DataType object.

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a CorrelationSource without having to perform type checks on the object.

Return Value

This service returns a SourceType object.

prepare

global override fferpcore.DataSource prepare(fferpcore.DataSource dataSource)

This method prepares the input fferpcore.DataSource so that it knows which fields are required to build the message.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource that represents the source of information from which to populate the fields in the message.

Return Value

This service returns a DataSource object.

getData

global override Object getData(fferpcore.DataSource.Row row)

This method returns the data relating to the DataSource.Row. It reads the information about the field specified in the initial constructor. If the field is empty, it instead reads the fallback field. If the field cannot be found, it returns null.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row A wrapper to access the data.

Return Value

This service returns an Object object.

fferpcore.Context.CompositeSource

global inherited sharing class CompositeSource extends Source

Contains the source of data resulting from several sources chained together. This can be used to obtain data from related records using multiple lookup fields.

This class extends fferpcore.Context.Source

Methods

CompositeSource

global CompositeSource(List<Schema.SObjectField> fields)

Constructs a CompositeSource.

Input Parameters

Name Type Description
fields List<Schema.SObjectField> List of fields that represent the path through an SObject hierarchy.

CompositeSource

global CompositeSource(List<fferpcore.Context.Source> sources)

Constructs a CompositeSource.

Input Parameters

Name Type Description
sources List<fferpcore.Context.Source> Sources to chain together.

getKey

global override String getKey()

This method returns the key by which the originating fferpcore.Context identifies this Source. This method is used by the Publication Description user interface.

Return Value

This service returns a String object.

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription object.

prepare

global override fferpcore.DataSource prepare(fferpcore.DataSource dataSource)

This method prepares the input fferpcore.DataSource so that it knows which fields are required to build the message.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource that represents the source of information from which to populate the fields in the message.

Return Value

This service returns a DataSource object.

canGetScalarData

global override Boolean canGetScalarData()

This method returns whether this source can return scalar data.

Return Value

This service returns a Boolean object.

getScalarDataType

global override fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source.

Return Value

This service returns a DataType object.

getData

global override Object getData(fferpcore.DataSource.Row row)

This method returns the data relating to the DataSource.Row.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row A wrapper to access the data.

Return Value

This service returns an Object object.

canGetComplexData

global override Boolean canGetComplexData()

This method returns whether this source is capable of providing complex data for child nodes.

Return Value

This service returns a Boolean object.

getOutputContext

global override fferpcore.Context getOutputContext()

This method returns the context that this source is currently in. A CompositeSource returns the SObject that is associated with the last source.

Return Value

This service returns a Context object.

getChildRow

global override fferpcore.DataSource.Row getChildRow(fferpcore.DataSource.Row inputRow)

This method returns a wrapper for the field to which this source refers.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

This service returns a DataSource.Row object.

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a CompositeSource without having to perform type checks on the object.

Return Value

This service returns a SourceType object.

fferpcore.Context.ListSource

global inherited sharing class ListSource extends Source

The source of the data is a list of child records on an SObject.

This class extends fferpcore.Context.Source

Methods

ListSource

global ListSource(SObjectType childType, SObjectField childLookupField)

Construct a ListSource.

Input Parameters

Name Type Description
childType SObjectType The SObjectType of the child records.
childLookupField SObjectField The SObjectField on the child looking up to the parent.

ListSource

global ListSource(Schema.ChildRelationship childRelationship)

Construct a ListSource.

Input Parameters

Name Type Description
childRelationship Schema.ChildRelationship The ChildRelationship between the child records and parent.

withFilter

global fferpcore.Context.ListSource withFilter(fferpcore.PublicationMatcher filter)

Provides a fferpcore.PublicationMatcher that is used to filter the child records added to the message.

Input Parameters

Name Type Description
filter fferpcore.PublicationMatcher The PublicationMatcher that each child record must match.

Return Value

The original ListSource instance. This enables further methods to be invoked.

withParentType

global fferpcore.Context.ListSource withParentType(SObjectType parentType)

Provides a parent object type. This is necessary for relationships with ambiguous lookup fields. For example, the ParentId field on the Attachment object.

Input Parameters

Name Type Description
parentType SObjectType The SObjectType of the parent records.

Return Value

The original ListSource instance. This enables further methods to be invoked.

getKey

global override String getKey()

This method returns the key by which the originating fferpcore.Context knows this Source. This method is used by the Publication Description user interface.

Return Value

This service returns a String object.

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription object.

canGetListData

global override Boolean canGetListData()

This method returns whether or not a source is capable of providing data for list nodes.

Return Value

This service returns a Boolean object.

getOutputContext

global override fferpcore.Context getOutputContext()

This method returns the context that this source is currently in. A ListSource will return the child SObject that is associated with the source.

Return Value

This service returns a Context object.

getListRows

global override Iterator<fferpcore.DataSource.Row> getListRows(fferpcore.DataSource.Row inputRow)

This method should be implemented to return an iterator of rows for the child records that this source is in reference to.

Input Parameters

Name Type Description
inputRow fferpcore.DataSource.Row The current row on the DataSource from which to get the information.

Return Value

Iterator of child rows to build from.

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a ListSource without having to perform type checks on the object.

Return Value

This service returns a SourceType object.

prepare

global override fferpcore.DataSource prepare(fferpcore.DataSource dataSource)

This method prepares the input fferpcore.DataSource so that it knows which fields are required to build the message.

Input Parameters

Name Type Description
dataSource fferpcore.DataSource The DataSource that represents the source of information from which to populate the fields in the message.

Return Value

This service returns a DataSource object.

fferpcore.Context.MapSource

global inherited sharing class MapSource extends Source implements ObjectIO.ActivatableObject

MapSource represents a scalar value that is accessed from a fferpcore.DataSource using a string key. When constructing a message, a value with the key of this source can be given to a custom DataSource.

Methods

MapSource

global MapSource(String key, String description, fferpcore.DataType dataType)

This constructor creates a static source with the specified data and description. It can be used to provide constant values in messages.

Input Parameters

Name Type Description
key String An identifier to look for in the fferpcore.DataSource to access data.
description String The name of this source.
dataType fferpcore.DataType The data type for the data associated with this source.

getKey

global override String getKey()

This method returns the key by which the originating fferpcore.Context knows this Source. This method is used by the Publication Description user interface.

Return Value

This service returns a String object.

getDescription

global String getDescription()

This method returns the description of this Source. This method is used by the Publication Description user interface.

Return Value

This service returns a String object.

getDisplayDescription

global override fferpcore.Context.DisplayDescription getDisplayDescription()

This method returns information about the source to display. This method is used by the user interface to display information about the source.

Return Value

This service returns a DisplayDescription object.

canGetScalarData

global override Boolean canGetScalarData()

This method returns true since the data represented is scalar.

Return Value

This service returns a Boolean object.

getScalarDataType

global override fferpcore.DataType getScalarDataType()

This method returns the data type name for the scalar data associated with this source.

Return Value

This service returns a DataType object.

getType

global override fferpcore.Context.SourceType getType()

This method is used as an indication that this source is a MapSource without having to perform type checks on the object.

Return Value

This service returns a SourceType object.

getData

global override Object getData(fferpcore.DataSource.Row row)

This method returns the data relating to the DataSource.Row. Information about the field specified in the initial constructor of an SObjectSource is read and returned. If the field cannot be found, the method returns null.

Input Parameters

Name Type Description
row fferpcore.DataSource.Row A wrapper to access the data.

Return Value

This service returns an Object object.

fferpcore.Context.FallbackSource

global inherited sharing class FallbackSource extends Source

A dynamic source of data that uses the first source in the list that has a value other than null.

This class extends fferpcore.Context.Source

Methods

FallbackSource

global FallbackSource(List<fferpcore.Context.Source> sources)

Construct a FallbackSource with the given sources.

Input Parameters

Name Type Description
sources List<fferpcore.Context.Source> List of sources to search for a value.
© Copyright 2009–2021 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.