Class SObjectNode
- java.lang.Object
-
- org.apache.camel.component.salesforce.api.dto.composite.SObjectNode
-
- All Implemented Interfaces:
Serializable
public final class SObjectNode extends Object implements Serializable
Represents one node in the SObject tree request. SObject trees (SObjectTree
) are composed from instances ofSObjectNode
s. EachSObjectNode
contains the SObject (AbstractSObjectBase
) and any child records linked to it. SObjects at root level are added toSObjectTree
usingSObjectTree.addObject(AbstractSObjectBase)
, then you can add child records on theSObjectNode
returned by usingaddChild(AbstractDescribedSObjectBase)
,addChildren(AbstractDescribedSObjectBase, AbstractDescribedSObjectBase...)
oraddChild(String, AbstractSObjectBase)
andaddChildren(String, AbstractSObjectBase, AbstractSObjectBase...)
. Upon submission to the Salesforce Composite API theSObjectTree
and theSObjectNode
s in it might contain errors that you need to fetch usinggetErrors()
method.- See Also:
SObjectTree
,RestError
, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SObjectNode
addChild(String labelPlural, AbstractSObjectBase child)
Add a child that does not contain the required metadata to the this node.SObjectNode
addChild(AbstractDescribedSObjectBase child)
Add a described child with the metadata needed already present within it to the this node.void
addChildren(String labelPlural, AbstractSObjectBase first, AbstractSObjectBase... others)
Add a child that does not contain the required metadata to the this node.void
addChildren(AbstractDescribedSObjectBase first, AbstractDescribedSObjectBase... others)
Add multiple described children with the metadata needed already present within them to the this node..Stream<SObjectNode>
getChildNodes()
Returns all children of this node (one level deep).Stream<SObjectNode>
getChildNodesOfType(String type)
Returns all children of this node (one level deep) of certain type (in plural form).Stream<AbstractSObjectBase>
getChildren()
Returns child SObjects of this node (one level deep).Stream<AbstractSObjectBase>
getChildrenOfType(String type)
Returns child SObjects of this node (one level deep) of certain type (in plural form)List<RestError>
getErrors()
Errors reported against this this node received in response to the SObject tree being submitted.AbstractSObjectBase
getObject()
SObject at this node.boolean
hasErrors()
Are there any errors resulted from the submission on this node?int
size()
Size of the branch beginning with this node (number of SObjects in it).String
toString()
-
-
-
Method Detail
-
addChild
public SObjectNode addChild(AbstractDescribedSObjectBase child)
Add a described child with the metadata needed already present within it to the this node.- Parameters:
child
- to add- Returns:
- the newly created node, used in builder fashion to add more child objects to it (on the next level)
-
addChild
public SObjectNode addChild(String labelPlural, AbstractSObjectBase child)
Add a child that does not contain the required metadata to the this node. You need to specify the plural form of the child (e.g. `Account` its `Accounts`).- Parameters:
labelPlural
- plural formchild
- to add- Returns:
- the newly created node, used in builder fashion to add more child objects to it (on the next level)
-
addChildren
public void addChildren(AbstractDescribedSObjectBase first, AbstractDescribedSObjectBase... others)
Add multiple described children with the metadata needed already present within them to the this node..- Parameters:
first
- first child to addothers
- any other children to add
-
addChildren
public void addChildren(String labelPlural, AbstractSObjectBase first, AbstractSObjectBase... others)
Add a child that does not contain the required metadata to the this node. You need to specify the plural form of the child (e.g. `Account` its `Accounts`).- Parameters:
labelPlural
- plural formfirst
- first child to addothers
- any other children to add
-
getChildNodes
public Stream<SObjectNode> getChildNodes()
Returns all children of this node (one level deep).- Returns:
- children of this node
-
getChildNodesOfType
public Stream<SObjectNode> getChildNodesOfType(String type)
Returns all children of this node (one level deep) of certain type (in plural form).- Parameters:
type
- type of child requested in plural form (e.g for `Account` is `Accounts`)- Returns:
- children of this node of specified type
-
getChildren
public Stream<AbstractSObjectBase> getChildren()
Returns child SObjects of this node (one level deep).- Returns:
- child SObjects of this node
-
getChildrenOfType
public Stream<AbstractSObjectBase> getChildrenOfType(String type)
Returns child SObjects of this node (one level deep) of certain type (in plural form)- Parameters:
type
- type of child requested in plural form (e.g for `Account` is `Accounts`)- Returns:
- child SObjects of this node
-
getErrors
public List<RestError> getErrors()
Errors reported against this this node received in response to the SObject tree being submitted.- Returns:
- errors for this node
-
getObject
public AbstractSObjectBase getObject()
SObject at this node.- Returns:
- SObject
-
hasErrors
public boolean hasErrors()
Are there any errors resulted from the submission on this node?- Returns:
- true if there are errors
-
size
public int size()
Size of the branch beginning with this node (number of SObjects in it).- Returns:
- number of objects within this branch
-
-