/** * INTERNAL: * Build and return a database row built with the values from * the specified attribute value. */ protected AbstractRecord buildRowFromAggregate(Object object, Object attributeValue, AbstractSession session) throws DescriptorException { return buildRowFromAggregate(object, attributeValue, session, false); }
/** * INTERNAL: * A subclass should implement this method if it wants different behaviour. * Write the foreign key values from the attribute to the row. */ public void writeFromAttributeIntoRow(Object attribute, AbstractRecord row, AbstractSession session) { AbstractRecord targetRow = buildRowFromAggregate(null, attribute, session); for (Enumeration stream = targetRow.keys(); stream.hasMoreElements(); ) { DatabaseField field = (DatabaseField) stream.nextElement(); Object value = targetRow.get(field); row.put(field, value); } }
/** * INTERNAL: * Get the attribute value from the object and add the appropriate * values to the specified database row. */ public void writeFromObjectIntoRow(Object object, AbstractRecord databaseRow, AbstractSession session) throws DescriptorException { if (isReadOnly()) { return; } AbstractRecord targetRow = buildRowFromAggregate(object, getAttributeValueFromObject(object), session); for (Enumeration stream = targetRow.keys(); stream.hasMoreElements();) { DatabaseField field = (DatabaseField)stream.nextElement(); Object value = targetRow.get(field); databaseRow.add(field, value); } }