예제 #1
0
    def start_file(self, file):

        # we create one object under each file...
        o = CustomObject()
        o.set_type('MyLanguage_Object1')
        o.set_name('name1')
        o.set_parent(file)
        o.save()
예제 #2
0
 def start_file(self, file):
     
     # we create one object under each file...
     o = CustomObject()
     o.set_type('MyLanguage_Object1')
     o.set_name('name1')
     o.set_parent(file)
     o.save()
    def add_sqlnamedquery(sqltable, sql_queries, resultMaps, typeAliases, file,
                          namespace):
        for sqlid, node in sqltable.items():
            log.info('NEW Named Query - %s' % sqlid)

            sqlquery = CustomObject()
            sqlquery.set_name(sqlid)
            sqlquery.set_type('CAST_SQL_NamedQuery')
            sqlquery.set_parent(file)
            sqlquery.save()

            #Get SQL from node
            sql = node.text
            for sub_node in node:
                if 'refid' in sub_node.attrib and sub_node.attrib[
                        'refid'] in sql_queries:
                    sql += sql_queries[sub_node.attrib['refid']].text.strip()
                if sub_node.tail:
                    sql += sub_node.tail

            #log.info('SQL: %s' % sql)
            sqlquery.save_property('CAST_SQL_MetricableQuery.sqlQuery', sql)

            log.info(' - creating links...')
            for embedded in external_link.analyse_embedded(sql):
                for t in embedded.types:
                    #log.info(' - link to : %s' % embedded.callee.get_name())
                    link = create_link(t, sqlquery, embedded.callee)
                    link.mark_as_not_sure()

            #Save all potential properties for later use
            CommonParsing.add_property(sqlquery, node, 'parameterClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'parameterType',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'listClass',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultMap',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'resultType',
                                       typeAliases)
            CommonParsing.add_property(sqlquery, node, 'parameterMap',
                                       typeAliases)

            if (namespace != ''):
                log.debug('Habemus namespacus!')
                sqlquery.save_property('iBatisProperties.namespace', namespace)

            for mapId, mapClass in resultMaps.items():
                if 'resultMap' in node.attrib and node.attrib[
                        'resultMap'] == mapId:
                    log.debug(' - class: %s' % mapClass)
                    sqlquery.save_property('iBatisProperties.class', mapClass)
예제 #4
0
 def start_file(self, file):
     log.debug ('In start_file ... ' + str(file))
     log.info ('In start_file ... ' + str(file))
     self.file_obj = file
     self.file_path = self.file_obj.get_path()
     log.debug("File lists.." + self.file_path)
     
     omnxtObj = CustomObject()
     omnxtObj.set_name("module")
     omnxtObj.set_fullname("C:\\Users\\MKU\\Desktop\\kamal")
     omnxtObj.set_type("OMNEXT_module")
     
     omnxtObj.set_parent(file)
     omnxtObj.set_guid(str(uuid.uuid4())) 
     
     omnxtObj.save()
     
     log.debug ('Object created ... ' + str(omnxtObj))
     log.info ('Object created ... ' + str(omnxtObj))        
예제 #5
0
class Symbol:
    
    def __init__(self, name, parent=None):
        
        self.name = name
        self.parent = parent
        self.position = None
        self.kb_symbol= None

    def save(self, file):
        """
        Save the symbol
        """
        self.kb_symbol = CustomObject()
        self.kb_symbol.set_name(self.name)
        self.kb_symbol.set_type(self.type)
 
        self.kb_symbol.set_parent(self.parent.kb_symbol if self.parent else file)
        self.kb_symbol.save()
        
        self.kb_symbol.save_position(Bookmark(file, *self.position))