Class SObjectTree
- java.lang.Object
-
- org.apache.camel.component.salesforce.api.dto.composite.SObjectTree
-
- All Implemented Interfaces:
Serializable
public final class SObjectTree extends Object implements Serializable
Payload and response for the SObject tree Composite API. The main interface for specifying what to include in the sumission to the API endpoint. To build the tree out use:Account account = ... Contact president = ... Contact marketing = ... Account anotherAccount = ... Contact sales = ... Asset someAsset = ... SObjectTree request = new SObjectTree(); request.addObject(account).addChildren(president, marketing); request.addObject(anotherAccount).addChild(sales).addChild(someAsset);
. |-- account | |-- president | `-- marketing `-- anotherAccount `-- sales `-- someAsset
ReferenceGenerator
and supply it as constructor argument toSObjectTree(ReferenceGenerator)
. Note that the tree can hold single object type at the root of the tree.
-
-
Constructor Summary
Constructors Constructor Description SObjectTree()
Create new SObject tree with the defaultReferenceGenerator
.SObjectTree(ReferenceGenerator referenceGenerator)
Create new SObject tree with customReferenceGenerator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SObjectNode
addObject(AbstractSObjectBase object)
Add SObject at the root of the tree.Stream<SObjectNode>
allNodes()
Returns a stream of all nodes in the tree.Stream<AbstractSObjectBase>
allObjects()
Returns a stream of all objects in the tree.String
getObjectType()
Returns the type of the objects in the root of the tree.Class[]
objectTypes()
void
setErrorFor(String referenceId, List<RestError> errors)
Sets errors for the given reference.void
setIdFor(String referenceId, String id)
Sets identifier of SObject for the given reference.int
size()
Returns the number of elements in the tree.
-
-
-
Constructor Detail
-
SObjectTree
public SObjectTree()
Create new SObject tree with the defaultReferenceGenerator
.
-
SObjectTree
public SObjectTree(ReferenceGenerator referenceGenerator)
Create new SObject tree with customReferenceGenerator
.
-
-
Method Detail
-
addObject
public SObjectNode addObject(AbstractSObjectBase object)
Add SObject at the root of the tree.- Parameters:
object
- SObject to add- Returns:
SObjectNode
for the given SObject
-
allNodes
public Stream<SObjectNode> allNodes()
Returns a stream of all nodes in the tree.- Returns:
-
allObjects
public Stream<AbstractSObjectBase> allObjects()
Returns a stream of all objects in the tree.- Returns:
-
getObjectType
public String getObjectType()
Returns the type of the objects in the root of the tree.- Returns:
- object type
-
objectTypes
public Class[] objectTypes()
-
setErrorFor
public void setErrorFor(String referenceId, List<RestError> errors)
Sets errors for the given reference. Used when processing the response of API invocation.- Parameters:
referenceId
- reference identifiererrors
- list ofRestError
-
setIdFor
public void setIdFor(String referenceId, String id)
Sets identifier of SObject for the given reference. Used when processing the response of API invocation.- Parameters:
referenceId
- reference identifierid
- SObject identifier
-
size
public int size()
Returns the number of elements in the tree.- Returns:
- number of elements in the tree
-
-