/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. * @param isNew signifies if the clone object is a new object. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, AbstractSession session) { return createObjectChangeSet(clone, uowChangeSet, isNew, false, session); }
/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. * @param isNew signifies if the clone object is a new object. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, AbstractSession session) { return createObjectChangeSet(clone, uowChangeSet, isNew, false, session); }
/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. * @param isNew signifies if the clone object is a new object. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, boolean isNew, AbstractSession session) { return createObjectChangeSet(clone, uowChangeSet, isNew, false, session); }
/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session) { boolean isNew = ((UnitOfWorkImpl)session).isCloneNewObject(clone); return createObjectChangeSet(clone, uowChangeSet, isNew, session); }
/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session) { boolean isNew = ((UnitOfWorkImpl)session).isObjectNew(clone); return createObjectChangeSet(clone, uowChangeSet, isNew, session); }
/** * INTERNAL: * Used by the ObjectBuilder to create an ObjectChangeSet for the specified clone object. * @return ObjectChangeSet the newly created changeSet representing the clone object * @param clone the object to convert to a changeSet. * @param uowChangeSet the owner of this changeSet. */ public ObjectChangeSet createObjectChangeSet(Object clone, UnitOfWorkChangeSet uowChangeSet, AbstractSession session) { boolean isNew = ((UnitOfWorkImpl)session).isCloneNewObject(clone); return createObjectChangeSet(clone, uowChangeSet, isNew, session); }
/** * INTERNAL: * Ensure the new key is set for the change set for a new map object */ public void buildChangeSetForNewObjectInCollection(Object object, ClassDescriptor referenceDescriptor, UnitOfWorkChangeSet uowChangeSet, AbstractSession session){ ObjectChangeSet changeSet = referenceDescriptor.getObjectBuilder().createObjectChangeSet(((Map.Entry)object).getValue(), uowChangeSet, session); Object key = ((Map.Entry)object).getKey(); changeSet.setNewKey(key); }
/** * This method takes a map of objects and converts them into * ObjectChangeSets. This method should only be called from a * ListContainerPolicy. Deletions from the list is made by index, hence, * the second Vector of indicesToRemove. */ public void addOrderedRemoveChange(List<Integer> indicesToRemove, Map objectChanges, UnitOfWorkChangeSet changeSet, AbstractSession session) { this.orderedRemoveObjectIndices = indicesToRemove; for (Integer index : indicesToRemove) { Object object = objectChanges.get(index); ObjectChangeSet change = session.getDescriptor(object.getClass()).getObjectBuilder().createObjectChangeSet(object, changeSet, session); getOrderedRemoveObjects().put(index, change); } }
/** * This method takes a map of objects and converts them into * ObjectChangeSets. This method should only be called from a * ListContainerPolicy. Deletions from the list is made by index, hence, * the second Vector of indicesToRemove. */ public void addOrderedRemoveChange(List<Integer> indicesToRemove, Map objectChanges, UnitOfWorkChangeSet changeSet, AbstractSession session) { this.orderedRemoveObjectIndices = indicesToRemove; for (Integer index : indicesToRemove) { Object object = objectChanges.get(index); ObjectChangeSet change = session.getDescriptor(object.getClass()).getObjectBuilder().createObjectChangeSet(object, changeSet, session); getOrderedRemoveObjects().put(index, change); } }
/** * This method takes a list of objects and converts them into * ObjectChangeSets. This method should only be called from a * ListContainerPolicy. Additions to the list are made by index, hence, * the second Map of objectChangesIndices. */ public void addOrderedAdditionChange(List<Object> orderedObjectsToAdd, Map<Object, Integer> objectChangesIndices, UnitOfWorkChangeSet changeSet, AbstractSession session) { for (Object object : orderedObjectsToAdd) { ObjectChangeSet change = session.getDescriptor(object.getClass()).getObjectBuilder().createObjectChangeSet(object, changeSet, session); getOrderedAddObjects().add(change); getOrderedAddObjectIndices().put(change, objectChangesIndices.get(object)); } }
/** * This method takes a list of objects and converts them into * ObjectChangeSets. This method should only be called from a * ListContainerPolicy. Additions to the list are made by index, hence, * the second Map of objectChangesIndices. */ public void addOrderedAdditionChange(List<Object> orderedObjectsToAdd, Map<Object, Integer> objectChangesIndices, UnitOfWorkChangeSet changeSet, AbstractSession session) { for (Object object : orderedObjectsToAdd) { ObjectChangeSet change = session.getDescriptor(object.getClass()).getObjectBuilder().createObjectChangeSet(object, changeSet, session); getOrderedAddObjects().add(change); getOrderedAddObjectIndices().put(change, objectChangesIndices.get(object)); } }
/** * INTERNAL: * Create change sets that contain map keys. */ @Override protected void createChangeSetForKeys(Map originalKeyValues, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor){ Iterator originalKeyValuesIterator = originalKeyValues.values().iterator(); while (originalKeyValuesIterator.hasNext()){ Association association = (Association)originalKeyValuesIterator.next(); Object object = association.getValue(); ObjectChangeSet changeSet = referenceDescriptor.getObjectBuilder().createObjectChangeSet(object, (UnitOfWorkChangeSet) changeRecord.getOwner().getUOWChangeSet(), session); changeSet.setOldKey(association.getKey()); } }
/** * INTERNAL: * Build and return a change set for the specified element. */ public Object buildChangeSet(Object element, ObjectChangeSet owner, AbstractSession session) { ObjectBuilder objectBuilder = session.getDescriptor(element).getObjectBuilder(); return objectBuilder.createObjectChangeSet(element, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); }
/** * INTERNAL: * Build and return a change set for the specified element. */ public Object buildChangeSet(Object element, ObjectChangeSet owner, AbstractSession session) { ObjectBuilder objectBuilder = session.getDescriptor(element).getObjectBuilder(); return objectBuilder.createObjectChangeSet(element, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); }
/** * INTERNAL: * Build and return a change set for the specified element. */ public Object buildChangeSet(Object element, ObjectChangeSet owner, AbstractSession session) { ObjectBuilder objectBuilder = session.getDescriptor(element).getObjectBuilder(); return objectBuilder.createObjectChangeSet(element, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); }
/** * INTERNAL: * Add the Deleted object to the changeSet. */ public void addDeletedObject(Object object, AbstractSession session) { //CR 4080 - must prevent aggregate objects added to DeletedObjects list ClassDescriptor descriptor = session.getDescriptor(object); if (!descriptor.isAggregateCollectionDescriptor()) { ObjectChangeSet set = descriptor.getObjectBuilder().createObjectChangeSet(object, this, false, session); // needed for xml change set set.setShouldBeDeleted(true); getDeletedObjects().put(set, set); } }
/** * INTERNAL: * Add the Deleted object to the changeSet. */ public void addDeletedObject(Object object, AbstractSession session) { //CR 4080 - must prevent aggregate objects added to DeletedObjects list ClassDescriptor descriptor = session.getDescriptor(object); if (!descriptor.isAggregateCollectionDescriptor()) { ObjectChangeSet set = descriptor.getObjectBuilder().createObjectChangeSet(object, this, false, session); // needed for xml change set set.setShouldBeDeleted(true); getDeletedObjects().put(set, set); } }
/** * INTERNAL: * Set the newValue in the change record */ public void setNewValueInChangeRecord(Object newValue, ObjectReferenceChangeRecord changeRecord, ObjectChangeSet owner, AbstractSession session) { if (newValue != null) { // Bug 2612571 - added more flexible manner of getting descriptor ObjectChangeSet newSet = getDescriptorForTarget(newValue, session).getObjectBuilder().createObjectChangeSet(newValue, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); changeRecord.setNewValue(newSet); } else { changeRecord.setNewValue(null); } }
/** * INTERNAL: * Set the newValue in the change record */ public void setNewValueInChangeRecord(Object newValue, ObjectReferenceChangeRecord changeRecord, ObjectChangeSet owner, AbstractSession session) { if (newValue != null) { // Bug 2612571 - added more flexible manner of getting descriptor ObjectChangeSet newSet = getDescriptorForTarget(newValue, session).getObjectBuilder().createObjectChangeSet(newValue, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); changeRecord.setNewValue(newSet); } else { changeRecord.setNewValue(null); } }
/** * INTERNAL: * Set the newValue in the change record */ public void setNewValueInChangeRecord(Object newValue, ObjectReferenceChangeRecord changeRecord, ObjectChangeSet owner, AbstractSession session) { if (newValue != null) { // Bug 2612571 - added more flexible manner of getting descriptor ObjectChangeSet newSet = getDescriptorForTarget(newValue, session).getObjectBuilder().createObjectChangeSet(newValue, (UnitOfWorkChangeSet)owner.getUOWChangeSet(), session); changeRecord.setNewValue(newSet); } else { changeRecord.setNewValue(null); } }