/** Remove stuff from an unordered collection. */ private void simpleRemoveFromCollectionChangeRecordWithoutOrder( Object referenceKey, Object changeSetToRemove, ObjectChangeSet changeSet, AbstractSession session) { EISCollectionChangeRecord changeRecord = (EISCollectionChangeRecord) changeSet.getChangesForAttributeNamed(this.getAttributeName()); if (changeRecord == null) { changeRecord = new EISCollectionChangeRecord( changeSet, this.getAttributeName(), this.getDatabaseMapping()); changeSet.addChange(changeRecord); } changeRecord.simpleRemoveChangeSet(changeSetToRemove); }
/** * INTERNAL: Build and return the change record that results from comparing the two collection * attributes. */ public ChangeRecord compareForChange( Object clone, Object backup, ObjectChangeSet owner, AbstractSession session) { ContainerPolicy cp = this.getContainerPolicy(); Object cloneCollection = this.getRealCollectionAttributeValueFromObject(clone, session); Object backupCollection = null; if (owner.isNew()) { backupCollection = cp.containerInstance(1); } else { backupCollection = this.getRealCollectionAttributeValueFromObject(backup, session); } if (cp.hasOrder()) { return this.compareAttributeValuesForChangeWithOrder( cloneCollection, backupCollection, owner, session); } else { return this.compareAttributeValuesForChangeWithoutOrder( cloneCollection, backupCollection, owner, session); } }