Dear all,
Hussein and I had a technical discussion regarding the management of
IDs. As you probably know, he contributed some code in that area
that ensures that we don't have duplicate IDs in our models. We had
that problem in the past, especially when users extended the model
via copy & paste (Thanks!).
Turns out that the current implementation does too much: For
instance, it also assigend IDs to xhtml:p elements. While this is
not wrong, it can still create problems. For instance, it may
create false positives when looking for changes.
The key logic lives in
org.eclipse.rmf.reqif10.serialization.ReqIF10ResourceImpl. For now,
I changed the logic to only consider elements from the
ReqIF10Package:
public void setID(final EObject eObject, final String id) {
final EAttribute idAttribute =
eObject.eClass().getEIDAttribute();
if ((idAttribute != null) && (id != null)) {
// Only to this for ReqIF IDs (and not for XHTML,
etc.)
if (idAttribute.getEType().eContainer() instanceof
ReqIF10Package) {
eObject.eSet(idAttribute, id);
}
}
super.setID(eObject, id);
}
The question to the dev group is: Is this a good solution? In
particular, Hussein suggests to turn the logic around: explicitly
exclude XHTML and continue ID management for everything else.
Any thoughts?
Thanks & best wishes,
- Michael
|