setWithCreate()

Set a business object's attribute to a specified value of a particular data type, creating an object for the value is one does not already exist.

Syntax

void setWithCreate(String attributeName, BusObj busObj)
 void setWithCreate(String attributeName, BusObjArray busObjArray)
 void setWithCreate(String attributeName, Object value)
 

Parameters

attributeName
The name of the attribute to set.
busObj
The business object to insert into the target attribute.
busObjArray
The business object array to insert into the target attribute.
value
The object to insert into the target attribute. This object needs to be one of the following types: BusObj, BusObjArray, Object.

Exceptions

CollaborationException--The setWithCreate() method can set the following exception type for this exception:

Notes

If the object provided is a BusObj and the target attribute contains multi-cardinality child business object, the BusObj is appended to the BusObjArray as its last element. If the target attribute contains a BusObj, however, this business object replaces the previous value.

Examples

The following example sets an attribute called ChildAttrAttr to the value 5. The attribute is found in a business object contained in myBO's attribute, ChildAttr. If the childAttr business object does not exist at the time of the call, this method call creates it.

myBO.setWithCreate("childAttr.childAttrAttr", "5");
 

Copyright IBM Corp. 2003