/** * INTERNAL: * Convert the attribute transformer class name into an AttributeTransformer * If the old-style method name in set, then use a MethodBasedAttributeTRansformer */ protected void initializeAttributeTransformer(AbstractSession databaseSession) throws DescriptorException { if (isWriteOnly()) { return; } this.attributeTransformer.initialize(this); }
/** * INTERNAL: * Check for write-only, one-way transformations. */ public void setAttributeValueInObject(Object object, Object value) { if (isWriteOnly()) { return; } super.setAttributeValueInObject(object, value); }
/** * INTERNAL: * Convert the attribute transformer class name into an AttributeTransformer * If the old-style method name in set, then use a MethodBasedAttributeTRansformer */ protected void initializeAttributeTransformer(AbstractSession databaseSession) throws DescriptorException { if (isWriteOnly()) { return; } this.attributeTransformer.initialize(this); }
/** * INTERNAL: * Check for write-only, one-way transformations. */ public void setAttributeValueInObject(Object object, Object value) { if (isWriteOnly()) { return; } super.setAttributeValueInObject(object, value); }
/** * INTERNAL: * Check for write-only, one-way transformations. */ @Override public void setAttributeValueInObject(Object object, Object value) { if (isWriteOnly()) { return; } super.setAttributeValueInObject(object, value); }
/** * INTERNAL: * Set the value of the attribute mapped by this mapping, * placing it inside a value holder if necessary. * If the value holder is not instantiated then it is instantiated. * Check for write-only, one-way transformations. */ @Override public void setRealAttributeValueInObject(Object object, Object value) throws DescriptorException { if (isWriteOnly()) { return; } this.indirectionPolicy.setRealAttributeValueInObject(object, value); }
/** * INTERNAL: * Set the value of the attribute mapped by this mapping, * placing it inside a value holder if necessary. * If the value holder is not instantiated then it is instantiated. * Check for write-only, one-way transformations. */ @Override public void setRealAttributeValueInObject(Object object, Object value) throws DescriptorException { if (isWriteOnly()) { return; } this.indirectionPolicy.setRealAttributeValueInObject(object, value); }
/** * INTERNAL: * Convert the attribute transformer class name into an AttributeTransformer * If the old-style method name in set, then use a MethodBasedAttributeTRansformer */ protected void initializeAttributeTransformer(AbstractSession databaseSession) throws DescriptorException { if (isWriteOnly()) { return; } getAttributeTransformer().initialize(this); }
/** * INTERNAL: * Check for write-only, one-way transformation. */ @Override public Object getAttributeValueFromObject(Object object) throws DescriptorException { if (isWriteOnly()) { return null; } Object attributeValue = super.getAttributeValueFromObject(object); return this.indirectionPolicy.validateAttributeOfInstantiatedObject(attributeValue); }
/** * INTERNAL: * Check for write-only, one-way transformation. */ public Object getAttributeValueFromObject(Object object) throws DescriptorException { if (isWriteOnly()) { return null; } Object attributeValue = super.getAttributeValueFromObject(object); return this.indirectionPolicy.validateAttributeOfInstantiatedObject(attributeValue); }
/** * INTERNAL: * Set the value of the attribute mapped by this mapping, * placing it inside a value holder if necessary. * If the value holder is not instantiated then it is instantiated. * Check for write-only, one-way transformations. */ public void setRealAttributeValueInObject(Object object, Object value) throws DescriptorException { if (this.isWriteOnly()) { return; } this.getIndirectionPolicy().setRealAttributeValueInObject(object, value); }
/** * INTERNAL: * Check for write-only, one-way transformation. */ public Object getAttributeValueFromObject(Object object) throws DescriptorException { if (isWriteOnly()) { return null; } Object attributeValue = super.getAttributeValueFromObject(object); return getIndirectionPolicy().validateAttributeOfInstantiatedObject(attributeValue); }
/** * INTERNAL: * Clone the attribute from the clone and assign it to the backup. */ @Override public void buildBackupClone(Object clone, Object backup, UnitOfWorkImpl unitOfWork) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object attributeValue = getAttributeValueFromObject(clone); Object clonedAttributeValue = this.indirectionPolicy.backupCloneAttribute(attributeValue, clone, backup, unitOfWork); setAttributeValueInObject(backup, clonedAttributeValue); }
/** * INTERNAL: * Clone the attribute from the original and assign it to the clone. */ @Override public void buildClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object attributeValue = getAttributeValueFromObject(original); Object clonedAttributeValue = this.indirectionPolicy.cloneAttribute(attributeValue, original, cacheKey, clone, refreshCascade, cloningSession, false);// building clone from an original not a row. setAttributeValueInObject(clone, clonedAttributeValue); }
/** * INTERNAL: * Clone the attribute from the clone and assign it to the backup. */ @Override public void buildBackupClone(Object clone, Object backup, UnitOfWorkImpl unitOfWork) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object attributeValue = getAttributeValueFromObject(clone); Object clonedAttributeValue = this.indirectionPolicy.backupCloneAttribute(attributeValue, clone, backup, unitOfWork); setAttributeValueInObject(backup, clonedAttributeValue); }
/** * INTERNAL: * Clone the attribute from the original and assign it to the clone. */ @Override public void buildClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) { // If mapping is a no-attribute transformation mapping, do nothing if (isWriteOnly()) { return; } Object attributeValue = getAttributeValueFromObject(original); Object clonedAttributeValue = this.indirectionPolicy.cloneAttribute(attributeValue, original, cacheKey, clone, refreshCascade, cloningSession, false);// building clone from an original not a row. setAttributeValueInObject(clone, clonedAttributeValue); }
/** * INTERNAL: * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually * mappings are initilaized and serialized reference descriptors are replaced with local descriptors if they already exist on the * remote session. */ public void remoteInitialization(DistributedSession session) { setFieldToTransformers(new Vector()); // Remote mappings is initilaized here again because while serializing only the uninitialized data is passed // as the initialized data is not serializable. if (!isWriteOnly()) { super.remoteInitialization(session); initializeAttributeTransformer(session); } initializeFieldToTransformers(session); }
/** * INTERNAL: * Allow for initialization of properties and validation. */ public void preInitialize(AbstractSession session) throws DescriptorException { if (isWriteOnly()) { return;// Allow for one-way transformations. } super.preInitialize(session); // PERF: Also auto-set mutable to false is the attribute type is a primitive. // This means it is not necessary to clone the value (through double transformation). if ((getAttributeClassification() != null) && (getAttributeClassification().isPrimitive() || Helper.isPrimitiveWrapper(getAttributeClassification()) || getAttributeClassification().equals(ClassConstants.STRING) || getAttributeClassification().equals(ClassConstants.BIGDECIMAL) || getAttributeClassification().equals(ClassConstants.NUMBER))) { setIsMutable(false); } }
/** * INTERNAL: * Allow for initialization of properties and validation. */ @Override public void preInitialize(AbstractSession session) throws DescriptorException { if (isWriteOnly()) { return;// Allow for one-way transformations. } super.preInitialize(session); // PERF: Also auto-set mutable to false is the attribute type is a primitive. // This means it is not necessary to clone the value (through double transformation). if ((getAttributeClassification() != null) && (getAttributeClassification().isPrimitive() || Helper.isPrimitiveWrapper(getAttributeClassification()) || getAttributeClassification().equals(ClassConstants.STRING) || getAttributeClassification().equals(ClassConstants.BIGDECIMAL) || getAttributeClassification().equals(ClassConstants.NUMBER))) { setIsMutable(false); } }
/** * 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)); } } }