/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the mapping's AttributeTransformer */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return getTransformationMapping().invokeAttributeTransformer(row, object, session); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the mapping's AttributeTransformer */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return getTransformationMapping().invokeAttributeTransformer(row, object, session); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by invoking the mapping's AttributeTransformer */ public Object valueFromMethod(Object object, AbstractRecord row, AbstractSession session) { return getTransformationMapping().invokeAttributeTransformer(row, object, session); }
/** * INTERNAL: * Used during building the backup shallow copy to copy the vector without re-registering the target objects. * For 1-1 or ref the reference is from the clone so it is already registered. */ public Object buildBackupCloneForPartObject(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) { if (!isMutable()) { return attributeValue; } AbstractRecord row = this.buildPhantomRowFrom(clone, unitOfWork); return this.invokeAttributeTransformer(row, backup, unitOfWork); }
/** * INTERNAL: * Require for cloning, the part must be cloned. * Ignore the attribute value, go right to the object itself. */ public Object buildCloneForPartObject(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) { if (isReadOnly() || !isMutable()) { return attributeValue; } AbstractRecord row = buildPhantomRowFrom(original, cloningSession); return invokeAttributeTransformer(row, clone, cloningSession); }
/** * INTERNAL: * Require for cloning, the part must be cloned. * Ignore the attribute value, go right to the object itself. */ @Override public Object buildCloneForPartObject(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) { if (isReadOnly() || !isMutable()) { return attributeValue; } AbstractRecord row = buildPhantomRowFrom(original, cloningSession); return invokeAttributeTransformer(row, clone, cloningSession); }
/** * 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. */ public void buildCopy(Object copy, Object original, ObjectCopyingPolicy policy) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object attributeValue = getAttributeValueFromObject(original); 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 = attributeValue; } else { AbstractRecord row = this.buildPhantomRowFrom(original, policy.getSession()); clonedAttributeValue = invokeAttributeTransformer(row, copy, policy.getSession()); } setAttributeValueInObject(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); }
/** * 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); }
Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && (!row.get(field).equals(targetRow.get(field)))) { this.descriptor.getObjectChangePolicy().raiseInternalPropertyChangeEvent(target, getAttributeName(), invokeAttributeTransformer(targetRow, source, mergeManager.getSession()), attributeValue); break;
Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && (!row.get(field).equals(targetRow.get(field)))) { this.descriptor.getObjectChangePolicy().raiseInternalPropertyChangeEvent(target, getAttributeName(), invokeAttributeTransformer(targetRow, source, mergeManager.getSession()), attributeValue); break;
Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue); if ((mergeManager.shouldMergeCloneIntoWorkingCopy() || mergeManager.shouldMergeCloneWithReferencesIntoWorkingCopy()) && (!row.get(field).equals(targetRow.get(field)))) { this.descriptor.getObjectChangePolicy().raiseInternalPropertyChangeEvent(target, getAttributeName(), invokeAttributeTransformer(targetRow, source, mergeManager.getSession()), attributeValue); break;