| Show: | |||||||||||||||||||||||||||
fflib_SObjects
Copyright (c), FinancialForce.com, inc All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the FinancialForce.com, inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Signature
public virtual class fflib_SObjects
fflib_SObjects Properties
fflib_SObjects Constructors
fflib_SObjects(records)
Class constructor
Signature
public fflib_SObjects(List<SObject> records)
fflib_SObjects(records, sObjectType)
Signature
public fflib_SObjects(List<SObject> records, Schema.SObjectType sObjectType)
fflib_SObjects Methods
addError(message)
Adds an error message to the records in the domain
Signature
protected void addError(String message)
Parameters
message
Type:
String
The error message to add to each record
addError(field, message)
Adds an error message to the a field records in the domain
Signature
@TestVisible
protected virtual void addError(Schema.SObjectField field, String message)
Parameters
field
Type:
Schema.SObjectField
The field where the error should be reported
message
Type:
String
The error message to add to the given field on each record
clearField(field)
Clear the field value on all the records of the domain
Signature
@TestVisible
protected virtual void clearField(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The field to nullify
clearFields(fields)
Clear the field values on all the records of the domain
Signature
@TestVisible
protected virtual void clearFields(Set<Schema.SObjectField> fields)
Parameters
fields
Type:
Set<Schema.SObjectField>
The fields to nullify
error(message, record)
Ensures logging of errors in the Domain context for later assertions in tests
Signature
protected virtual String error(String message, SObject record)
Parameters
message
Type:
String
record
Type:
SObject
Returns
Returns the Error message
error(message, record, field)
Ensures logging of errors in the Domain context for later assertions in tests
Signature
protected virtual String error(String message, SObject record, Schema.SObjectField field)
Parameters
message
Type:
String
record
Type:
SObject
field
Type:
Schema.SObjectField
Returns
Returns the Error message
getFieldValues(field)
Signature
@TestVisible
protected virtual Set<Object> getFieldValues(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The SObjectField reference
Returns
Return a set with all the values of the given field
getIdFieldValues(field)
Signature
@TestVisible
protected Set<Id> getIdFieldValues(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The SObjectField reference of the type Id
Returns
Return a set with all the Id values of the given field
getRecordIds()
Signature
public virtual Set<Id> getRecordIds()
getRecords()
Signature
public virtual List<SObject> getRecords()
getRecordsByFieldValue(field, value)
Signature
protected virtual List<SObject> getRecordsByFieldValue(Schema.SObjectField field, Object value)
Parameters
field
Type:
Schema.SObjectField
The Schema.SObjectField to compare against the given value
value
Type:
Object
The given value of the records field to include in the return
Returns
A list with only the SObjects where the given field has the provided value
getRecordsByFieldValues(field, values)
Signature
protected virtual List<SObject> getRecordsByFieldValues(Schema.SObjectField field, Set<Object> values)
Parameters
field
Type:
Schema.SObjectField
The Schema.SObjectField to compare against the given value
values
Type:
Set<Object>
The given values of the records field to include in the return
Returns
A list with only the SObjects where the given field value is part of the provided values
getRecordsWithAllBlankFieldValues(fields)
Signature
protected virtual List<SObject> getRecordsWithAllBlankFieldValues(Set<Schema.SObjectField> fields)
Parameters
fields
Type:
Set<Schema.SObjectField>
The Schema.SObjectFields to check their value for a Blank value
Returns
A list with only the SObjects where all given field values are either null or ''
getRecordsWithAllNotBlankFieldValues(fields)
Signature
protected virtual List<SObject> getRecordsWithAllNotBlankFieldValues(Set<Schema.SObjectField> fields)
Parameters
fields
Type:
Set<Schema.SObjectField>
The Schema.SObjectFields to check their value for a Non-Blank value
Returns
A list with only the SObjects where all given field values are not null or ''
getRecordsWithBlankFieldValues(field)
Signature
protected virtual List<SObject> getRecordsWithBlankFieldValues(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The Schema.SObjectField to check its value for a Blank value
Returns
A list with only the SObjects where the given field value is either null or '')
getRecordsWithBlankFieldValues(fields)
Signature
protected virtual List<SObject> getRecordsWithBlankFieldValues(Set<Schema.SObjectField> fields)
Parameters
fields
Type:
Set<Schema.SObjectField>
The Schema.SObjectFields to check their value for a Blank value
Returns
A list with only the SObjects where the at least one given field value is either null or '')
getRecordsWithNotBlankFieldValues(field)
Signature
protected virtual List<SObject> getRecordsWithNotBlankFieldValues(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The Schema.SObjectField to check its value for a Non-Blank value
Returns
A list with only the SObjects where the given field value is not null or ''
getRecordsWithNotBlankFieldValues(fields)
Signature
protected virtual List<SObject> getRecordsWithNotBlankFieldValues(Set<Schema.SObjectField> fields)
Parameters
fields
Type:
Set<Schema.SObjectField>
The Schema.SObjectFields to check their value for a Non-Blank value
Returns
A list with only the SObjects where the at least one given field value not null or ''
getSObjectType()
Signature
public virtual SObjectType getSObjectType()
getStringFieldValues(field)
Signature
@TestVisible
protected Set<String> getStringFieldValues(Schema.SObjectField field)
Parameters
field
Type:
Schema.SObjectField
The SObjectField reference of the type String
Returns
Return a set with all the String values of the given field
getType()
Signature
public virtual override Object getType()
setFieldValue(field, value)
Modifies a value of a field for all records in the domain
Signature
protected virtual void setFieldValue(Schema.SObjectField field, Object value)
Parameters
field
Type:
Schema.SObjectField
The reference to the SObjectField to be modified
value
Type:
Object
The value to store in the given SObjectField
setFieldValueByMap(fieldToCheck, fieldToUpdate, values)
Signature
protected virtual void setFieldValueByMap( Schema.SObjectField fieldToCheck, Schema.SObjectField fieldToUpdate, Map<Object, Object> values)
Parameters
fieldToCheck
Type:
Schema.SObjectField
The SObjectField to match the key against in the provided map
fieldToUpdate
The SObjectField to store the mapped value when the key matches the value in the fieldToUpdate field
values
Type:
Object>
Map of values to store by the fieldToCheck fields value
fflib_SObjects.Error
Ensures logging of errors in the Domain context for later assertions in tests
Signature
public abstract class Error
fflib_SObjects.Error Properties
fflib_SObjects.ErrorFactory
Ensures logging of errors in the Domain context for later assertions in tests
Signature
public virtual class ErrorFactory
fflib_SObjects.ErrorFactory Properties
fflib_SObjects.ErrorFactory ConstructorsErrorFactory()
Signature
private ErrorFactory()
fflib_SObjects.ErrorFactory Methods
clearAll()
Signature
public void clearAll()
error(message, record)
Signature
public String error(String message, SObject record)
error(domain, message, record)
Signature
public String error(fflib_SObjects domain, String message, SObject record)
error(message, record, field)
Signature
public String error(String message, SObject record, SObjectField field)
error(domain, message, record, field)
Signature
public String error(fflib_ISObjects domain, String message, SObject record, SObjectField field)
getAll()
Signature
public List<Error> getAll()
fflib_SObjects.FieldError
Ensures logging of errors in the Domain context for later assertions in tests
Signature
public virtual class FieldError extends ObjectError
fflib_SObjects.FieldError Properties
fflib_SObjects.FieldError ConstructorsFieldError()
Signature
public FieldError()
fflib_SObjects.ObjectError
Ensures logging of errors in the Domain context for later assertions in tests
Signature
public virtual class ObjectError extends Error
fflib_SObjects.ObjectError Properties
fflib_SObjects.ObjectError ConstructorsObjectError()
Signature
public ObjectError()
|
|||||||||||||||||||||||||||