aggregateToSourceFieldNameAssociationsMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
/*bug 322233: AttributeOverrides and AssociationOverride
* changed getAggregateToSourceFieldAssociations to hold String->DatabaseField associations
*/
AggregateObjectMapping mapping = (AggregateObjectMapping)object;
Vector associations = mapping.getAggregateToSourceFieldAssociations();
Vector translations = new Vector(associations.size());
for (int index = 0; index < associations.size(); index++) {
Association association = (Association)associations.get(index);
FieldTranslation translation = new FieldTranslation();
translation.setKey(new DatabaseField((String)association.getKey()));
translation.setValue(association.getValue());
translations.add(translation);
}
return translations;
}
public void setAttributeValueInObject(Object object, Object value) {
AggregateObjectMapping mapping = (AggregateObjectMapping)object;
Vector associations = (Vector)value;
for (int index = 0; index < associations.size(); index++) {
Association association = (Association)associations.get(index);
association.setKey(((DatabaseField)association.getKey()).getQualifiedName());
}
mapping.setAggregateToSourceFieldAssociations(associations);
}
});
aggregateToSourceFieldNameAssociationsMapping.setAttributeName("aggregateToSourceFieldNameAssociationsMapping");
aggregateToSourceFieldNameAssociationsMapping.setXPath(getPrimaryNamespaceXPath() + "field-translations/" + getPrimaryNamespaceXPath() + "field-translation");
descriptor.addMapping(aggregateToSourceFieldNameAssociationsMapping);