Skip to main content
[ This file is autogenerated from apexdoc ]

Aq

SUPPRESSWARNINGS

Core shared methods, classes, and interfaces.

Group apex/core

Fields​

public OPERATOR_SYMBOL_MAP → Map<Operator,String>​

public LOGICAL_SYMBOL_MAP → Map<Logical,String>​

public SORT_DIR_SYMBOL_MAP → Map<SortDir,String>​

public NULLS_FIRST → String​

public NULLS_LAST → String​

public NULL_ORDER_SYMBOL_MAP → Map<NullOrder,String>​


Methods​

Validation​

public static void validate(Validatable objectToValidate)​

Throw a validation exception if result has an error.

public static void validate(Validatable objectToValidate, String resultType)​

Throw a validation exception if result has an error.

public static void requireValue(String valueName, Object value)​

Require a value.

public static void requireValueInSet(String valueName, String value, Set<String> validValues, Boolean required)​

Require value to be in specified set of values.

public static void requireValueInSet(String valueName, String value, Set<String> validValues)​

Require value to be in specified set of values.

public static void requireNonemptyList(String valueName, List<Object> value)​

Require list to be present and not empty

public static Boolean isEmptyList(List<Object> val)​

SObject methods​

public static Boolean exists(List<SObject> sObjectList)​

Convenience function for easier reading when evaluating result of SOQL

public static List<SObject> atLeastOne(SObjectType objectType, List<SObject> sObjectList)​

Throws if there's not at least one record in result set.

public static SObject exactlyOne(SObjectType objectType, List<SObject> sObjectList)​

Throws if there's not exactly one record in result set.

public static SObject atMostOne(SObjectType objectType, List<SObject> sObjectList)​

Throws if there are more than one record in result set.

public static List<SObject> filterByRecordType(List<SObject> records, Id recordTypeId)​

Filters list of SObjects with the given recordTypeId

public static Set<Id> getIdSet(List<SObject> records, SObjectField idField)​

Returns set of Ids by scanning all records in list for specified Id field.

public static Set<String> getFieldValuesFromRecords(List<SObject> records, SObjectField fieldName)​

Returns set of Strings by scanning all records in list for specified fieldName.

public static String getStringFromResource(String resourceName)​

SUPPRESSWARNINGS

Grab the string body from a static resource

public static Object getObjectFromResource(String resourceName, Type resourceType)​

Grab a serialized object from a static resource

public static List<Object> getObjectList(Set<SObjectField> objectSet)​

Convert set of object to list of object


Record Type methods​

public static Map<String,RecordType> getAllRecordTypes()​

Get all record types map with its object and developer name as the key

public static RecordType getRecordTypeByName(SObjectType objectType, String developerName)​

Get a record type by its object and developer name

public static Id getRecordTypeId(SObjectType objectType, String developerName)​

Returns Id for record type name

public static String getRecordTypeLabel(SObjectType objectType, String developerName)​

Get the display label for record type.

public static RecordTypeInfo getRecordTypeInfoByName(String objectTypeName, String developerName)​

Get the Schema.RecordTypeInfo for record type.

public static Boolean hasRecordType(SObject record, Set<String> developerNames)​

Returns true if the record has one of the specific record type names

public static Boolean isRecordType(SObject record, String developerName)​

Returns true if the record has the specific record type name


Namespace prefix handling​

public static String appendPrefix(String valueToPrefix)​

Null-safe operations​

public static String ifNull(Object value)​

Returns empty String in Null case.

public static String ifNull(String value, String defaultValue)​
public static String ifNull(Object value, String defaultValue)​
public static Integer ifNull(Integer value, Integer defaultValue)​
public static Integer ifNull(Decimal value, Integer defaultValue)​
public static Decimal ifNull(Decimal value, Decimal defaultValue)​
public static Date ifNull(Date value, Date defaultValue)​

Misc​

public static Map<String,Set<String>> getSObjectFieldNames(List<SObject> records)​

Returns all SObject fields maped by SObject name

public static void splitStringIntoSObjectFields(SObject sobj, List<Schema.SObjectField> fields, String value)​

SUPPRESSWARNINGS

Method used to split String between fields based on each field length if value is blank, all fields will be cleared.

public static void abbreviateExcessiveTextFields(SObject entity)​

Method used to abbreviate text and textarea SObject fields according to the defined field length. Use this method before DML operations to avoid exceptions in case of either field constraints or field value source is out of your control.

public static Map<Id,List<SObject>> toMapByParentId(List<SObject> records, SObjectField parentField)​

Returns SObjects mapped by value of parentField

public static Map<Id,List<SObject>> toMapByParentId(List<SObject> records, SObjectField parentField, Set<Id> parentKeys)​
public static Map<String,List<SObject>> toMapByCompoundId(List<SObject> records, List<SObjectField> parentFields)​

Returns SObjects mapped by compound value of parentFields, see toMapByParentId() and getConcatenatedValue()

public static Map<Id,Map<Id,List<SObject>>> toMapByParentIdByParentId(List<SObject> records, SObjectField outerParentId, SObjectField innerParentId)​

Returns SObjects mapped by value of innerParentId and then by outerParentId. See toMapByParentId()

public static String getConcatenatedValue(SObject record, List<SObjectField> fields)​

An utility to assemble compound string value for a given SObject and given fields separated by ':' (e.g. 'Foo:Bar:777').

public static String concatObjectStringFields(SObject sobj, List<Schema.SObjectField> fields)​

Method used to concatenate values of related fields into single string (ex: Access Token stored in 5 different fields because of it`s length)


Enums​

Operator​

Conditional operators

Logical​

Logical operators

SortDir​

Sort directions

NullOrder​

Null sorting


Classes​

BusinessException​

Thrown when a business rule has been violated. In general, that means result is safe to show to the caller.

Inheritance

AqException > BusinessException

Constructors​

Additional custom exceptions​

####### public BusinessException(AqResult result) ####### public BusinessException(String message, String scopeType, String scope, String code) ####### public BusinessException(String message, String scopeType, String scope)​

ValidationException​

Thrown when general validation fails.

Inheritance

ValidationException

Constructors​

Additional custom exceptions​

####### public ValidationException(AqResult result) ####### public ValidationException(String message, String scopeType, String scope, String code) ####### public ValidationException(String message, String scopeType, String scope)​

UserException​

Thrown specifically in UI environment, intended to be show to a user.

Inheritance

UserException

Constructors​

Additional custom exceptions​

####### public UserException(AqResult result) ####### public UserException(String message, String scopeType, String scope, String code) ####### public UserException(String message, String scopeType, String scope)​

NotFoundException​

Thrown when record is not found.

Inheritance

NotFoundException

Constructors​

Additional custom exceptions​

####### public NotFoundException(AqResult result) ####### public NotFoundException(String message, String scopeType, String scope, String code) ####### public NotFoundException(String message, String scopeType, String scope)​

RecordCountException​

Thrown when wrong number of records found.

Inheritance

RecordCountException

Constructors​

Additional custom exceptions​

####### public RecordCountException(AqResult result) ####### public RecordCountException(String message, String scopeType, String scope, String code) ####### public RecordCountException(String message, String scopeType, String scope)​

PermissionException​

Thrown on CRUD/FLS or other permission rule violated

Inheritance

PermissionException

Constructors​

Additional custom exceptions​

####### public PermissionException(AqResult result) ####### public PermissionException(String message, String scopeType, String scope, String code) ####### public PermissionException(String message, String scopeType, String scope)​

QueryPermissionException​

Thrown on CRUD/FLS permission rule violated on SOQL query

Inheritance

QueryPermissionException

Constructors​

Additional custom exceptions​

####### public QueryPermissionException(AqResult result) ####### public QueryPermissionException(String message, String scopeType, String scope, String code) ####### public QueryPermissionException(String message, String scopeType, String scope) ####### public QueryPermissionException(QueryException originException)​

DuplicateException​

Thrown on any duplicate record exception

Inheritance

DuplicateException

Constructors​

Additional custom exceptions​

####### public DuplicateException(AqResult result) ####### public DuplicateException(String message, String scopeType, String scope, String code) ####### public DuplicateException(String message, String scopeType, String scope)​

Value​

Can be extended by a class that should be able to be compared for equality.

Methods​

public Boolean equals(Object obj)​
public Integer hashCode()​


Interfaces​

Formatable​

Implemented by anything that can be formatted to text.

Methods​

public String toString()​

Validatable​

Implemented by object that can be validated and throws exception if validation fails.

Methods​

public AqResult validate()​