Compare this business object's attribute values with those in the input business object, including child business objects.
Syntax
-boolean equals(Object inputBusObj)
Parameters
Return values
Returns true if the values of all attributes are the same; otherwise, returns false.
Exceptions
CollaborationException--The equals() method can set the following exception type for this exception:
Notes
This method compares this business object's attribute values with those in the input business object. If the business objects are hierarchical, the comparison includes all attributes in the child business objects.
See also
equalKeys(), equalsShallow()
Examples
The following example compares all attributes of order2 to all attributes of order1 and assigns the result of the comparison to the variable areEqual. The comparison includes the attributes of child business objects, if any.
boolean areEqual = order1.equals(order2);
The next example compares triggeringBusObj to sourceBusObj and shows how the order of the comparison affects the results.
logInfo("***Comparing triggering BO to empty Source BO"); if (triggeringBusObj.equals(SourceBusObj)) { logInfo("**** triggeringBusObj.equals(SourceBusObj) - TRUE"); } else logInfo("**** triggeringBusObj.equals(SourceBusObj) - FALSE"); if (SourceBusObj.equals(triggeringBusObj)) { logInfo("**** SourceBusObj.equals(triggeringBusObj) - TRUE"); } else logInfo("**** SourceBusObj.equals(triggeringBusObj) - FALSE"); logInfo("*** Copying Source BO verb from triggering BO"); SourceBusObj.copy(triggeringBusObj); if (triggeringBusObj.equals(SourceBusObj)) { logInfo("**** triggeringBusObj.equals(SourceBusObj) - TRUE"); } else logInfo("**** triggeringBusObj.equals(SourceBusObj) - FALSE"); if (SourceBusObj.equals(triggeringBusObj)) { logInfo("**** SourceBusObj.equals(triggeringBusObj) - TRUE"); } else logInfo("**** SourceBusObj.equals(triggeringBusObj) - FALSE"); logInfo("*** Setting Source BO verb to Update"); SourceBusObj.setVerb("Update"); if (triggeringBusObj.equals(SourceBusObj)) { logInfo("**** triggeringBusObj.equals(SourceBusObj) - TRUE"); } else logInfo("**** triggeringBusObj.equals(SourceBusObj) - FALSE"); if (SourceBusObj.equals(triggeringBusObj)) { logInfo("**** SourceBusObj.equals(triggeringBusObj) - TRUE"); } else logInfo("**** SourceBusObj.equals(triggeringBusObj) - FALSE"); logInfo("*** Swapping order of Source BO children"); BusObjArray TempArray = SourceBusObj.getBusObjArray("Attr3"); TempArray.swap(0,1); if (triggeringBusObj.equals(SourceBusObj)) { logInfo("**** triggeringBusObj.equals(SourceBusObj) - TRUE"); } else logInfo("**** triggeringBusObj.equals(SourceBusObj) - FALSE"); if (SourceBusObj.equals(triggeringBusObj)) { logInfo("**** SourceBusObj.equals(triggeringBusObj) - TRUE"); } else logInfo("**** SourceBusObj.equals(triggeringBusObj) - FALSE");
The previous code gives the following results:
[Mesg: Info ***Comparing triggering BO to empty Source BO] [Mesg: Info **** triggeringBusObj.equals(SourceBusObj) - FALSE] [Mesg: Info **** SourceBusObj.equals(triggeringBusObj) - TRUE] [Mesg: Info *** Copying Source BO from triggering BO] [Mesg: Info **** triggeringBusObj.equals(SourceBusObj) - TRUE] [Mesg: Info **** SourceBusObj.equals(triggeringBusObj) - TRUE] [Mesg: Info *** Setting Source BO verb to Update] [Mesg: Info **** triggeringBusObj.equals(SourceBusObj) - TRUE] [Mesg: Info **** SourceBusObj.equals(triggeringBusObj) - TRUE] [Mesg: Info *** Swapping order of Source BO children] [Mesg: Info **** triggeringBusObj.equals(SourceBusObj) - FALSE] [Mesg: Info **** SourceBusObj.equals(triggeringBusObj) - FALSE]