/** * INTERNAL: * Get the attribute value from the object and add the appropriate * values to the specified database row. */ public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session) throws DescriptorException { if (this.isReadOnly()) { return; } Object attributeValue = this.getAttributeValueFromObject(object); if (attributeValue == null) { row.put(this.getField(), null); return; } ContainerPolicy cp = this.getContainerPolicy(); Vector nestedRows = new Vector(cp.sizeFor(attributeValue)); for (Object iter = cp.iteratorFor(attributeValue); cp.hasNext(iter);) { Object element = cp.next(iter, session); // convert the value - if necessary if (hasConverter()) { element = getConverter().convertObjectValueToDataValue(element, session); } nestedRows.addElement(buildCompositeRow(element, session, row)); } Object fieldValue = null; if (!nestedRows.isEmpty()) { fieldValue = this.getReferenceDescriptor().buildFieldValueFromNestedRows(nestedRows, getStructureName(), session); } row.put(this.getField(), fieldValue); }
element = getConverter().convertObjectValueToDataValue(element, session); nestedRows.addElement(buildCompositeRow(element, session, row, writeType));
element = getConverter().convertObjectValueToDataValue(element, session); nestedRows.addElement(buildCompositeRow(element, session, row, writeType));