if (!isWriteOnly()) { Object firstValue = getRealAttributeValueFromObject(firstObject, session); Object secondValue = getRealAttributeValueFromObject(secondObject, session); if (firstValue == secondValue) { return true;
if (!isWriteOnly()) { Object firstValue = getRealAttributeValueFromObject(firstObject, session); Object secondValue = getRealAttributeValueFromObject(secondObject, session); if (firstValue == secondValue) { return true;
/** * INTERNAL: * Merge changes from the source to the target object. Which is the original from the parent UnitOfWork */ @Override public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isWriteOnly()) { return; } // PERF: If not mutable then just set the value from the source. if (!isMutable() && (source != null)) { setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; } AbstractRecord record = (AbstractRecord)((TransformationMappingChangeRecord)changeRecord).getRecord(); Object attributeValue = invokeAttributeTransformer(record, target, targetSession); setRealAttributeValueInObject(target, attributeValue); }
/** * INTERNAL: * Merge changes from the source to the target object. Which is the original from the parent UnitOfWork */ @Override public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) { if (isWriteOnly()) { return; } // PERF: If not mutable then just set the value from the source. if (!isMutable() && (source != null)) { setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; } AbstractRecord record = (AbstractRecord)((TransformationMappingChangeRecord)changeRecord).getRecord(); Object attributeValue = invokeAttributeTransformer(record, target, targetSession); setRealAttributeValueInObject(target, attributeValue); }
/** * INTERNAL: * Merge changes from the source to the target object. Which is the original from the parent UnitOfWork */ public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager) { if (isWriteOnly()) { return; } if (!isMutable()) { setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; } AbstractRecord record = (AbstractRecord)((TransformationMappingChangeRecord)changeRecord).getRecord(); Object attributeValue = invokeAttributeTransformer(record, target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue); }
/** * INTERNAL: * Copy of the attribute of the object. * This is NOT used for unit of work but for templatizing an object. */ @Override public void buildCopy(Object copy, Object original, CopyGroup group) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object clonedAttributeValue; // If the mapping is read-only, a direct pass through of the value will be performed. // This is done because the method invocation is not possible as the row will be // empty and we have no way to clone the value. // Since the value cannot change anyway we just pass it through. if (isReadOnly() || !isMutable()) { clonedAttributeValue = getRealAttributeValueFromObject(original, group.getSession()); } else { AbstractRecord row = buildPhantomRowFrom(original, group.getSession()); clonedAttributeValue = invokeAttributeTransformer(row, copy, group.getSession()); } this.indirectionPolicy.reset(copy); setRealAttributeValueInObject(copy, clonedAttributeValue); }
/** * INTERNAL: * Copy of the attribute of the object. * This is NOT used for unit of work but for templatizing an object. */ @Override public void buildCopy(Object copy, Object original, CopyGroup group) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object clonedAttributeValue; // If the mapping is read-only, a direct pass through of the value will be performed. // This is done because the method invocation is not possible as the row will be // empty and we have no way to clone the value. // Since the value cannot change anyway we just pass it through. if (isReadOnly() || !isMutable()) { clonedAttributeValue = getRealAttributeValueFromObject(original, group.getSession()); } else { AbstractRecord row = buildPhantomRowFrom(original, group.getSession()); clonedAttributeValue = invokeAttributeTransformer(row, copy, group.getSession()); } this.indirectionPolicy.reset(copy); setRealAttributeValueInObject(copy, clonedAttributeValue); }
setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; Object attribute = getRealAttributeValueFromObject(source, mergeManager.getSession()); if (this.descriptor.getObjectChangePolicy().isObjectChangeTrackingPolicy()) { Object targetAttribute = getRealAttributeValueFromObject(target, mergeManager.getSession()); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && (((targetAttribute == null) && (attribute != null)) || ((targetAttribute != null) && (!targetAttribute.equals(attribute))))) {
setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; Object attribute = getRealAttributeValueFromObject(source, mergeManager.getSession()); if (this.descriptor.getObjectChangePolicy().isObjectChangeTrackingPolicy()) { Object targetAttribute = getRealAttributeValueFromObject(target, mergeManager.getSession()); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && !mergeManager.isForRefresh() && (((targetAttribute == null) && (attribute != null)) || ((targetAttribute != null) && ((attribute == null) || ((!targetAttribute.equals(attribute)) && (!Helper.comparePotentialArrays(targetAttribute, attribute))))))) {
setRealAttributeValueInObject(target, getRealAttributeValueFromObject(source, mergeManager.getSession())); return; Object attribute = getRealAttributeValueFromObject(source, mergeManager.getSession()); if (this.descriptor.getObjectChangePolicy().isObjectChangeTrackingPolicy()) { Object targetAttribute = getRealAttributeValueFromObject(target, mergeManager.getSession()); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && !mergeManager.isForRefresh() && (((targetAttribute == null) && (attribute != null)) || ((targetAttribute != null) && ((attribute == null) || ((!targetAttribute.equals(attribute)) && (!Helper.comparePotentialArrays(targetAttribute, attribute))))))) {