public Object getOldValue(Object currentCollection, AbstractSession session) { if(currentCollection != null) { if(currentCollection instanceof IndirectCollection) { currentCollection = ((IndirectCollection)currentCollection).getDelegateObject(); } internalRecreateOriginalCollection(currentCollection, session); } return currentCollection; } }
public Object getOldValue(Object currentCollection, AbstractSession session) { if(currentCollection != null) { if(currentCollection instanceof IndirectCollection) { currentCollection = ((IndirectCollection)currentCollection).getDelegateObject(); } internalRecreateOriginalCollection(currentCollection, session); } return currentCollection; } }
this.setOriginalCollection(((IndirectCollection)currentCollection).getDelegateObject()); } else { this.setOriginalCollection(currentCollection);
/** * Recreates the original state of the collection. */ public void recreateOriginalCollection(Object currentCollection, AbstractSession session) { if(currentCollection == null) { this.setOriginalCollection(null); return; } if(currentCollection instanceof IndirectCollection) { // to avoid raising event when we add/remove elements from this collection later in this method. setOriginalCollection(((IndirectCollection)currentCollection).getDelegateObject()); } else { setOriginalCollection(currentCollection); } internalRecreateOriginalCollection(this.originalCollection, session); clearChanges(); }
/** * INTERNAL: * Merge changes from the source to the target object. Because this is a * collection mapping, values are added to or removed from the collection * based on the change set. * Synchronize if system property is specified. If not, default to clone the * target collection. No need to synchronize if the collection is new. */ public void mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge) { if (isSynchronizeOnMerge && !changeRecord.getOwner().isNew()) { // Ensure the collection is synchronized while changes are being made, // clone also synchronizes on collection (does not have cache key read-lock for indirection). // Must synchronize of the real collection as the clone does so. Object synchronizedValueOfTarget = valueOfTarget; if (valueOfTarget instanceof IndirectCollection) { synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); } synchronized (synchronizedValueOfTarget) { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } } else { // Using cloned target object passed instead of synchronization. mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } }
/** * INTERNAL: * Merge changes from the source to the target object. Because this is a * collection mapping, values are added to or removed from the collection * based on the change set. * Synchronize if system property is specified. If not, default to clone the * target collection. No need to synchronize if the collection is new. */ @Override public void mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge) { if (isSynchronizeOnMerge && !changeRecord.getOwner().isNew()) { // Ensure the collection is synchronized while changes are being made, // clone also synchronizes on collection (does not have cache key read-lock for indirection). // Must synchronize of the real collection as the clone does so. Object synchronizedValueOfTarget = valueOfTarget; if (valueOfTarget instanceof IndirectCollection) { synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); } synchronized(synchronizedValueOfTarget) { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } } else { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } }
/** * INTERNAL: * Merge changes from the source to the target object. Because this is a * collection mapping, values are added to or removed from the collection * based on the change set. * Synchronize if system property is specified. If not, default to clone the * target collection. No need to synchronize if the collection is new. */ public void mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge) { if (isSynchronizeOnMerge && !changeRecord.getOwner().isNew()) { // Ensure the collection is synchronized while changes are being made, // clone also synchronizes on collection (does not have cache key read-lock for indirection). // Must synchronize of the real collection as the clone does so. Object synchronizedValueOfTarget = valueOfTarget; if (valueOfTarget instanceof IndirectCollection) { synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); } synchronized (synchronizedValueOfTarget) { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } } else { // Using cloned target object passed instead of synchronization. mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } }
/** * INTERNAL: * Merge changes from the source to the target object. Because this is a * collection mapping, values are added to or removed from the collection * based on the change set. * Synchronize if system property is specified. If not, default to clone the * target collection. No need to synchronize if the collection is new. */ @Override public void mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession targetSession, boolean isSynchronizeOnMerge) { if (isSynchronizeOnMerge && !changeRecord.getOwner().isNew()) { // Ensure the collection is synchronized while changes are being made, // clone also synchronizes on collection (does not have cache key read-lock for indirection). // Must synchronize of the real collection as the clone does so. Object synchronizedValueOfTarget = valueOfTarget; if (valueOfTarget instanceof IndirectCollection) { synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); } synchronized(synchronizedValueOfTarget) { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } } else { mergeChanges(changeRecord, valueOfTarget, shouldMergeCascadeParts, mergeManager, targetSession); } }
/** * Recreates the original state of the collection. */ public void recreateOriginalCollection(Object currentCollection, AbstractSession session) { if(currentCollection == null) { this.setOriginalCollection(null); return; } if(currentCollection instanceof IndirectCollection) { // to avoid raising event when we add/remove elements from this collection later in this method. setOriginalCollection(((IndirectCollection)currentCollection).getDelegateObject()); } else { setOriginalCollection(currentCollection); } internalRecreateOriginalCollection(this.originalCollection, session); clearChanges(); }
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); if(((DirectCollectionChangeRecord)changeRecord).orderHasBeenRepaired()) { if(valueOfTarget instanceof IndirectList) {
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject();
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject();
synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject();
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject();
synchronizedValueOfTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); if(changeRecord.orderHasBeenRepaired()) { if(valueOfTarget instanceof IndirectList) {
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); if (((DirectCollectionChangeRecord)changeRecord).orderHasBeenRepaired() && (valueOfTarget instanceof IndirectList)) { ((IndirectList)valueOfTarget).setIsListOrderBrokenInDb(false);
synchronizationTarget = ((IndirectCollection)valueOfTarget).getDelegateObject(); if (((DirectCollectionChangeRecord)changeRecord).orderHasBeenRepaired() && (valueOfTarget instanceof IndirectList)) { ((IndirectList)valueOfTarget).setIsListOrderBrokenInDb(false);