/[gnue]/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
ViewVC logotype

Diff of /gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by jcater, Fri Oct 10 01:21:12 2003 UTC revision 1.1.2.2 by jcater, Fri Nov 7 16:14:20 2003 UTC
# Line 68  class Introspection(GIntrospection.Intro Line 68  class Introspection(GIntrospection.Intro
68          return []          return []
69    
70        try:        try:
71          listcursor = self._connection.request('gnue_class',[],['gnue_module'],['gnue_name','gnue_comment','gnue_module'])          listcursor = self._dataConnection.request('gnue_class',[],['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
72        except Exception, msg:        except Exception, msg:
73          print "error %s" %msg          print "error %s" %msg
74          GDebug.printMesg(1,_("Error creating introspection module list \n\n --- %s ---)") % msg)          GDebug.printMesg(1,_("Error creating introspection module list \n\n --- %s ---)") % msg)
# Line 89  class Introspection(GIntrospection.Intro Line 89  class Introspection(GIntrospection.Intro
89    
90    
91        listcursor.close()        listcursor.close()
92          
93        return list        return list
94    
95    #############    #############
96    #    #
97    #  get schema for one single business class    #  get schema for one single business class
98    #    #
99    # TODO: Merge into find()    
100    #    def getSchemaByName(self, name, type=None):
   def getSchemaByName(self, name, type=None):  
101        try:        try:
102          listcursor = self._connection.request('gnue_class', [["eq", ""], ["field", "gnue_name"], ["const", name]],          listcursor = self._dataConnection.request('gnue_class', [["eq", ""], ["field", "gnue_name"], ["const", name]],
103                                                    ['gnue_module'],['gnue_name','gnue_comment','gnue_module'])                                                    ['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
104        except Exception, msg:        except Exception, msg:
105          print "error %s" %msg          print "error %s" %msg
106          GDebug.printMesg(1,_("Error fetching class %s \n\n --- %s ---)") % (name,msg))          GDebug.printMesg(1,_("Error fetching class %s \n\n --- %s ---)") % (name,msg))
107          return []          return []
108    
109        data = listcursor.fetch()        data = listcursor.fetch()                        
110        if len(data):        if len(data):
111          classdef = data[0]          classdef = data[0]
112          print classdef          print classdef
# Line 117  class Introspection(GIntrospection.Intro Line 116  class Introspection(GIntrospection.Intro
116                                              'gnue_id':classdef['gnue_id']},                                              'gnue_id':classdef['gnue_id']},
117                                       getChildSchema=self.__getChildSchema)                                       getChildSchema=self.__getChildSchema)
118        listcursor.close()        listcursor.close()
119          
120        return schema        return schema
121        
   
122    #############    #############
123    #    #
124    #  get schema for one single business class    #  get schema for one single business class
125    #    #
126      
127    def __getChildSchema(self, parent):    def __getChildSchema(self, parent):
128        try:        try:
129          # fetch all properties used by class "parent"          # fetch all properties used by class "parent"
130          listcursor = self._connection.request('gnue_property',  # class          listcursor = self._dataConnection.request('gnue_property',  # class
131                                                    [["eq", ""], ["field", "gnue_class"],                                                    [["eq", ""], ["field", "gnue_class"],
132                                                                 ["const", parent.gnue_id]], # condition                                                                 ["const", parent.gnue_id]], # condition
133                                                    ['gnue_module'],  # sort                                                    ['gnue_module'],  # sort
134                                                    ['gnue_name','gnue_comment','gnue_module','gnue_class','gnue_type',                                                    ['gnue_name','gnue_comment','gnue_module','gnue_class','gnue_type',
135                                                     'gnue_length','gnue_scale'])                                                     'gnue_length','gnue_scale'])  
136            
137        except Exception, msg:        except Exception, msg:
138          print "error %s" %msg          print "error %s" %msg
139          GDebug.printMesg(1,_("Error while loading class properties for class %s \n\n --- %s ---)") % (parent.name,msg))          GDebug.printMesg(1,_("Error while loading class properties for class %s \n\n --- %s ---)") % (parent.name,msg))
# Line 144  class Introspection(GIntrospection.Intro Line 142  class Introspection(GIntrospection.Intro
142        list = []        list = []
143        data = ['1']        data = ['1']
144        while len(data):        while len(data):
145          data = listcursor.fetch()          data = listcursor.fetch()                        
146          for propdef in data:          for propdef in data:
147            print propdef            print propdef
148            attrs={'id': "%s.%s" % (parent.id, string.lower(propdef['gnue_name'])),            attrs={'id': "%s.%s" % (parent.id, string.lower(propdef['gnue_name'])),
# Line 166  class Introspection(GIntrospection.Intro Line 164  class Introspection(GIntrospection.Intro
164        listcursor.close()        listcursor.close()
165    
166        return list        return list
167    

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26