@Override public void setAttributeValueInObject(Object object, Object value) { IndirectionPolicy policy = (IndirectionPolicy)value; if (value == null) { policy = new NoIndirectionPolicy(); } ((ForeignReferenceMapping)object).setIndirectionPolicy(policy); } });
/** * INTERNAL: * An object has been serialized from the server to the client. * Replace the transient attributes of the remote value holders * with client-side objects. */ public void fixObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, RemoteSession session) { this.getMapping().fixRealObjectReferences(object, objectDescriptors, processedObjects, query, 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: * Verify that getter returnType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateGetMethodReturnTypeForCollection(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnTypeForCollection(returnType, checker); if (!this.collectionTypeIsValid(returnType)) { checker.handleError(DescriptorException.getMethodReturnTypeNotValid(getCollectionMapping())); } }
/** * INTERNAL: * Verify that attributeType is correct for the * indirection policy. If it is incorrect, add an exception to the * integrity checker. * In this case, the attribute type CANNOT be ValueHolderInterface. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeType(attributeType, checker); if (!this.typeIsValid(attributeType)) { checker.handleError(DescriptorException.attributeAndMappingWithoutIndirectionMismatch(this.getMapping())); } }
/** * INTERNAL: * Verify that setter parameterType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the parameter type CANNOT be ValueHolderInterface. */ public void validateSetMethodParameterType(Class parameterType, IntegrityChecker checker) throws DescriptorException { super.validateSetMethodParameterType(parameterType, checker); if (!this.typeIsValid(parameterType)) { checker.handleError(DescriptorException.parameterAndMappingWithoutIndirectionMismatch(this.mapping)); } }
/** * Set the value of the appropriate attribute of target to attributeValue. * In this case, place the value inside the target's ValueHolder. * if trackChanges is true, set the value in the object as if the user was setting it. Allow change tracking to pick up the change. */ @Override public void setRealAttributeValueInObject(Object target, Object attributeValue, boolean trackChanges) { Object oldValue = null; if (trackChanges && (target instanceof ChangeTracker)) { oldValue = getRealAttributeValueFromObject(target, mapping.getAttributeValueFromObject(target)); } setRealAttributeValueInObject(target, attributeValue); if (trackChanges && (target instanceof ChangeTracker)) { PropertyChangeListener listener = ((ChangeTracker) target)._persistence_getPropertyChangeListener(); if (listener != null && attributeValue != oldValue) { listener.propertyChange(new PropertyChangeEvent(target, mapping.getAttributeName(), oldValue, attributeValue)); } } } }
/** * INTERNAL: * Return whether the collection type is appropriate for the indirection policy. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ protected boolean collectionTypeIsValid(Class collectionType) { return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by the batchQuery. * In this case, extract the result from the query. */ public Object valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey) { return getForeignReferenceMapping().extractResultFromBatchQuery(batchQuery, parentCacheKey, row, originalQuery.getSession(), originalQuery); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by the query. * In this case, wrap the query in a ValueHolder for later invocation. */ public Object valueFromQuery(ReadQuery query, AbstractRecord row, Object sourceObject, AbstractSession session) { return valueFromQuery(query, row, session); }
/** * INTERNAL: * Verify that getter returnType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateGetMethodReturnTypeForCollection(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnTypeForCollection(returnType, checker); if (!this.collectionTypeIsValid(returnType)) { checker.handleError(DescriptorException.getMethodReturnTypeNotValid(getCollectionMapping())); } }
/** * INTERNAL: * Verify that getter returnType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the return type CANNOT be ValueHolderInterface. */ public void validateGetMethodReturnType(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnType(returnType, checker); if (!this.typeIsValid(returnType)) { checker.handleError(DescriptorException.returnAndMappingWithoutIndirectionMismatch(this.getMapping())); } }
/** * INTERNAL: * Verify that attributeType is correct for the * indirection policy. If it is incorrect, add an exception to the * integrity checker. * In this case, the attribute type CANNOT be ValueHolderInterface. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeType(attributeType, checker); if (!this.typeIsValid(attributeType)) { checker.handleError(DescriptorException.attributeAndMappingWithoutIndirectionMismatch(this.mapping)); } }
/** * Set the value of the appropriate attribute of target to attributeValue. * In this case, place the value inside the target's ValueHolder. * if trackChanges is true, set the value in the object as if the user was setting it. Allow change tracking to pick up the change. */ @Override public void setRealAttributeValueInObject(Object target, Object attributeValue, boolean trackChanges) { Object oldValue = null; if (trackChanges && (target instanceof ChangeTracker)) { oldValue = getRealAttributeValueFromObject(target, mapping.getAttributeValueFromObject(target)); } setRealAttributeValueInObject(target, attributeValue); if (trackChanges && (target instanceof ChangeTracker)) { PropertyChangeListener listener = ((ChangeTracker) target)._persistence_getPropertyChangeListener(); if (listener != null && attributeValue != oldValue) { listener.propertyChange(new PropertyChangeEvent(target, mapping.getAttributeName(), oldValue, attributeValue)); } } } }
/** * INTERNAL: * Return whether the collection type is appropriate for the indirection policy. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ protected boolean collectionTypeIsValid(Class collectionType) { return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by the batchQuery. * In this case, extract the result from the query. */ public Object valueFromBatchQuery(ReadQuery batchQuery, AbstractRecord row, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey) { return getForeignReferenceMapping().extractResultFromBatchQuery(batchQuery, parentCacheKey, row, originalQuery.getSession(), originalQuery); }
/** * INTERNAL: * Return the value to be stored in the object's attribute. * This value is determined by the query. * In this case, wrap the query in a ValueHolder for later invocation. */ public Object valueFromQuery(ReadQuery query, AbstractRecord row, Object sourceObject, AbstractSession session) { return valueFromQuery(query, row, session); }
/** * INTERNAL: * Verify that setter parameterType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateSetMethodParameterTypeForCollection(Class parameterType, IntegrityChecker checker) throws DescriptorException { super.validateSetMethodParameterTypeForCollection(parameterType, checker); if (!this.collectionTypeIsValid(parameterType)) { checker.handleError(DescriptorException.setMethodParameterTypeNotValid(getCollectionMapping())); } }
@Override public void setAttributeValueInObject(Object object, Object value) { IndirectionPolicy policy = (IndirectionPolicy)value; if (value == null) { policy = new NoIndirectionPolicy(); } ((ForeignReferenceMapping)object).setIndirectionPolicy(policy); } });
/** * INTERNAL: * Verify that setter parameterType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the parameter type CANNOT be ValueHolderInterface. */ public void validateSetMethodParameterType(Class parameterType, IntegrityChecker checker) throws DescriptorException { super.validateSetMethodParameterType(parameterType, checker); if (!this.typeIsValid(parameterType)) { checker.handleError(DescriptorException.parameterAndMappingWithoutIndirectionMismatch(this.getMapping())); } }