Class SObjectTree
java.lang.Object
org.apache.camel.component.salesforce.api.dto.composite.SObjectTree
- All Implemented Interfaces:
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:
This will generate a tree of SObjects resembling: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);
By default references that correlate between SObjects in the tree and returned identifiers and errors are handled automatically, if you wish to customize the generation of the reference implement. |-- account | |-- president | `-- marketing `-- anotherAccount `-- sales `-- someAsset
ReferenceGenerator
and supply it as constructor argument to SObjectTree(ReferenceGenerator)
.
Note that the tree can hold single object type at the root of the tree.-
Constructor Summary
ConstructorDescriptionCreate new SObject tree with the defaultReferenceGenerator
.SObjectTree
(ReferenceGenerator referenceGenerator) Create new SObject tree with customReferenceGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionaddObject
(AbstractSObjectBase object) Add SObject at the root of the tree.allNodes()
Returns a stream of all nodes in the tree.Returns a stream of all objects in the tree.Returns the type of the objects in the root of the tree.Class[]
void
setErrorFor
(String referenceId, List<RestError> errors) Sets errors for the given reference.void
Sets identifier of SObject for the given reference.int
size()
Returns the number of elements in the tree.
-
Constructor Details
-
SObjectTree
public SObjectTree()Create new SObject tree with the defaultReferenceGenerator
. -
SObjectTree
Create new SObject tree with customReferenceGenerator
.
-
-
Method Details
-
addObject
Add SObject at the root of the tree.- Parameters:
object
- SObject to add- Returns:
SObjectNode
for the given SObject
-
allNodes
Returns a stream of all nodes in the tree.- Returns:
-
allObjects
Returns a stream of all objects in the tree.- Returns:
-
getObjectType
Returns the type of the objects in the root of the tree.- Returns:
- object type
-
objectTypes
-
setErrorFor
Sets errors for the given reference. Used when processing the response of API invocation.- Parameters:
referenceId
- reference identifiererrors
- list ofRestError
-
setIdFor
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
-