Hi!

http://argouml.tigris.org/issues/show_bug.cgi?id=6010

Currently examining this issue again, but I'm unsure, if I fully
understand the problem.

Maybe someone with more knowledge is reading here... :-)

Correct me, where I'm wrong, please.

As I currently understand it, this method returns the
associations to all importing packages?

We don't have the ModelManagement object anymore in UML2?

We don't have (and I guess we don't need) the method to
fetch the outermost package anymore?

getNearestPackage would only return _one_ importing package?
(But we need all of them?)

Just commited some code:

==============
    /**
     * Get all the relationsships, that represent
     * an import of this element.
     *
     * @param handle The imported model element
     *
     * @return A collection of ElementImport object, that represent imports of 
this object.
     */
    public Collection getElementImports2(Object handle) {
        if (!(handle instanceof Element)) {
            throw new IllegalArgumentException();
        }
        
        Collection result = new ArrayList();

        // Get all the relationships, that this model element has.
        // and filter everything, that is not an import.
        for( Relationship rel : ((Element)handle).getRelationships()) {
            if( (rel instanceof ElementImport)
                && ((ElementImport)rel).getImportedElement() == handle) {

                result.add( rel);
            }
        }
        return result;
        // throw new NotYetImplementedException();
    }
==============

I checked a critic and it called getPackage for the returned elements
in the collection, so ElementImport objects are sufficient and
we don't have to get the imported package here?

I'm unsure if the 2nd test, whether the imported element equals
the importing element is actually necessary? Could it happen, that
the method is called with an importing element and the relationships
are refering to other imported elements?

Ciao,
Andreas

-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2464987

To unsubscribe from this discussion, e-mail: 
[[email protected]].
To be allowed to post to the list contact the mailing list moderator, email: 
[[email protected]]

Reply via email to