Hi,
In my current implementation (see original post on "Types for
TagDefinitions") the type of TagDefinitions (which has to be a String,
according to UML 1.4) is the full path of the element in some model.
However, all of the methods in org.argouml.kernel.ProjectImpl that find
model elements, namely:
findType(String, boolean),
findTypeInDefaultModel(String)
findTypeInModel(String, Object)
search by name, and therefore cannot distinguish two occurrences of the same
name in different elements. They always return the first match regardless of
the element path. Furthermore, these methods do not search stereotypes
(again, see thread "Types for TagDefinitions"). Therefore, I have
implemented (and tested) two methods that make the search with full path
info (Model.getModelManagementHelper().getPathList(Object)), and that also
find stereotypes:
// find the element in current project (all models)
org.argouml.kernel.ProjectImpl.findElement(List<String>)
// find all element(s) matching a name in a model
org.argouml.kernel.ProjectImpl.findElementsInModel(String,
Object)
- Do you think the two methods are generally useful for Argo?
- Regarding the second method, do you think it would be better to also
provide the path and return only the matching element (I do, now that I
think of it
:-) )?
- An alternative to paths would be to save the TagDefinition type as an
universal, MDR/eUML independent, and permanent (across project save/load)
ID, that would be used to do find the respective element. Does it exist such
and ID in Argo, or are there any plans/needs to go in that direction?
Regards,
Sergio.