/** * INTERNAL: * Used to update a changeRecord that is stored in the CHangeSet with a new value. */ public void updateChangeRecordForAttribute(String attributeName, Object value) { ChangeRecord changeRecord = (ChangeRecord)getChangesForAttributeNamed(attributeName); if (changeRecord != null) { changeRecord.updateChangeRecordWithNewValue(value); } }
/** * INTERNAL: * Used to update a changeRecord that is stored in the CHangeSet with a new value. */ public void updateChangeRecordForAttribute(DatabaseMapping mapping, Object value) { String attributeName = mapping.getAttributeName(); ChangeRecord changeRecord = (ChangeRecord)getChangesForAttributeNamed(attributeName); // bug 2641228 always ensure that we convert the value to the correct type value = ConversionManager.getDefaultManager().convertObject(value, mapping.getAttributeClassification()); if (changeRecord != null) { changeRecord.updateChangeRecordWithNewValue(value); } else if (mapping.isDirectToFieldMapping()) { //if it is direct to field then this is most likely the result of a forced update and // we will need to merge this object changeRecord = new DirectToFieldChangeRecord(this); changeRecord.setAttribute(attributeName); changeRecord.setMapping(mapping); ((DirectToFieldChangeRecord)changeRecord).setNewValue(value); this.addChange(changeRecord); } }