private ChangeRecord compareAttributeValuesForChangeWithoutOrder(Object cloneCollection, Object backupCollection, ObjectChangeSet owner, AbstractSession session) {
ContainerPolicy cp = this.getContainerPolicy();
Vector backupVector = cp.vectorFor(backupCollection, session);// "clone" it so we can clear out the slots
EISCollectionChangeRecord changeRecord = new EISCollectionChangeRecord(owner, this.getAttributeName(), this.getDatabaseMapping());
for (Object cloneIter = cp.iteratorFor(cloneCollection); cp.hasNext(cloneIter);) {
Object cloneElement = cp.next(cloneIter, session);
boolean found = false;
for (int i = 0; i < backupVector.size(); i++) {
if (this.compareElementsForChange(cloneElement, backupVector.elementAt(i), session)) {
// the clone element was found in the backup collection
found = true;
backupVector.setElementAt(XXX, i);// clear out the matching backup element
if (this.mapKeyHasChanged(cloneElement, session)) {
changeRecord.addChangedMapKeyChangeSet(this.buildChangeSet(cloneElement, owner, session));
}
break;// matching backup element found - skip the rest of them
}
}
if (!found) {
// the clone element was not found, so it must have been added
changeRecord.addAddedChangeSet(this.buildChangeSet(cloneElement, owner, session));
}
}
for (int i = 0; i < backupVector.size(); i++) {
Object backupElement = backupVector.elementAt(i);
if (backupElement != XXX) {
// the backup element was not in the clone collection, so it must have been removed
changeRecord.addRemovedChangeSet(this.buildChangeSet(backupElement, owner, session));
}
}
if (changeRecord.hasChanges()) {
return changeRecord;
} else {
return null;
}
}