/** * 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: * Directly build a change record without comparison */ public ChangeRecord buildChangeRecord(Object clone, ObjectChangeSet owner, AbstractSession session) { TransformationMappingChangeRecord changeRecord = new TransformationMappingChangeRecord(owner); changeRecord.setRow(this.buildPhantomRowFrom(clone, session)); changeRecord.setAttribute(getAttributeName()); changeRecord.setMapping(this); return changeRecord; }
/** * INTERNAL: * Build a change record. */ public ChangeRecord internalBuildChangeRecord(Object clone, Object oldValue, ObjectChangeSet owner, AbstractSession session) { TransformationMappingChangeRecord changeRecord = new TransformationMappingChangeRecord(owner); changeRecord.setRow(buildPhantomRowFrom(clone, session)); changeRecord.setAttribute(getAttributeName()); changeRecord.setMapping(this); changeRecord.setOldValue(oldValue); return changeRecord; }
/** * INTERNAL: * Build a change record. */ public ChangeRecord internalBuildChangeRecord(Object clone, Object oldValue, ObjectChangeSet owner, AbstractSession session) { TransformationMappingChangeRecord changeRecord = new TransformationMappingChangeRecord(owner); changeRecord.setRow(buildPhantomRowFrom(clone, session)); changeRecord.setAttribute(getAttributeName()); changeRecord.setMapping(this); changeRecord.setOldValue(oldValue); return changeRecord; }
/** * INTERNAL: * Either create a new change record or update the change record with the new value. * This is used by attribute change tracking. */ public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) { TransformationMappingChangeRecord changeRecord = (TransformationMappingChangeRecord)objectChangeSet.getChangesForAttributeNamed(this.getAttributeName()); if (!isWriteOnly()) { if (changeRecord == null) { objectChangeSet.addChange(buildChangeRecord(clone, objectChangeSet, uow)); } else { changeRecord.setRow(this.buildPhantomRowFrom(clone, uow)); } } }
/** * INTERNAL: * Either create a new change record or update the change record with the new value. * This is used by attribute change tracking. */ @Override public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) { TransformationMappingChangeRecord changeRecord = (TransformationMappingChangeRecord)objectChangeSet.getChangesForAttributeNamed(this.getAttributeName()); Object updatedObject = descriptor.getInstantiationPolicy().buildNewInstance(); this.setAttributeValueInObject(updatedObject, newValue); if (!isWriteOnly()) { if (changeRecord == null) { objectChangeSet.addChange(internalBuildChangeRecord(updatedObject, oldValue, objectChangeSet, uow)); } else { changeRecord.setRow(this.buildPhantomRowFrom(updatedObject, uow)); } } }
/** * INTERNAL: * Either create a new change record or update the change record with the new value. * This is used by attribute change tracking. */ @Override public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) { TransformationMappingChangeRecord changeRecord = (TransformationMappingChangeRecord)objectChangeSet.getChangesForAttributeNamed(this.getAttributeName()); Object updatedObject = descriptor.getInstantiationPolicy().buildNewInstance(); this.setAttributeValueInObject(updatedObject, newValue); if (!isWriteOnly()) { if (changeRecord == null) { objectChangeSet.addChange(internalBuildChangeRecord(updatedObject, oldValue, objectChangeSet, uow)); } else { changeRecord.setRow(this.buildPhantomRowFrom(updatedObject, uow)); } } }
/** * 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); }
AbstractRecord row = buildPhantomRowFrom(source, mergeManager.getSession()); Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue);
AbstractRecord row = buildPhantomRowFrom(source, mergeManager.getSession()); Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue);
AbstractRecord row = buildPhantomRowFrom(source, mergeManager.getSession()); Object attributeValue = invokeAttributeTransformer(row, source, mergeManager.getSession()); AbstractRecord targetRow = buildPhantomRowFrom(target, mergeManager.getSession()); setRealAttributeValueInObject(target, attributeValue);