fferpcore.SObjectByIdDataSourceglobal with sharing virtual class SObjectByIdDataSource extends DataSourceBase implements DataSourceBase.RelatedDataSource, DataSourceBase.OneToManyRelatedDataSource A fferpcore.DataSource which will query for SObjects given a set of Ids to work from. This class implements the following interfaces: Methods
SObjectByIdDataSourceglobal SObjectByIdDataSource(SObjectType objectType, Set<Id> objectIds) Constructor for use as a querying DataSource. Input Parameters
SObjectByIdDataSourceglobal SObjectByIdDataSource(SObjectType objectType) Constructor for when this is used as a fferpcore.DataSourceBase.RelatedDataSource or a DataSourceBase.OneToManyRelatedDataSource. No Ids are provided as the owning fferpcore.DataSource will pass the relevant Ids in when it performs the query. The runQuery() method on this instance is not to be used. Input Parameters
withRequireSharingReadOnRootglobal virtual fferpcore.SObjectByIdDataSource withRequireSharingReadOnRoot() Requires that the user has read access to the base records returned from runQuery. Return ValueThis SObjectByIdDataSource to support fluent coding style. requireFieldglobal virtual override void requireField(SObjectField field) Implements requireField(SObjectField field) on DataSource. Calling this method requests that this data source query the given field. This method will be called by the Declarative Publish framework or by custom message Nodes during the preparation phase of declarative message building. Input Parameters
createRelatedDataSourceglobal virtual override fferpcore.DataSourceBase.RelatedDataSource createRelatedDataSource(SObjectField field) Implementation of the virtual DataSourceBase.createRelatedDataSource method. Input Parameters
Return ValueA related data source dervied from the specified lookup field. asDataSourceglobal fferpcore.DataSource asDataSource() Implements DataSourceBase.RelatedDataSource.asDataSource() and DataSourceBase.OneToManyRelatedDataSource.asDataSource() Return ValueThis object cast to a fferpcore.DataSource. 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 ExampleDataSource extends fferpcore.DataSourceBase implements fferpcore.DataSourceBase.RelatedDataSource { //... some other methods /** * Required for fferpcore.DataSourceBase.RelatedDataSource */ public fferpcore.DataSource asDataSource() { return this; } } runLookupQueryglobal virtual fferpcore.DataSourceBase.RelatedQueryResult runLookupQuery(SObjectField lookupField, fferpcore.DataSourceBase.DirectQueryResult source) Implements runLookupQuery() from the fferpcore.DataSourceBase.RelatedDataSource interface. Input Parameters
Return ValueA fferpcore.DataSourceBase.RelatedQueryResult containing the data looked up from the related table. 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 ExampleDataSource extends fferpcore.DataSourceBase { public fferpcore.DataSourceBase.RelatedQueryResult runLookupQuery(SObjectField lookupField, fferpcore.DataSourceBase.DirectQueryResult source) { requireIdField(); Set<Id> keys = source.getKeysForField(lookupField); List<SObject> records = queryRecordsByIds(m_idField, keys); fferpcore.DataSourceBase.DirectQueryResult directResult = new fferpcore.DataSourceBase.SimpleDirectQueryResult(records); Map<SObjectField, fferpcore.DataSourceBase.RelatedQueryResult> relatedResult = queryRelatedDataSources(directResult); Map<fferpcore.DataSource.BackReference, fferpcore.DataSourceBase.OneToManyQueryResult> oneToManyResult = queryOneToManyDataSources(directResult); return createRelatedQueryResult(directResult, relatedResult, oneToManyResult); } } runOneToManyQueryglobal virtual fferpcore.DataSourceBase.OneToManyQueryResult runOneToManyQuery(fferpcore.DataSource.BackReference backReference, fferpcore.DataSourceBase.DirectQueryResult parentSource) Implements the runOneToManyQuery method from the fferpcore.DataSourceBase.OneToManyRelatedDataSource interface. Input Parameters
Return ValueA fferpcore.DataSourceBase.RelatedQueryResult containing the data looked up from the child table. 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.DataSourceBase.OneToManyQueryResult runOneToManyQuery(fferpcore.DataSource.BackReference backReference, fferpcore.DataSourceBase.DirectQueryResult parentSource) { SObjectField field = backReference.getDetailToMasterLookupField(); Set<Id> primaryKeys = parentSource.getPrimaryKeys(); requireField(field); List<SObject> records = queryRecordsByIds(field, primaryKeys); fferpcore.DataSourceBase.DirectQueryResult directResult = new fferpcore.DataSourceBase.SimpleDirectQueryResult(records); Map<SObjectField, fferpcore.DataSourceBase.RelatedQueryResult> relatedResult = queryRelatedDataSources(directResult); Map<fferpcore.DataSource.BackReference, OneToManyQueryResult> oneToManyResult = queryOneToManyDataSources(directResult); return createOneToManyQueryResult(field, directResult, relatedResult, oneToManyResult); } |