Reporting API Documentation

ffr.CommonService

global with sharing class CommonService

Encapsulates all service layer logic for Common functionality. For more guidelines and details see https://developer.salesforce.com/page/Apex_Enterprise_Patterns_-_Service_Layer

Date

2016

Methods

lookup

global static List<ffr.CommonService.Identity> lookup(String targetObject, String namePrefix)

Retrieves all indentities of the given object

Input Parameters

Name Type Description
targetObject String The name of the object
namePrefix String The query string to match to

Return Value

This service returns a list of c2g.CommonService.Identity objects.

selectIdentitiesByIds

global static List<ffr.CommonService.Identity> selectIdentitiesByIds(String targetObject, Set<ID> ids)

Retrieves indentities of the given object with ids in given ids

Input Parameters

Name Type Description
targetObject String The name of the object
ids Set<ID> The ids of the instances of the object

Return Value

This service returns a list of c2g.CommonService.Identity objects.

lookupChildrenByParentIds

global static List<ffr.CommonService.Identity> lookupChildrenByParentIds(String childObject, String parentFieldName, Set<ID> ids)

Retrieves indentities of the given object with parent id in given ids

Input Parameters

Name Type Description
childObject String The name of the child object
parentFieldName String The field name of the parent relationship on the object
ids Set<ID> The ids of the parent instances

Return Value

This service returns a list of c2g.CommonService.Identity objects.

getObjectList

global static List<String> getObjectList()

Retrieves a list of all sObjects in the org

Return Value

This service returns a list of object names as strings

getObjectMetadata

global static Map<String, ffr.CommonService.ObjectMetadata> getObjectMetadata(Set<String> objects, Boolean throwException, Boolean getAllFields)

Retrieves metadata for given objects

Input Parameters

Name Type Description
objects Set<String> The objects you require metadata for
throwException Boolean Whether to ignore or throw exceptions for invalid objects
getAllFields Boolean Whether to include all field types or exclude composite fields (such as ADDRESS)

Return Value

This service returns a map of object name (string) to the metadata.

getObjectMetadata

global static Map<String, ffr.CommonService.ObjectMetadata> getObjectMetadata(Set<String> objects, Boolean throwException, Boolean getAllFields, Boolean getLookups)

Retrieves metadata for given objects

Input Parameters

Name Type Description
objects Set<String> The objects you require metadata for
throwException Boolean Whether to ignore or throw exceptions for invalid objects
getAllFields Boolean Whether to include all field types or exclude composite fields (such as ADDRESS)
getLookups Boolean Whether to include lookups in the returned metadata

Return Value

This service returns a map of object name (string) to the metadata.

getObjectMetadata

global static Map<String, ffr.CommonService.ObjectMetadata> getObjectMetadata(Set<String> objects, Boolean throwException)

Retrieves metadata for given objects

Input Parameters

Name Type Description
objects Set<String> The objects you require metadata for
throwException Boolean Whether to ignore or throw exceptions for invalid objects

Return Value

This service returns a map of object name (string) to the metadata.

getPicklistOptions

global static List<ffr.CommonService.Picklist> getPicklistOptions(Schema.DescribeFieldResult picklistField)

Retrieves the picklist information for a field

Input Parameters

Name Type Description
picklistField Schema.DescribeFieldResult The field describe result of the picklist field

Return Value

This service returns a list of c2g.CommonService.Picklist objects.

ffr.CommonService.ObjectMetadata

global class ObjectMetadata

Stores salesforce SObject metadata

Properties

Name Type Description
objectName String Name of the SObject
fieldMap Map<String, ffr.CommonService.Field> Holds the details of the fields on the object
lookupMap Map<String, ffr.CommonService.Field> Holds the details of the lookups on the object
relationshipMap Map<String, ffr.CommonService.Relationship> Holds the details of the relationships on the object

ffr.CommonService.Field

global class Field

Stores metadata for a salesforce field

Properties

Name Type Description
name String Name of the field
label String Label of the field
type String Type of the field
soapType String Soap type of the field
precision Integer For fields of Type 'Double' this will store the precision of the field. (The maximum number of digits that can be stored, including all numbers to the left and to the right of the decimal point)
scale Integer For fields of Type 'Double' this will store the scale of the field. (The number of digits to the right of the decimal point)
lookupObject String The name of the parent object for this field if this field is a lookup
picklist List<ffr.CommonService.Picklist> Holds the picklist information if the field is a picklist
isFilterable Boolean When True, indicates that the field can be used as part of the filter criteria of a WHERE statement.
relationshipName String The name of the relationship
displayLocationInDecimal Boolean When True, indicates that the field should display in decimal
isRestrictedPicklist Boolean When True, indicates that the field is a restricted picklist.
isHtmlFormatted Boolean When True, indicates that the field is html formatted.
isAccessible Boolean When True, indicates that the field can be read.
isUpdatable Boolean When True, indicates that the field can be edited.
isEncrypted Boolean When True, indicates that the field is platform encrypted.
isNameField Boolean When True, indicates that the field is the objects name field.
length Integer The maximum length of a string field.

ffr.CommonService.Relationship

global class Relationship

Holds information about a relationship on a field

Properties

Name Type Description
relationshipName String Name of the relationship
objectName String Name of Object the relationship is to
objectLabel String Label of Object the relationship is to

ffr.CommonService.Picklist

global class Picklist

Holds picklist information for picklist fields

Properties

Name Type Description
Name String The name of the picklist value
Label String The label of the picklist value

ffr.CommonService.Identity

global class Identity

Hold identity information for an entity

Properties

Name Type Description
Id Id The Id of the entity
Name String The name of the entity

Methods

Identity

global Identity(ID anId)

Creates an API version of an Identity.

Input Parameters

Name Type Description
anId ID An Id for the Identity.

Identity

global Identity(String aName)

Creates an API version of an Identity.

Input Parameters

Name Type Description
aName String A name for the Identity.

Identity

global Identity(ID anId, String aName)

Creates an API version of an Identity.

Input Parameters

Name Type Description
anId ID An Id for the Identity.
aName String A name for the Identity.

hashCode

global Integer hashCode()

Gets the Hash code of the Identity.

Return Value

The hash code using the Id or in the case of an identity without an Id the Name is used

equals

global Boolean equals(Object obj)

Checks whether the Identity represents a given object.

Input Parameters

Name Type Description
obj Object The object to check.

Return Value

The boolean result of the equality check

ffr.CommonService.Size

global class Size

Holds size information

Properties

Name Type Description
Width Integer the width
Height Integer the height

Methods

Size

global Size()

Creates an API version of an empty Size object.

Size

global Size(Integer width, Integer height)

Creates an API version of a Size object using the specified parameters.

Input Parameters

Name Type Description
width Integer The width of the size object.
height Integer The height of the size object.

ffr.CommonService.SObjectNamespaceHelper

global class SObjectNamespaceHelper

Resolves a Namespace qualified sobject name to obtain name and namespace seperately. This can handle the default namespace from inside or outside a package.

Properties

Name Type Description
Name String The Name of the object/field
Namespace String The Namespace of the object/field

Methods

SObjectNamespaceHelper

global SObjectNamespaceHelper(String fullyQualifiedName)

Creates a SObjectNamespaceHelper.

Input Parameters

Name Type Description
fullyQualifiedName String A fully qualified object/field name.

ffr.CommonService.ClassFactory

global class ClassFactory

Resolves a Namespace qualified class name to find the class type or create an instance. This can handle the default namespace from inside or outside a package.

Properties

Name Type Description
Name String The Name of the class
Namespace String The Namespace of the class

Methods

ClassFactory

global ClassFactory(String fullyQualifiedName)

Creates a ClassFactory.

Input Parameters

Name Type Description
fullyQualifiedName String A fully qualified class name.

getType

global Type getType()

Returns the type that corresponds to the fully qualified class name.

newInstance

global Object newInstance()

Creates an instance of the current type and returns this new instance.