Beispiel #1
0
def import_android_doc_website_for_method():
    method_id_list = get_android_method_data()
    if method_id_list is not None and len(method_id_list) > 0:
        for method_id in method_id_list:
            api_entity = APIEntity.find_by_id(session, method_id)
            if api_entity is not None:
                url = construct_android_method_url(api_entity)
                if url is not None and url is not "":
                    api_document_website = APIDocumentWebsite(api_entity.id, url)
                    api_document_website.find_or_create(session, autocommit=False)
        session.commit()
Beispiel #2
0
def import_android_doc_website_for_package():
    package_id_list = get_android_package_data()
    if package_id_list is not None and len(package_id_list) > 0:
        for package_id in package_id_list:
            api_entity = APIEntity.find_by_id(session, package_id)
            url = construct_android_package_url(api_entity)
            print url
            if api_entity is not None and url is not "":
                api_document_website = APIDocumentWebsite(api_entity.id, url)
                print api_document_website
                api_document_website.find_or_create(session=session, autocommit=False)
        session.commit()
def import_android_doc_website_for_class():
    class_id_list = get_android_class_data()
    if class_id_list is not None and len(class_id_list) > 0:
        for class_id in class_id_list:
            api_entity = APIEntity.find_by_id(session, class_id)
            if api_entity is not None:
                url = construct_android_class_ur(api_entity)
                if url is not None and url != "":
                    api_document_website = APIDocumentWebsite(
                        api_entity.id, url)
                    api_document_website.find_or_create(session,
                                                        autocommit=False)
        session.commit()
def import_all_jdk_method_doc_website_relation():
    # with open("url.txt", 'w') as f:
    id_list = get_data_id_list()
    for each in id_list:
        print "start_row_id: ", each[0], ", end_row_id: ", each[1]
        sql = "select * from api_doc.jdk_method where method_id = " + str(
            each[0])
        cur.execute(sql)
        method_data = cur.fetchone()
        method_name, class_website = get_properties_from_jdk_method(
            method_data)
        qualified_name, full_declaration = get_property_from_api_entity(
            each[1])
        url = create_doc_website_relation(method_name, full_declaration,
                                          qualified_name, class_website)
        if url is not None:
            api_document_website = APIDocumentWebsite(each[1], url)
            api_document_website.find_or_create(session, autocommit=False)
            # f.write(url)
            # f.write("\n")
    session.commit()