root/gaphor/tags/gaphor-0.9.2/utils/getclassdefs.py

Revision 196, 0.6 kB (checked in by arjanmol, 6 years ago)

*** empty log message ***

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 import sys
2 sys.path.append('../build/lib')
3
4 import gaphor.UML as UML
5 import gaphor.storage as storage
6
7 file = sys.argv[1]
8 names = sys.argv[2:]
9 storage.load(file)
10 #clear()
11 select = GaphorResource(UML.ElementFactory).select
12
13 for c in select(lambda e: e.isKindOf(UML.Class) and e.name in names):
14     print 'Class:', c.name
15     if c.feature:
16         print 'Attributes'
17     for a in c.feature:
18         print '\t%s' % a.name
19     if c.association:
20         print 'Associations'
21     for a in c.association:
22         for con in a.association.connection:
23             if con is not a and con.isNavigable:
24                 print '\t%s: %s[%s] %s' % (con.name, con.participant.name, con.multiplicity, a.aggregation)
25     print
26
Note: See TracBrowser for help on using the browser.