# To change this template, choose Tools | Templates
# and open the template in the editor.

def import_script
    # Alle Tabellen leeren (nur während der Testphase)
    #VAbwasserGK.delete_all()
    #VAbwasser.delete_all()
    #VAbfallGK.delete_all()
    #VAbfall.delete_all()
    #FreisetzungGK.delete_all()
    #Freisetzung.delete_all()
    #TaetigkeitGK.delete_all()
    #Taetigkeit.delete_all()
    #BetriebGK.delete_all()
    #Betrieb.delete_all()

    # Einlesen der diversen XML-Dateien
    xsdpath = "C:/RISA/code/snv/ruby/e_prtr_xml2_import/data"

    path = "K:/0349-E-PRTR-Query/daten/2009-02-19-von-holger-xml2-sh-und-he"

    toimport = Importer.new(path, "export_xml2_HE_20090216_vertraulich_01.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "PRTR_Export_SH.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    path = "K:/0349-E-PRTR-Query/daten/2009-04-14-von-joheid-xml2-daten"

    toimport = Importer.new(path, "BB_export_xml2_2007_BB.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "BE_2007_xml2_schwellwert_neu.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "BW2_export_xml2_20090311.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_SH_2009-04-01xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_schwellwert SH.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "HB_xml2HB.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "HE_PRTR_HE_2007_20090313.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "HH_uba_XML2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "MV_export_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "MV_export_xml2_Deponien.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "PRTR Export SH.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "RP1_RP_07-05-8364389_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "RP2_RP_07-05-8364389_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "RP_07-01-676284_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "RP_07-05-8290552_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "RP_07-05-8364389_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "SL1_export_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "SL2_export_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "SN1_export_xml2_schwellwert.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "TH_export_xml2_ges.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # zweiter Import
    path = "K:/0349-E-PRTR-Query/daten/2009-04-20-von-holger-st-daten"

    toimport = Importer.new(path, "P2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # dritter Import
    path = "K:/0349-E-PRTR-Query/daten/2009-04-20-von-holger-nw-daten"

    toimport = Importer.new(path, "export_xml2-1.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-3.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-4.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # vierter Import
    path = "K:/0349-E-PRTR-Query/daten/2009-04-22-von-lissewski-by-u-bw"

    toimport = Importer.new(path, "BW_export_xml2_prtr_20090220.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "BY_PRTR_2007_20090414.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # fünfter Import
    path = "K:/0349-E-PRTR-Query/daten/2009-04-27-von-lissewski-ni-daten"

    toimport = Importer.new(path, "NI_PRTR_xml2_bearbeitet.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # sechster Import
    path = "K:/0349-E-PRTR-Query/daten/2009-04-27-von-lissewski-nw-daten/20090405"

    toimport = Importer.new(path, "export_xml2-100.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-300.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-500.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-700.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-900.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    # siebenter Import
    path = "K:/0349-E-PRTR-Query/daten/2009-05-07-von-holger-daten-diverse/BY"

    toimport = Importer.new(path, "BY_PRTR_2007_20090430.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    path = "K:/0349-E-PRTR-Query/daten/2009-05-07-von-holger-daten-diverse/HE"

    toimport = Importer.new(path, "PRTR_HE_2007_20090505.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    path = "K:/0349-E-PRTR-Query/daten/2009-05-07-von-holger-daten-diverse/NW"

    toimport = Importer.new(path, "export_xml2-100-399.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2-500-999.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    path = "K:/0349-E-PRTR-Query/daten/2009-05-07-von-holger-daten-diverse/RP"

    toimport = Importer.new(path, "RP_20090507_xml2.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end

    path = "K:/0349-E-PRTR-Query/daten/2009-05-07-von-holger-daten-diverse/SN"

    toimport = Importer.new(path, "export_xml2_10.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_20.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_30.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_40.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_50.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_FNE_2007.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_lfug.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
    toimport = Importer.new(path, "export_xml2_OBA.xml", xsdpath, "xml_2.xsd", "C:/Temp")
    if toimport.prepare()
      toimport.import(1)
    end
  end

