Map sourceToTargetKeyFields = ((OneToOneMapping)object).getSourceToTargetKeyFields();
List associations = new ArrayList(sourceToTargetKeyFields.size());
Iterator iterator = sourceToTargetKeyFields.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
associations.add(new Association(entry.getKey(), entry.getValue()));
}
return associations;
}
public void setAttributeValueInObject(Object object, Object value) {
OneToOneMapping mapping = (OneToOneMapping)object;
List associations = (List)value;
mapping.setSourceToTargetKeyFields(new HashMap(associations.size() + 1));
mapping.setTargetToSourceKeyFields(new HashMap(associations.size() + 1));
Iterator iterator = associations.iterator();
while (iterator.hasNext()) {
Association association = (Association)iterator.next();
mapping.getSourceToTargetKeyFields().put((DatabaseField)association.getKey(), (DatabaseField)association.getValue());
mapping.getTargetToSourceKeyFields().put((DatabaseField)association.getValue(), (DatabaseField)association.getKey());
}
}
});
sourceToTargetKeyFieldAssociationsMapping.setAttributeName("sourceToTargetKeyFieldAssociations");
sourceToTargetKeyFieldAssociationsMapping.setXPath(getSecondaryNamespaceXPath() + "foreign-key/" + getSecondaryNamespaceXPath() + "field-reference");