/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * PUBLIC: * Indicates if there is a converter on the mapping. */ public boolean hasConverter() { return getConverter() != null; }
/** * INTERNAL: * Extract and return value of the field from the object */ public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) throws DescriptorException { Object attributeValue = this.getAttributeValueFromObject(object); if(this.getConverter() != null) { this.getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { return null; } else { return this.getObjectBuilder(attributeValue, session).extractValueFromObjectForField(attributeValue, field, session); } }
/** * INTERNAL: * Extract and return value of the field from the object */ public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) throws DescriptorException { Object attributeValue = this.getAttributeValueFromObject(object); if(this.getConverter() != null) { this.getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { return null; } else { return this.getObjectBuilder(attributeValue, session).extractValueFromObjectForField(attributeValue, field, session); } }
/** * INTERNAL: * Extract and return value of the field from the object */ public Object valueFromObject(Object object, DatabaseField field, AbstractSession session) throws DescriptorException { Object attributeValue = this.getAttributeValueFromObject(object); if(this.getConverter() != null) { this.getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { return null; } else { return this.getObjectBuilder(attributeValue, session).extractValueFromObjectForField(attributeValue, field, session); } }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record, writeType); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Build the value for the database field and put it in the * specified database row. */ @Override public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, WriteType writeType) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if(getConverter() != null) { getConverter().convertObjectValueToDataValue(attributeValue, session); } if (attributeValue == null) { record.put(this.getField(), null); } else { Object fieldValue = buildCompositeRow(attributeValue, session, record, writeType); record.put(this.getField(), fieldValue); } }
/** * INTERNAL: * Extract and return the aggregate object from * the specified row. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); Object toReturn = buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); if(getConverter() != null) { toReturn = getConverter().convertDataValueToObjectValue(toReturn, executionSession); } return buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }
/** * INTERNAL: * Initialize the mapping. */ public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if (getField() == null) { throw DescriptorException.fieldNameNotSetInMapping(this); } setField(getDescriptor().buildField(getField())); setFields(collectFields()); // initialize the converter - if necessary if (hasConverter()) { getConverter().initialize(this, session); } }