public final class SObjectComposite extends Object implements Serializable
addGeneric(Method, String, String) or addGeneric(Method, String, Object, String)
methods. To build the batch use: This will build a composite of two insert operations.composite = new SObjectComposite("41.0", true); // insert operation via an external id final Invoice__c_Lookup invoiceLookup = new Invoice__c_Lookup(); invoiceLookup.setInvoice_External_Id__c("0116"); final Payment__c payment = new Payment__c(); payment.setInvoice__r(invoiceLookup); composite.addCreate(payment, "NewPayment1"); composite.addCreate(payment, "NewPayment2");
| Modifier and Type | Class and Description |
|---|---|
static class |
SObjectComposite.Method |
| Modifier and Type | Field and Description |
|---|---|
static PayloadFormat |
REQUIRED_PAYLOAD_FORMAT |
| Constructor and Description |
|---|
SObjectComposite(String apiVersion,
boolean allOrNone)
Create new composite request.
|
| Modifier and Type | Method and Description |
|---|---|
SObjectComposite |
addCreate(AbstractDescribedSObjectBase data,
String referenceId)
Add create SObject to the composite request.
|
SObjectComposite |
addDelete(String type,
String id,
String referenceId)
Add delete SObject with identifier to the composite request.
|
SObjectComposite |
addGeneric(SObjectComposite.Method method,
String url,
Object richInput,
String referenceId)
Generic way to add requests to composite with
richInput payload. |
SObjectComposite |
addGeneric(SObjectComposite.Method method,
String url,
String referenceId)
Generic way to add requests to composite.
|
SObjectComposite |
addGet(String type,
String id,
String referenceId,
String... fields)
Add field retrieval of an SObject by identifier to the composite request.
|
SObjectComposite |
addGetByExternalId(String type,
String fieldName,
String fieldValue,
String referenceId)
Add field retrieval of an SObject by external identifier to the composite request.
|
SObjectComposite |
addGetRelated(String type,
String id,
String relation,
String referenceId,
String... fields)
Add retrieval of related SObject fields by identifier.
|
SObjectComposite |
addQuery(String query,
String referenceId)
Add retrieval of SObject records by query to the composite.
|
SObjectComposite |
addQueryAll(String query,
String referenceId)
Add retrieval of all SObject records by query to the composite.
|
SObjectComposite |
addUpdate(String type,
String id,
AbstractSObjectBase data,
String referenceId)
Add update of SObject record to the composite.
|
SObjectComposite |
addUpdateByExternalId(String type,
String fieldName,
String fieldValue,
AbstractSObjectBase data,
String referenceId)
Add update of SObject record by external identifier to the composite.
|
SObjectComposite |
addUpsertByExternalId(String type,
String fieldName,
String fieldValue,
AbstractSObjectBase data,
String referenceId)
Add insert or update of SObject record by external identifier to the composite.
|
boolean |
getAllOrNone() |
List<org.apache.camel.component.salesforce.api.dto.composite.CompositeRequest> |
getCompositeRequests()
Fetches compose requests contained in this compose request.
|
Version |
getVersion()
Version of Salesforce API for this batch request.
|
Class[] |
objectTypes()
Returns all object types nested within this composite request, needed for serialization.
|
public static final PayloadFormat REQUIRED_PAYLOAD_FORMAT
public SObjectComposite(String apiVersion, boolean allOrNone)
apiVersion - API version for the batch requestpublic SObjectComposite addCreate(AbstractDescribedSObjectBase data, String referenceId)
data - object to createpublic SObjectComposite addDelete(String type, String id, String referenceId)
type - type of SObjectid - identifier of the objectpublic SObjectComposite addGeneric(SObjectComposite.Method method, String url, Object richInput, String referenceId)
richInput payload. Given URL starts from the version, so in
order to update SObject specify just /sobjects/Account/identifier which results in
/services/data/v37.0/sobjects/Account/identifier. Note the leading slash.method - HTTP methodurl - URL starting from the versionrichInput - body of the request, to be placed in richInputpublic SObjectComposite addGeneric(SObjectComposite.Method method, String url, String referenceId)
/sobjects/Account/identifier which results in
/services/data/v37.0/sobjects/Account/identifier. Note the leading slash.method - HTTP methodurl - URL starting from the versionpublic SObjectComposite addGet(String type, String id, String referenceId, String... fields)
type - type of SObjectid - identifier of SObjectfields - to returnpublic SObjectComposite addGetByExternalId(String type, String fieldName, String fieldValue, String referenceId)
type - type of SObjectfieldName - external identifier field namefieldValue - external identifier field valuepublic SObjectComposite addGetRelated(String type, String id, String relation, String referenceId, String... fields)
Account has a relation to
CreatedBy. To fetch fields from that related object (User SObject) use: batch.addGetRelated("Account", identifier, "CreatedBy", "Name", "Id")
type - type of SObjectid - identifier of SObjectrelation - name of the related SObject fieldfields - to returnpublic SObjectComposite addQuery(String query, String referenceId)
query - SOQL query to executepublic SObjectComposite addQueryAll(String query, String referenceId)
query - SOQL query to executepublic SObjectComposite addUpdate(String type, String id, AbstractSObjectBase data, String referenceId)
data parameter must contain only the fields that
need updating and must not contain the Id field. So set any fields to null that you do not want
changed along with Id field.type - type of SObjectid - identifier of SObjectdata - SObject with fields to changepublic SObjectComposite addUpdateByExternalId(String type, String fieldName, String fieldValue, AbstractSObjectBase data, String referenceId)
data parameter must
contain only the fields that need updating and must not contain the Id field. So set any fields to
null that you do not want changed along with Id field.type - type of SObjectfieldName - name of the field holding the external identifierfieldValue - external identifier field valuedata - SObject with fields to changepublic SObjectComposite addUpsertByExternalId(String type, String fieldName, String fieldValue, AbstractSObjectBase data, String referenceId)
data parameter
must contain only the fields that need updating and must not contain the Id field. So set any fields to
null that you do not want changed along with Id field.type - type of SObjectfieldName - name of the field holding the external identifierfieldValue - external identifier field valuedata - SObject with fields to changepublic boolean getAllOrNone()
public List<org.apache.camel.component.salesforce.api.dto.composite.CompositeRequest> getCompositeRequests()
public Version getVersion()
public Class[] objectTypes()
Apache Camel