protected UnitOfWorkValueHolder(ValueHolderInterface attributeValue, Object clone, DatabaseMapping mapping, UnitOfWorkImpl unitOfWork) { this.wrappedValueHolder = attributeValue; this.mapping = mapping; this.session = unitOfWork; this.sourceAttributeName = mapping.getAttributeName(); this.relationshipSourceObject = clone; }
/** * INTERNAL: * Print the mapping attribute name, this is used in error messages. */ public String toString() { return getClass().getName() + "[" + getAttributeName() + "]"; }
/** * PUBLIC: * Returns the mapping associated with a given attribute name. * This can be used to find a descriptors mapping in a amendment method before the descriptor has been initialized. */ public DatabaseMapping getMappingForAttributeName(String attributeName) { // ** Don't use this internally, just for amendments, see getMappingForAttributeName on ObjectBuilder. for (Enumeration mappingsNum = mappings.elements(); mappingsNum.hasMoreElements();) { DatabaseMapping mapping = (DatabaseMapping)mappingsNum.nextElement(); if ((mapping.getAttributeName() != null) && mapping.getAttributeName().equals(attributeName)) { return mapping; } } return null; }
/** * INTERNAL: * This will return the attribute names for all the direct to field mappings * on this descriptor metadata. This method will typically be called when an * @Embedded or @EmbeddedId attribute has been specified in an @OrderBy. */ public List<String> getOrderByAttributeNames() { if (m_orderByAttributeNames.isEmpty()) { for (DatabaseMapping mapping : getMappings()) { if (mapping.isDirectToFieldMapping()) { m_orderByAttributeNames.add(mapping.getAttributeName()); } } } return m_orderByAttributeNames; }
public static DescriptorException invalidAttributeTypeForProxyIndirection(Class attributeType, Class[] targetInterfaces, DatabaseMapping mapping) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < targetInterfaces.length; i++) { buffer.append(((Class)targetInterfaces[i]).getName()); if (i != (targetInterfaces.length - 1)) { buffer.append(", "); } } Object[] args = { mapping.getAttributeName(), mapping.getDescriptor().getJavaClass().getName(), attributeType.getName(), buffer.toString(), CR }; DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_ATTRIBUTE_TYPE_FOR_PROXY_INDIRECTION, args), mapping); descriptorException.setErrorCode(INVALID_ATTRIBUTE_TYPE_FOR_PROXY_INDIRECTION); return descriptorException; }
/** * ADVANCED: * Set the attributeAccessor. * The attribute accessor is responsible for setting and retrieving the attribute value * from the object for this mapping. * This can be set to an implementor of AttributeAccessor if the attribute * requires advanced conversion of the mapping value, or a real attribute does not exist. */ public void setAttributeAccessor(AttributeAccessor attributeAccessor) { String attributeName = getAttributeName(); this.attributeAccessor = attributeAccessor; if (attributeAccessor.getAttributeName() == null) { attributeAccessor.setAttributeName(attributeName); } }
public static DescriptorException indirectContainerInstantiationMismatch(Object attributeValue, DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName(), attributeValue, CR }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INDIRECT_CONTAINER_INSTANTIATION_MISMATCH, args), mapping); exception.setErrorCode(INDIRECT_CONTAINER_INSTANTIATION_MISMATCH); return exception; }
public static DescriptorException parameterAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(PARAMETER_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException returnAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(RETURN_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException attributeAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String validTypeName) { Object[] args = { mapping.getAttributeName(), validTypeName }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException parameterAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String validTypeName) { Object[] args = { mapping.getAttributeName(), validTypeName }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(PARAMETER_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException attributeAndMappingWithIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITH_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException attributeAndMappingWithoutIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, ATTRIBUTE_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(ATTRIBUTE_AND_MAPPING_WITHOUT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException parameterAndMappingWithIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, PARAMETER_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(PARAMETER_AND_MAPPING_WITH_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException returnAndMappingWithIndirectionMismatch(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITH_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(RETURN_AND_MAPPING_WITH_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException returnAndMappingWithTransparentIndirectionMismatch(DatabaseMapping mapping, String validTypeName) { Object[] args = { mapping.getAttributeName(), validTypeName }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, RETURN_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH, args), mapping); exception.setErrorCode(RETURN_AND_MAPPING_WITH_TRANSPARENT_INDIRECTION_MISMATCH); return exception; }
public static DescriptorException unsupportedTypeForBidirectionalRelationshipMaintenance(DatabaseMapping mapping, oracle.toplink.essentials.internal.queryframework.ContainerPolicy containerPolicy) { Object[] args = { mapping.getAttributeName(), containerPolicy }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, UNSUPPORTED_TYPE_FOR_BIDIRECTIONAL_RELATIONSHIP_MAINTENANCE, args), mapping); exception.setErrorCode(UNSUPPORTED_TYPE_FOR_BIDIRECTIONAL_RELATIONSHIP_MAINTENANCE); return exception; }
public static DescriptorException valueHolderInstantiationMismatch(Object attributeValue, DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName(), attributeValue }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, VALUE_HOLDER_INSTANTIATION_MISMATCH, args), mapping); exception.setErrorCode(VALUE_HOLDER_INSTANTIATION_MISMATCH); return exception; }
public static DescriptorException invalidMappingType(DatabaseMapping mapping) { Object[] args = { mapping.getAttributeName() }; DescriptorException descriptorException = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INVALID_MAPPING_TYPE, args), mapping); descriptorException.setErrorCode(INVALID_MAPPING_TYPE); return descriptorException; }
/** * INTERNAL: * Check if the mapping is part of the partial attributes. */ public boolean shouldReadMapping(DatabaseMapping mapping) { if ((!hasPartialAttributeExpressions()) && (!hasFetchGroupAttributeExpressions())) { return true; } // bug 3659145 if (hasFetchGroupAttributeExpressions()) { return isFetchGroupAttribute(mapping.getAttributeName()); } return true; }