Login | Register
My pages Projects Community openCollabNet

Discussions > modules-dev > Re: [argouml-modules-dev] get model elements in the class diagram

argouml
Discussion topic

Back to topic list

Re: [argouml-modules-dev] get model elements in the class diagram

Author Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk>
Full name Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk>
Date 2005-11-16 19:43:39 PST
Message Bob Tarling wrote:

>Silly me. Try
>
> String packageName = "";
> Object ns = Model.getFacade().ge​tNamespace(myElement​)
> while (Model.getFacade().i​sAPackage(ns)) {
> if (packageName.length != 0) packageName = "." + packageName;
> packageName = Model.getFacade().getName(ns) + packageName;
> }
>
>On 11/12/05, Bob Tarling <bob dot tarling at gmail dot com> wrote:
>
>
>>I don't know of any utilities at the moment (although others may correct me)
>>
>>For each model element returned you will have to something like
>>(haven't tested) -
>>
>> String packageName = "";
>> Object ns = Model.getFacade().ge​tNamespace(myElement​)
>> while (Model.getFacade().i​sAPackage(ns)) {
>> if (packageName.length == 0) packageName += ".";
>> packageName += Model.getFacade().getName(ns);
>> }
>>
>>then test the packageName and reject as you wish.
>>
>>Guys - do we have any need for something like this, or have already?
>>Would it be a sensible addition to the model interface
>>
>>e.g. Model.getFacade().ge​tQualifiedName(myEle​ment);
>>
>>
>>Bob.
>>
>>
>>
>
>----------------​--------------------​--------------------​-------------
>To unsubscribe, e-mail: modules-dev-unsubscr​ibe at argouml dot tigris.o​rg
>For additional commands, e-mail: modules-dev-help@arg​ouml.tigris.org
>
>
>
Cool
Just in case someone wants to do something similar, this is what I did
based on Bob's suggestion
        Collection elements =
modelMgmt.getAllMode​lElementsOfKindWithM​odel(model,
metaTypes.getUMLClass() );
        Collection classes = new ArrayList();
        //filter out all the classes I dont need
        Iterator itr = elements.iterator();
        while(itr.hasNext()){
            Object element = itr.next();
            Vector path = modelMgmt.getPath(element);
            String topMostPackage = (String)path.elementAt(0);
            if(topMostPackage.st​artsWith("java") ||
topMostPackage.start​sWith("ossj") || topMostPackage.start​sWith("org")){
                continue;
            else
                classes.add(element);
        }
        logger.info("returned Classes = "+classes);
        return classes;

Thanks everyone (Bob)
Thapelo

« Previous message in topic | 8 of 9 | Next message in topic »

Messages

Show all messages in topic

get model elements in the class diagram Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> 2005-11-11 19:47:57 PST
     Re: [argouml-modules-dev] get model elements in the class diagram bobtarling Bob Tarling 2005-11-12 03:30:25 PST
         Re: [argouml-modules-dev] get model elements in the class diagram Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> 2005-11-12 04:00:22 PST
             Re: [argouml-modules-dev] get model elements in the class diagram bobtarling Bob Tarling 2005-11-12 05:02:16 PST
                 Re: [argouml-modules-dev] get model elements in the class diagram Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> 2005-11-12 06:35:12 PST
                     Re: [argouml-modules-dev] get model elements in the class diagram bobtarling Bob Tarling 2005-11-12 07:09:53 PST
                         Re: [argouml-modules-dev] get model elements in the class diagram bobtarling Bob Tarling 2005-11-12 07:14:17 PST
                             Re: [argouml-modules-dev] get model elements in the class diagram Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> 2005-11-16 19:43:39 PST
                         Re: [argouml-modules-dev] get model elements in the class diagram Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> Thapelo Tlhong <tt102 at ecs dot soton dot ac dot uk> 2005-11-12 08:44:09 PST
Messages per page: