diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 063d69e..c1f8be2 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/app/DpmaXmlParser/Config.vb b/app/DpmaXmlParser/Config.vb index f780202..54f581e 100644 --- a/app/DpmaXmlParser/Config.vb +++ b/app/DpmaXmlParser/Config.vb @@ -18,6 +18,7 @@ Public Class AppConfig values.queryIgnore = settings.Item("dpma_query_ignore").Value values.connstring = settings.Item("sql_connstring").Value values.database = settings.Item("sql_database").Value + values.searchType = settings.Item("search_type").Value Return values End Function @@ -38,6 +39,7 @@ Public Class ConfigValues Public queryIgnore As String Public connstring As String Public database As String + Public searchType As String Public Sub New() End Sub diff --git a/app/DpmaXmlParser/DB.vb b/app/DpmaXmlParser/DB.vb index 27d9ce8..e9cabed 100644 --- a/app/DpmaXmlParser/DB.vb +++ b/app/DpmaXmlParser/DB.vb @@ -23,8 +23,8 @@ Public Class DB Return String.Format("[{0}].[dbo].[{1}]", _db, table) End Function - Public Function GetFormId() As Integer - Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}'", Me.formatTable("TBPMO_FORM"), "Marken") + Public Function GetFormIdFor(entityName As String) As Integer + Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}'", Me.formatTable("TBPMO_FORM"), entityName) Return Me.Scalar(sql) End Function @@ -33,7 +33,7 @@ Public Class DB Return Me.Scalar(sql) End Function - Public Function GetProperty(m As Mark, propertyName As String) As Object + Public Function GetPropertyMark(m As Mark, propertyName As String) As Object _logger.Debug("Reading property: {0}, Mark? {1}", propertyName, IsNothing(m)) Dim value = CallByName(m, propertyName, CallType.Get) If (value = Nothing) Then @@ -43,6 +43,16 @@ Public Class DB Return value End Function + Public Function GetPropertyPatent(p As Patent, propertyName As String) As Object + _logger.Debug("Reading property: {0}, Patent? {1}", propertyName, IsNothing(p)) + Dim value = CallByName(p, propertyName, CallType.Get) + If (value = Nothing) Then + value = DBNull.Value + End If + + Return value + End Function + Public Function IsEqual(controlId As Integer, recordId As Integer, valueToCompare As Object) Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") Dim sql = String.Format("SELECT VALUE FROM {0} WHERE CONTROL_ID = {1} AND RECORD_ID = {2}", table, controlId, recordId) @@ -63,7 +73,7 @@ Public Class DB End Function Public Function InsertRecord(formId As Integer) - Dim sql = String.Format("INSERT INTO {0} (FORM_ID, ADDED_WHO) VALUES ({1}, '{2}')", Me.formatTable("TBPMO_RECORD"), formId, Username) + Dim sql = String.Format("INSERT INTO {0} (FORM_ID, ADDED_WHO, RECORD_ENTITY_ID, PARENT_RECORD) VALUES ({1}, '{2}', {1}, 0)", Me.formatTable("TBPMO_RECORD"), formId, Username) Me.NonQuery(sql) Return Me.Scalar("SELECT MAX(GUID) FROM TBPMO_RECORD") End Function @@ -72,14 +82,14 @@ Public Class DB #Region "=== VALUES ===" Public Function InsertValue(controlId As Integer, recordId As Integer, value As Object) Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") - Dim sql = String.Format("INSERT INTO {0} (CONTROL_ID, RECORD_ID, VALUE) VALUES ({1}, {2}, '{3}')", table, controlId, recordId, value) + Dim sql = String.Format("INSERT INTO {0} (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES ({1}, {2}, '{3}', '{4}')", table, controlId, recordId, value, Username) Me.NonQuery(sql) Return Me.Scalar(String.Format("SELECT MAX(GUID) FROM {0} WHERE CONTROL_ID = {1}", table, controlId)) End Function Public Sub UpdateValue(controlId As Integer, recordId As Integer, value As Object) Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") - Dim sql = String.Format("UPDATE {0} SET VALUE = '{1}' WHERE CONTROL_ID = {2} AND RECORD_ID = {3}", table, value, controlId, recordId) + Dim sql = String.Format("UPDATE {0} SET VALUE = '{1}', CHANGED_WHO = '{4}' WHERE CONTROL_ID = {2} AND RECORD_ID = {3} ", table, value, controlId, recordId, Username) Me.NonQuery(sql) End Sub #End Region diff --git a/app/DpmaXmlParser/DPMAConnect.vb b/app/DpmaXmlParser/DPMAConnectMarks.vb similarity index 80% rename from app/DpmaXmlParser/DPMAConnect.vb rename to app/DpmaXmlParser/DPMAConnectMarks.vb index bc9329c..341c25f 100644 --- a/app/DpmaXmlParser/DPMAConnect.vb +++ b/app/DpmaXmlParser/DPMAConnectMarks.vb @@ -1,16 +1,20 @@ Imports DpmaXmlParser.DPMA.Marke +Imports DpmaXmlParser.DPMA.Patent Imports System.Xml -Public Class DPMAConnect - Private _service As DPMAregisterClient +Public Class DPMAConnectMarks + Private _service As DPMA.Marke.DPMAregisterClient + Private _user As String Private _pass As String + Private _type As String - Public Sub New(username As String, password As String) + Public Sub New(username As String, password As String, type As String) _user = username _pass = password + _type = type - _service = New DPMAregisterClient() + _service = New DPMA.Marke.DPMAregisterClient() _service.Open() End Sub @@ -26,7 +30,6 @@ Public Class DPMAConnect If Not IsNothing(ErrorMessage) Then Throw New Exception(ErrorMessage.InnerText) End If - Catch ex As Exception Throw ex End Try @@ -48,4 +51,8 @@ Public Class DPMAConnect Return doc End Function + + + + End Class diff --git a/app/DpmaXmlParser/DPMAConnectPatents.vb b/app/DpmaXmlParser/DPMAConnectPatents.vb new file mode 100644 index 0000000..a15b32d --- /dev/null +++ b/app/DpmaXmlParser/DPMAConnectPatents.vb @@ -0,0 +1,77 @@ +Imports DpmaXmlParser.DPMA.Patent +Imports System.Xml + +Public Class DPMAConnectPatents + Private _service As DPMAregisterClient + + Private _user As String + Private _pass As String + Private _type As String + + Public Sub New(username As String, password As String, type As String) + _user = username + _pass = password + _type = type + + _service = New DPMA.Patent.DPMAregisterClient() + _service.Open() + End Sub + + Public Function SearchPatents(query As String) As XmlDocument + Dim doc As New XmlDocument() + Dim xmlstring As String + + Try + xmlstring = _service.search(_user, _pass, query) + doc.LoadXml(xmlstring) + + Dim ErrorMessage = doc.SelectSingleNode("Hitlist/ErrorMessage") + If Not IsNothing(ErrorMessage) Then + Throw New Exception(ErrorMessage.InnerText) + End If + Catch ex As Exception + Throw ex + End Try + + Return doc + End Function + + Public Function Search(query As String) As XmlDocument + Dim doc As New XmlDocument() + Dim xmlstring As String + + Try + xmlstring = _service.search(_user, _pass, query) + doc.LoadXml(xmlstring) + + Dim ErrorMessage = doc.SelectSingleNode("Hitlist/ErrorMessage") + If Not IsNothing(ErrorMessage) Then + Throw New Exception(ErrorMessage.InnerText) + End If + + Catch ex As Exception + Throw ex + End Try + + Return doc + End Function + + Public Function GetRegisterInfo(aktenzeichen As String) As XmlDocument + Dim doc As New XmlDocument() + Dim xmlstring As String + + Try + xmlstring = _service.getRegisterInfo(_user, _pass, aktenzeichen) + 'xmlstring = _service.getRegisterInfoBySt13Akz(_user, _pass, aktenzeichen) + doc.LoadXml(xmlstring) + Catch ex As Exception + Throw ex + End Try + + Return doc + End Function + + + + +End Class diff --git a/app/DpmaXmlParser/DpmaXmlParser.exe.config b/app/DpmaXmlParser/DpmaXmlParser.exe.config index f2fea94..55e282f 100644 --- a/app/DpmaXmlParser/DpmaXmlParser.exe.config +++ b/app/DpmaXmlParser/DpmaXmlParser.exe.config @@ -13,9 +13,20 @@ + + + + + - + @@ -38,10 +49,10 @@ Beispiel: --> - + - + \ No newline at end of file diff --git a/app/DpmaXmlParser/DpmaXmlParser.vbproj b/app/DpmaXmlParser/DpmaXmlParser.vbproj index a7f1523..58bfdf4 100644 --- a/app/DpmaXmlParser/DpmaXmlParser.vbproj +++ b/app/DpmaXmlParser/DpmaXmlParser.vbproj @@ -93,7 +93,10 @@ - + + + + @@ -111,13 +114,22 @@ Settings.settings True - - + + + + + True True Reference.svcmap + + True + True + Reference.svcmap + + @@ -128,6 +140,22 @@ + + Reference.svcmap + + + Reference.svcmap + + + Reference.svcmap + + + WCF Proxy Generator + Reference.vb + + + + Designer Always @@ -156,12 +184,14 @@ Designer + + diff --git a/app/DpmaXmlParser/ImporterMarks.vb b/app/DpmaXmlParser/ImporterMarks.vb new file mode 100644 index 0000000..1254fc0 --- /dev/null +++ b/app/DpmaXmlParser/ImporterMarks.vb @@ -0,0 +1,43 @@ +Imports System.IO +Imports System.Xml + +Public Class ImporterMarks + Private Shared dpmaMarks As DPMAConnectMarks + Private Shared parserMarks As New ParserMarks() + Private Shared marks As New List(Of Mark) + + Public Shared Function FromDPMA() + Dim query = QuerybuilderMarks.Build(config, database) + Dim mainDoc As XmlDocument + Dim markDoc As XmlDocument + + logger.Info("Sending request with query: \n\n {0}", query) + logger.Info("Search Type: Marks") + + dpmaMarks = New DPMAConnectMarks(config.username, config.password, config.searchType) + + mainDoc = dpmaMarks.Search(query) + mainDoc.Save(MainPathMarks) + + ' Ergebnis auslesen und Marken-Klassen erstellen + marks = parserMarks.ReadMarkXMLFile(MainPathMarks) + + logger.Info("Importing Marks..") + + For Each mark As Mark In marks + Dim akz As String = mark.ApplicationNumber + Dim file As String = Path.Combine(DataDir, $"Mark-Data-{akz}.xml") + + logger.Debug($"Getting Register Info for Mark {akz}") + + markDoc = dpmaMarks.GetRegisterInfo(akz) + markDoc.Save(file) + + parserMarks.ReadMarkRegisterInfoXMLFile(file, mark) + Next + + logger.Info("{0} Marks imported", marks.Count) + + Return marks + End Function +End Class diff --git a/app/DpmaXmlParser/ImporterPatents.vb b/app/DpmaXmlParser/ImporterPatents.vb new file mode 100644 index 0000000..70fb2fb --- /dev/null +++ b/app/DpmaXmlParser/ImporterPatents.vb @@ -0,0 +1,43 @@ +Imports System.IO +Imports System.Xml + +Public Class ImporterPatents + Private Shared dpmaPatents As DPMAConnectPatents + Private Shared parserPatents As New ParserPatents() + Private Shared patents As New List(Of Patent) + + Public Shared Function FromDPMA() + Dim query = QueryBuilderPatents.Build(config, database) + Dim mainDoc As XmlDocument + Dim patentDoc As XmlDocument + + logger.Info("Sending request with query: \n\n {0}", query) + logger.Info("Search Type: Patents") + + dpmaPatents = New DPMAConnectPatents(config.username, config.password, config.searchType) + + mainDoc = dpmaPatents.Search(query) + mainDoc.Save(MainPathPatents) + + ' Ergebnis auslesen und Patent-Klassen erstellen + patents = ParserPatents.ReadPatentXMLFile(MainPathPatents) + + logger.Info("Importing Patents..") + + For Each patent In patents + Dim akz As String = patent.LeadingRegisteredNumber + Dim file As String = Path.Combine(DataDir, $"Patent-Data-{akz}.xml") + + logger.Debug($"Getting Register Info for Patent {akz}") + + patentDoc = dpmaPatents.GetRegisterInfo(akz) + patentDoc.Save(file) + + ParserPatents.ReadPatentRegisterInfoXMLFile(file, patent) + Next + + logger.Info("{0} Patents imported", patents.Count) + + Return patents + End Function +End Class diff --git a/app/DpmaXmlParser/Main.vb b/app/DpmaXmlParser/Main.vb index 8368908..e58e31e 100644 --- a/app/DpmaXmlParser/Main.vb +++ b/app/DpmaXmlParser/Main.vb @@ -4,26 +4,21 @@ Imports System.Xml Imports NLog Module Main - Private logger As Logger - Private mainDoc As XmlDocument Private markDoc As XmlDocument + Private patentDoc As XmlDocument - Private DataDir As String = "Data" - Private LogDir As String = "Log" + Private parserMarks As New ParserMarks() + Private parserPatents As New ParserPatents() - Private MainFile As String = "Importer-SearchData.xml" - Private MainPath As String = Path.Combine(DataDir, MainFile) - - Private p As New Parser() - Private dpma As DPMAConnect - Private db As DB + Private dpmaPatents As DPMAConnectPatents + Private dpmaMarks As DPMAConnectMarks Private query As String - Private config As ConfigValues Private version As String - Private marks As New List(Of Mark) - Private props = New List(Of String) From { + + Private patents As New List(Of Patent) + Private propsMarks = New List(Of String) From { "RegistrationOfficeCode", "RegistrationDate", "RegistrationNumber", @@ -42,11 +37,38 @@ Module Main "ClassificationLong" } + Private propsPatents = New List(Of String) From { + "LeadingRegisteredNumber", ' Aktenzeichen + "Type", ' Schutzrechtsart + "Status", ' Status + "Title", ' Titel + "ICM", 'IPC-Klasse + "ApplicationDate", + "PublicationDate", + "Inventors", + "Applicants", + "Abstract" + } + + Public DataDir As String = "Data" + Public LogDir As String = "Log" + + Public MainFileMarks As String = "DPMA-Marks.xml" + Public MainFilePatents As String = "DPMA-Patents.xml" + Public MainPathMarks As String = Path.Combine(DataDir, MainFileMarks) + Public MainPathPatents As String = Path.Combine(DataDir, MainFilePatents) + + Public logger As Logger + Public config As ConfigValues + Public database As DB + + Sub Main() Try logger = LogManager.GetLogger("Main") config = AppConfig.GetConfiguration() - db = New DB(config.connstring, "DD_ECM") + + database = New DB(config.connstring, config.database) version = AppConfig.GetVersion() logger.Info("{0} (Version {1}) started", My.Application.Info.Title, version) @@ -59,143 +81,236 @@ Module Main Directory.CreateDirectory(LogDir) End If - query = Querybuilder.Build(config, db) + Dim marks As New List(Of Mark) + Dim patents As New List(Of Patent) - ' Abfrage starten - logger.Info("Sending request with query: {0}", query) - dpma = New DPMAConnect(config.username, config.password) - - mainDoc = dpma.Search(query) - mainDoc.Save(MainPath) - - ' Ergebnis auslesen und Marken-Klassen erstellen - marks = p.ReadMarkXMLFile(MainPath) - - logger.Info("Importing Marks..") - - For Each mark As Mark In marks - Dim akz As String = mark.ApplicationNumber - Dim file As String = Path.Combine(DataDir, String.Format("Importer-RegisterData-{0}.xml", akz)) - - logger.Debug("Getting Register Info for {0}", akz) - - markDoc = dpma.GetRegisterInfo(akz) - markDoc.Save(file) - - p.ReadMarkRegisterInfoXMLFile(file, mark) - Next - - logger.Info("{0} Marks imported", marks.Count) - - ' ========================================================================================= - - Dim formId As Integer = db.GetFormId() Dim updatedMarks As Integer = 0 Dim addedMarks As Integer = 0 + Dim failedMarks As Integer = 0 - For Each m As Mark In marks + Dim updatedPatents As Integer = 0 + Dim addedPatents As Integer = 0 + Dim failedPatents As Integer = 0 - logger.Debug("Mark Verbal Element: {0}", m.MarkVerbalElementText) + ' Abfrage starten + If config.searchType.Contains("M") Then + marks = ImporterMarks.FromDPMA() - Dim mainControlId As Integer + Dim formId As Integer = database.GetFormIdFor("Marken") - ' Das eindeutige Control suchen - mainControlId = db.GetControlId(formId) - ' Über mainControlId überprüfen, ob marke vorhanden - Dim markExists As Integer = db.GetRecordId(mainControlId, m.ApplicationNumber) - logger.Debug("Mark {0} exists: {1}", markExists, CBool(markExists)) + For Each m As Mark In marks - ' Wenn noch nicht vorhanden - If (markExists = 0) Then - ' Einen Record erstellen - Dim recordId = db.InsertRecord(formId) - logger.Info("New record created with GUID: " & recordId) - ' Den Leit-Wert einfügen für mainControlId - Dim valueId = db.InsertValue(mainControlId, recordId, m.ApplicationNumber) - addedMarks = addedMarks + 1 - logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", "ApplicationNumber", m.ApplicationNumber, mainControlId) + logger.Debug("Mark Verbal Element: {0}", m.MarkVerbalElementText) - ' alle anderen properties zu dieser marke einfügen einfügen - For Each prop As String In props - ' ControlID für die aktuelle property holen - Dim controlId = db.GetControlId(formId, prop) - ' Wert für die aktuelle property holen - Dim value = db.GetProperty(m, prop) + Dim mainControlId As Integer + + ' Das eindeutige Control suchen + mainControlId = database.GetControlId(formId) + + ' Über mainControlId überprüfen, ob marke vorhanden + Dim markExists As Integer = database.GetRecordId(mainControlId, m.ApplicationNumber) + logger.Debug("Mark {0} exists: {1}", markExists, CBool(markExists)) + + ' Wenn noch nicht vorhanden + If (markExists = 0) Then + Try + ' Einen Record erstellen + Dim recordId = database.InsertRecord(formId) + logger.Info("New record created with GUID: " & recordId) + ' Den Leit-Wert einfügen für mainControlId + Dim valueId = database.InsertValue(mainControlId, recordId, m.ApplicationNumber) + addedMarks = addedMarks + 1 + logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", "ApplicationNumber", m.ApplicationNumber, mainControlId) + + ' alle anderen properties zu dieser marke einfügen + For Each prop As String In propsMarks + ' ControlID für die aktuelle property holen + Dim controlId = database.GetControlId(formId, prop) + ' Wert für die aktuelle property holen + Dim value = database.GetPropertyMark(m, prop) + + If controlId = 0 Then + logger.Warn("Value NOT inserted - ControlId for Property {0} could not be found.") + Continue For + End If + + ' Wert einfügen + database.InsertValue(controlId, recordId, value) + + ' Wenn Bildmarke oder Wort- und Bildmarke, Bild einfügen + If prop = "MarkFeature" Then + If value = "wort-bildmarke" Or value = "bildmarke" Then + Dim imageControlId = database.GetControlId(formId, "MarkImage") + Dim bimage() As Byte = Convert.FromBase64String(m.Image.BinaryImage) + logger.Debug("Image inserted, RecordId: {0}") + database.InsertImage(bimage, imageControlId, recordId) + End If + End If + + logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", prop, value, controlId) + Next + + addedMarks += 1 + Catch ex As Exception + logger.Error($"Exception while ADDING mark {m.ApplicationNumber}: {ex.Message}") + failedMarks += 1 - If controlId = 0 Then - logger.Warn("Value NOT inserted - ControlId for Property {0} could not be found.") Continue For - End If + End Try + Else + Try + ' Marke aktualisieren + Dim recordId As Integer = markExists + Dim propsChanged = False - ' Wert einfügen - db.InsertValue(controlId, recordId, value) + logger.Info("Existing Record updated with GUID: {0}", recordId) - ' Wenn Bildmarke oder Wort- und Bildmarke, Bild einfügen - If prop = "MarkFeature" Then - If value = "wort-bildmarke" Or value = "bildmarke" Then - Dim imageControlId = db.GetControlId(formId, "MarkImage") - Dim bimage() As Byte = Convert.FromBase64String(m.Image.BinaryImage) - logger.Debug("Image inserted, RecordId: {0}") - db.InsertImage(bimage, imageControlId, recordId) - End If - End If + For Each prop As String In propsMarks + ' ControlID für die aktuelle property holen + Dim controlId = database.GetControlId(formId, prop) + ' Wert für die aktuelle property holen + Dim value = database.GetPropertyMark(m, prop) - logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", prop, value, controlId) - Next + ' Wert aktualisieren + database.UpdateValue(controlId, recordId, value) - addedMarks += 1 - Else - ' Marke aktualisieren - Dim recordId As Integer = markExists - Dim propsChanged = False + ' Wenn Bildmarke oder Wort- und Bildmarke, Bild aktualisieren + If prop = "MarkFeature" Then + If value = "wort-bildmarke" Or value = "bildmarke" Then + Dim imageControlId = database.GetControlId(formId, "MarkImage") + Dim bimage() As Byte = Convert.FromBase64String(m.Image.BinaryImage) + database.UpdateImage(bimage, imageControlId, recordId) + End If + End If - logger.Info("Existing Record updated with GUID: {0}", recordId) + logger.Debug("Value updated - Property: {0}, ControlId: {1}", prop, controlId) - For Each prop As String In props - ' ControlID für die aktuelle property holen - Dim controlId = db.GetControlId(formId, prop) - ' Wert für die aktuelle property holen - Dim value = db.GetProperty(m, prop) + 'Dim hasChanged As Boolean = Not db.IsEqual(controlId, recordId, value) + 'logger.Debug("Value for {0} has changed", recordId) - ' Wert aktualisieren - db.UpdateValue(controlId, recordId, value) + 'If hasChanged Then + ' propsChanged = True + ' ' Wert aktualisieren + ' db.UpdateValue(controlId, recordId, value) + ' logger.Debug("Value updated - Property: {0}, ControlId: {1}", prop, controlId) + 'End If + Next - ' Wenn Bildmarke oder Wort- und Bildmarke, Bild aktualisieren - If prop = "MarkFeature" Then - If value = "wort-bildmarke" Or value = "bildmarke" Then - Dim imageControlId = db.GetControlId(formId, "MarkImage") - Dim bimage() As Byte = Convert.FromBase64String(m.Image.BinaryImage) - db.UpdateImage(bimage, imageControlId, recordId) - End If - End If + updatedMarks += 1 + Catch ex As Exception + logger.Error($"Exception while UPDATING mark {m.ApplicationNumber}: {ex.Message}") + failedMarks += 1 - logger.Debug("Value updated - Property: {0}, ControlId: {1}", prop, controlId) + Continue For + End Try + End If + Next - 'Dim hasChanged As Boolean = Not db.IsEqual(controlId, recordId, value) - 'logger.Debug("Value for {0} has changed", recordId) + logger.Info($"{addedMarks} Marks added, {updatedMarks} updated, {failedMarks} failed.") + End If - 'If hasChanged Then - ' propsChanged = True - ' ' Wert aktualisieren - ' db.UpdateValue(controlId, recordId, value) - ' logger.Debug("Value updated - Property: {0}, ControlId: {1}", prop, controlId) - 'End If - Next + If config.searchType.Contains("P") Then + patents = ImporterPatents.FromDPMA() - updatedMarks += 1 - End If - Next + Dim formId As Integer = database.GetFormIdFor("Patente") + + For Each p In patents + + logger.Debug("Patent Title: {0}", p.Title) + + Dim mainControlId As Integer + + ' Das eindeutige Control suchen + mainControlId = database.GetControlId(formId, "LeadingRegisteredNumber") + + ' Über mainControlId überprüfen, ob patent vorhanden + Dim patentExists As Integer = database.GetRecordId(mainControlId, p.LeadingRegisteredNumber) + logger.Debug("Patent {0} exists: {1}", patentExists, CBool(patentExists)) + + + + If (patentExists = 0) Then + Try + ' Einen Record erstellen + Dim recordId = database.InsertRecord(formId) + logger.Info("New record created with GUID: " & recordId) + ' Den Leit-Wert einfügen für mainControlId + Dim valueId = database.InsertValue(mainControlId, recordId, p.LeadingRegisteredNumber) + addedPatents = addedPatents + 1 + logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", "LeadingRegisteredNumber", p.LeadingRegisteredNumber, mainControlId) + + ' alle anderen properties zu dieses patents einfügen + For Each prop As String In propsPatents + ' ControlID für die aktuelle property holen + Dim controlId = database.GetControlId(formId, prop) + ' Wert für die aktuelle property holen + Dim value = database.GetPropertyPatent(p, prop) + + If controlId = 0 Then + logger.Warn("Value NOT inserted - ControlId for Property {0} could not be found.") + Continue For + End If + + ' Wert einfügen + database.InsertValue(controlId, recordId, value) + + logger.Debug("Value inserted - Property: {0}, Value: {1}, ControlId: {2}", prop, value, controlId) + Next + + addedPatents += 1 + Catch ex As Exception + logger.Error($"Exception while ADDING patent {p.LeadingRegisteredNumber}: {ex.Message}") + failedPatents += 1 + + Continue For + End Try + Else + Try + ' Patent aktualisieren + Dim recordId As Integer = patentExists + Dim propsChanged = False + + logger.Info("Existing Record updated with GUID: {0}", recordId) + + For Each prop As String In propsPatents + ' ControlID für die aktuelle property holen + Dim controlId = database.GetControlId(formId, prop) + ' Wert für die aktuelle property holen + Dim value = database.GetPropertyPatent(p, prop) + + If controlId = 0 Then + logger.Warn("Value NOT updated - ControlId for Property {0} could not be found.") + Continue For + End If + + ' Wert aktualisieren + database.UpdateValue(controlId, recordId, value) + + logger.Debug("Value updated - Property: {0}, ControlId: {1}", prop, controlId) + Next + + updatedPatents += 1 + Catch ex As Exception + logger.Error($"Exception while UPDATING patent {p.LeadingRegisteredNumber}: {ex.Message}") + failedPatents += 1 + + Continue For + End Try + End If + Next + + logger.Info($"{addedPatents} Marks added, {updatedPatents} updated, {failedPatents} failed.") + End If - logger.Info("{0} Marks added, {1} updated", addedMarks, updatedMarks) logger.Debug("=================== IMPORT END ===================") - + ReadLine() Catch ex As Exception logger.Error("==================================================") logger.Error("=================== ERROR ========================") logger.Error("==================================================") logger.Error("An Error occurred: {0}", GetExceptionInfo(ex)) - 'Environment.Exit(1) + ReadLine() End Try End Sub diff --git a/app/DpmaXmlParser/Mark.vb b/app/DpmaXmlParser/Mark.vb index cfa17f6..63dd563 100644 --- a/app/DpmaXmlParser/Mark.vb +++ b/app/DpmaXmlParser/Mark.vb @@ -37,10 +37,6 @@ Public Class Mark Return WebUtility.HtmlDecode(value) End Function - Private Function ParseShortDate(value As String) - Return DateTime.Parse(value).ToShortDateString() - End Function - #Region "SearchProperties" Public Property RegistrationOfficeCode As String Get @@ -56,7 +52,7 @@ Public Class Mark Return _RegistrationDate End Get Set(value As String) - _RegistrationDate = ParseShortDate(value) + _RegistrationDate = Utils.ParseShortDate(value) End Set End Property @@ -106,7 +102,7 @@ Public Class Mark Return _ApplicationDate End Get Set(value As String) - _ApplicationDate = ParseShortDate(value) + _ApplicationDate = Utils.ParseShortDate(value) End Set End Property @@ -149,7 +145,7 @@ Public Class Mark Return _PublicationDate End Get Set(value As String) - _PublicationDate = ParseShortDate(value) + _PublicationDate = Utils.ParseShortDate(value) End Set End Property @@ -158,7 +154,7 @@ Public Class Mark Return _ExpiryDate End Get Set(value As String) - _ExpiryDate = ParseShortDate(value) + _ExpiryDate = Utils.ParseShortDate(value) End Set End Property @@ -167,7 +163,7 @@ Public Class Mark Return _TerminationDate End Get Set(value As String) - _TerminationDate = ParseShortDate(value) + _TerminationDate = Utils.ParseShortDate(value) End Set End Property @@ -176,7 +172,7 @@ Public Class Mark Return _OppositionPeriodStartDate End Get Set(value As String) - _OppositionPeriodStartDate = ParseShortDate(value) + _OppositionPeriodStartDate = Utils.ParseShortDate(value) End Set End Property @@ -185,7 +181,7 @@ Public Class Mark Return _OppositionPeriodEndDate End Get Set(value As String) - _OppositionPeriodEndDate = ParseShortDate(value) + _OppositionPeriodEndDate = Utils.ParseShortDate(value) End Set End Property diff --git a/app/DpmaXmlParser/My Project/AssemblyInfo.vb b/app/DpmaXmlParser/My Project/AssemblyInfo.vb index c6ede1a..331deeb 100644 --- a/app/DpmaXmlParser/My Project/AssemblyInfo.vb +++ b/app/DpmaXmlParser/My Project/AssemblyInfo.vb @@ -18,7 +18,7 @@ Imports System.Runtime.InteropServices 'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird - + ' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: ' @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/app/DpmaXmlParser/Parser.vb b/app/DpmaXmlParser/ParserMarks.vb similarity index 99% rename from app/DpmaXmlParser/Parser.vb rename to app/DpmaXmlParser/ParserMarks.vb index 6cf3324..a27b1ce 100644 --- a/app/DpmaXmlParser/Parser.vb +++ b/app/DpmaXmlParser/ParserMarks.vb @@ -1,8 +1,7 @@ Imports System.Xml - Imports System.IO -Public Class Parser +Public Class ParserMarks Private _path As String Private _marks As New List(Of Mark) @@ -203,7 +202,7 @@ Public Class Parser If r.Name = "BasicRecord" Then ReadMarkRecord(r.ReadSubtree(), mark) End If - + End If End If End While diff --git a/app/DpmaXmlParser/ParserPatents.vb b/app/DpmaXmlParser/ParserPatents.vb new file mode 100644 index 0000000..bae4a3c --- /dev/null +++ b/app/DpmaXmlParser/ParserPatents.vb @@ -0,0 +1,194 @@ +Imports System.Xml +Imports System.IO + +Public Class ParserPatents + Private _path As String + Private _patents As New List(Of Patent) + + Public Sub New() + + End Sub +#Region "Parse Results of Search" + Public Function ReadPatentXMLFile(path As String) As List(Of Patent) + Using reader As XmlReader = XmlReader.Create(path) + While reader.Read() + If reader.IsStartElement() Then + If reader.Name = "PatentHitListRecord" Then + Dim patent As Patent = CreatePatent(reader.ReadSubtree()) + _patents.Add(patent) + End If + End If + End While + End Using + + Return _patents + End Function + + Private Function CreatePatent(r As XmlReader) + Dim patent As New Patent() + + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "leading-registered-number" + patent.LeadingRegisteredNumber = r.ReadInnerXml() + Case "registered-number" + patent.RegisteredNumber = r.ReadInnerXml() + Case "type" + patent.Type = r.ReadInnerXml() + Case "invention-title" + patent.Title = r.ReadInnerXml() + Case "edition" + patent.Edition = r.ReadInnerXml() + Case "classification" + patent.Classification = r.ReadInnerXml() + Case "legalstatus" + patent.Status = r.ReadInnerXml() + Case "applicationDate" + patent.ApplicationDate = r.ReadInnerXml() + Case "publicationDate" + patent.PublicationDate = r.ReadInnerXml() + Case "applicant" + patent.ApplicantsList.Add(r.ReadInnerXml()) + Case "inventor" + patent.InventorsList.Add(r.ReadInnerXml()) + End Select + + End If + End If + End While + + Return patent + End Function + +#End Region + +#Region "Parse Results of GetRegisterInfo" + Public Sub ReadPatentRegisterInfoXMLFile(path As String, ByRef p As Patent) + Using reader As XmlReader = XmlReader.Create(path) + While reader.Read() + If reader.IsStartElement() Then + If reader.Name = "dpma-patent-document" Then + ReadPatentDocument(reader.ReadSubtree(), p) + End If + End If + End While + End Using + End Sub + + Public Sub ReadPatentDocument(r As XmlReader, ByRef p As Patent) + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "abstract" + p.Abstract = r.ReadInnerXml() + Case "event-data" + ReadEvent(r.ReadSubtree(), p) + Case "publication-reference" + r.ReadToFollowing("document-id") + ReadPublicationDocument(r.ReadSubtree(), p) + Case "application-reference" + r.ReadToFollowing("document-id") + ReadApplicationDocument(r.ReadSubtree(), p) + End Select + End If + End If + End While + End Sub + + Public Sub ReadPublicationDocument(r As XmlReader, ByRef p As Patent) + Dim pDoc As New PatentDocument + + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "country" + pDoc.Country = r.ReadInnerXml() + Case "doc-number" + pDoc.DocNumber = r.ReadInnerXml() + Case "kind" + pDoc.Kind = r.ReadInnerXml() + End Select + End If + End If + End While + + p.PublicationDocuments.Add(pDoc) + End Sub + + Public Sub ReadApplicationDocument(r As XmlReader, ByRef p As Patent) + Dim pDoc As New PatentDocument + + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "country" + pDoc.Country = r.ReadInnerXml() + Case "doc-number" + pDoc.DocNumber = r.ReadInnerXml() + Case "date" + pDoc.DocDate = r.ReadInnerXml() + End Select + End If + End If + End While + + p.ApplicationDocuments.Add(pDoc) + End Sub + + Public Sub ReadEvent(r As XmlReader, ByRef p As Patent) + Dim pEvent As New PatentEvent + + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "type-of-procedure" + pEvent.Type = r.ReadInnerXml() + Case "procedural-status" + pEvent.Status = r.ReadInnerXml() + Case "date-of-procedural-status" + pEvent.StatusDate = r.ReadInnerXml() + Case "date-of-capture" + pEvent.CaptureDate = r.ReadInnerXml() + Case "publication-info" + ReadPublicationInfo(r.ReadSubtree(), pEvent) + + End Select + End If + End If + End While + + p.Events.Add(pEvent) + End Sub + + Public Sub ReadPublicationInfo(r As XmlReader, ByRef pEvent As PatentEvent) + Dim pub As New PatentPublication + + While r.Read() + If r.IsStartElement() Then + If r.NodeType = XmlNodeType.Element Then + Select Case r.Name + Case "issue-number" + pub.IssueNumber = r.ReadInnerXml() + Case "year" + pub.Year = r.ReadInnerXml() + Case "publication-date" + pub.PublicationDate = r.ReadInnerXml() + Case "publication-type" + pub.PublicationType = r.ReadInnerXml() + Case "part" + pub.Part = r.ReadInnerXml() + End Select + End If + End If + End While + + pEvent.PublicationInfo = pub + End Sub +#End Region +End Class diff --git a/app/DpmaXmlParser/Patent.vb b/app/DpmaXmlParser/Patent.vb new file mode 100644 index 0000000..708b656 --- /dev/null +++ b/app/DpmaXmlParser/Patent.vb @@ -0,0 +1,211 @@ +Imports System.Net +Imports System.Text.RegularExpressions +Imports DpmaXmlParser + +Public Class Patent + ' Aus Search + Private _LeadingRegisteredNumber As String ' leading-registered-number / Aktenzeichen + Private _RN As String ' registered-number + Private _edition As String ' ICM / IPC-Hauptklasse + Private _classification As String ' ICM / IPC-Hauptklasse + Private _type As String ' type / Schutzrechtsart + Private _status As String + Private _title As String + Private _applicants As New List(Of String) + Private _inventors As New List(Of String) + Private _applicationDate As Date + Private _publiccationDate As Date + + ' Aus GetRegisterInfo + Private _abstract As String + Private _events As New List(Of PatentEvent) + Private _applicationDocuments As New List(Of PatentDocument) + Private _publicationDocuments As New List(Of PatentDocument) + + Public Property LeadingRegisteredNumber As String + Get + Return _LeadingRegisteredNumber + End Get + Set(value As String) + _LeadingRegisteredNumber = value + End Set + End Property + + Public Property RegisteredNumber As String + Get + Return _RN + End Get + Set(value As String) + _RN = value + End Set + End Property + + Public Property Type As String + Get + Return _type + End Get + Set(value As String) + _type = value + End Set + End Property + + Public Property Status As String + Get + Return _status + End Get + Set(value As String) + _status = value + End Set + End Property + + Public Property Title As String + Get + Return _title + End Get + Set(value As String) + _title = value + End Set + End Property + + Public ReadOnly Property ICM As String + Get + Return String.Format("{0} ({1})", _classification, _edition) + End Get + End Property + + Public Property Edition As String + Get + Return _edition + End Get + Set(value As String) + _edition = value + End Set + End Property + + Public Property Classification As String + Get + Return _classification + End Get + Set(value As String) + _classification = value + End Set + End Property + + Public Property ApplicationDate As String + Get + Return _applicationDate + End Get + Set(value As String) + _applicationDate = Utils.ParseShortDate(value) + End Set + End Property + + Public Property PublicationDate As String + Get + Return _publiccationDate + End Get + Set(value As String) + _publiccationDate = Utils.ParseShortDate(value) + End Set + End Property + + Public Property ApplicantsList As List(Of String) + Get + Return _applicants + End Get + Set(value As List(Of String)) + _applicants = value + End Set + End Property + + Public ReadOnly Property Applicants As String + Get + Return String.Join(";", _applicants.ToArray()) + End Get + End Property + + Public Property InventorsList As List(Of String) + Get + Return _inventors + End Get + Set(value As List(Of String)) + _inventors = value + End Set + End Property + + Public ReadOnly Property Inventors As String + Get + Return String.Join(";", _inventors.ToArray()) + End Get + End Property + + Public Property Abstract As String + Get + Return _abstract + End Get + Set(value As String) + _abstract = value.Replace("'", "''").Replace("(", "{").Replace(")", "}") + End Set + End Property + + Public Property Events As List(Of PatentEvent) + Get + Return _events + End Get + Set(value As List(Of PatentEvent)) + _events = value + End Set + End Property + + Public Property ApplicationDocuments As List(Of PatentDocument) + Get + Return _applicationDocuments + End Get + Set(value As List(Of PatentDocument)) + _applicationDocuments = value + End Set + End Property + + Public Property PublicationDocuments As List(Of PatentDocument) + Get + Return _publicationDocuments + End Get + Set(value As List(Of PatentDocument)) + _publicationDocuments = value + End Set + End Property +End Class + +Public Class PatentDocument + Private _docdate As Date + + Public Country As String + Public DocNumber As String + Public Kind As String + + Public Property DocDate As String + Get + Return _docdate + End Get + Set(value As String) + _docdate = Utils.ParseShortDate(value) + End Set + End Property +End Class + +Public Class PatentEvent + Public Type As String + Public Status As String + Public StatusDate As Date + Public CaptureDate As Date + + Public PublicationInfo As PatentPublication +End Class + +Public Class PatentPublication + Public IssueNumber As Integer + Public Year As Integer + Public PublicationDate As Date + Public PublicationType As String + Public Part As String +End Class diff --git a/app/DpmaXmlParser/QueryBuilderPatents.vb b/app/DpmaXmlParser/QueryBuilderPatents.vb new file mode 100644 index 0000000..ff6ea63 --- /dev/null +++ b/app/DpmaXmlParser/QueryBuilderPatents.vb @@ -0,0 +1,69 @@ +Public Class QueryBuilderPatents + Public Shared Function Build(config As ConfigValues, db As DB) + Dim mainQuery As String + Dim companies As List(Of String) + Dim stringsToIgnore As New List(Of String) + + ' searchvalues ist entweder eine SQL Abfrage oder eine Semikolongetrennte Liste + If config.query.ToUpper.StartsWith("SELECT") Then + companies = GetLiveQueryResult(config.query, db) + Else + companies = New List(Of String)(config.query.Split(";")) + End If + + If config.queryIgnore.Count > 0 And config.queryIgnore.Contains(";") Then + stringsToIgnore = New List(Of String)(config.queryIgnore.Split(";")) + End If + + mainQuery = BuildMainQuery(companies) + mainQuery &= BuildIgnoreQuery(stringsToIgnore) + + Return mainQuery + End Function + + Public Shared Function BuildMainQuery(companies As List(Of String)) As String + Dim query As String = String.Empty + + For Each company As String In companies + Dim querypart As String = String.Format("(INH=""{0}"" OR IN=""{0}"")", company.Trim()) + + query &= querypart + + ' Bei allen bis auf das letzte Unternehmen einen OR Operator einfügen + If (companies.IndexOf(company) + 1) < companies.Count Then + query &= " OR " + End If + Next + + Return query + End Function + + Public Shared Function BuildIgnoreQuery(stringsToIgnore As List(Of String)) + Dim query As String = String.Empty + + For Each stringToIgnore In stringsToIgnore + Dim querypart As String = String.Format(" NOT (INH=""{0}"" OR IN=""{0}"")", stringToIgnore) + + query &= querypart + Next + + Return query + End Function + + Public Shared Function GetLiveQueryResult(query As String, db As DB) As List(Of String) + Dim result As New List(Of String) + Dim SQL As String = query + Dim DT As DataTable = db.QueryTable(SQL) + + If DT.Rows.Count = 0 Then + Throw New Exception("SQL Abfrage lieferte ein leeres Ergebnis zurück: " & query) + End If + + For Each row As DataRow In DT.Rows + Dim item As String = CStr(row.Item(0)).Trim() + result.Add(row.Item(0)) + Next + + Return result + End Function +End Class diff --git a/app/DpmaXmlParser/Querybuilder.vb b/app/DpmaXmlParser/QuerybuilderMarks.vb similarity index 98% rename from app/DpmaXmlParser/Querybuilder.vb rename to app/DpmaXmlParser/QuerybuilderMarks.vb index cd446b1..12ef177 100644 --- a/app/DpmaXmlParser/Querybuilder.vb +++ b/app/DpmaXmlParser/QuerybuilderMarks.vb @@ -1,4 +1,4 @@ -Public Class Querybuilder +Public Class QuerybuilderMarks Public Shared Function Build(config As ConfigValues, db As DB) Dim mainQuery As String diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/DPMAregisterPatService.wsdl b/app/DpmaXmlParser/Service References/DPMA.Patent/DPMAregisterPatService.wsdl new file mode 100644 index 0000000..d7244d9 --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/DPMAregisterPatService.wsdl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.getRegisterInfoResponse.datasource b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.getRegisterInfoResponse.datasource new file mode 100644 index 0000000..f403d91 --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.getRegisterInfoResponse.datasource @@ -0,0 +1,10 @@ + + + + DpmaXmlParser.DPMA.Patent.getRegisterInfoResponse, Service References.DPMA.Patent.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.searchResponse.datasource b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.searchResponse.datasource new file mode 100644 index 0000000..881d26e --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.searchResponse.datasource @@ -0,0 +1,10 @@ + + + + DpmaXmlParser.DPMA.Patent.searchResponse, Service References.DPMA.Patent.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.versionResponse.datasource b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.versionResponse.datasource new file mode 100644 index 0000000..941d7fd --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/DpmaXmlParser.DPMA.Patent.versionResponse.datasource @@ -0,0 +1,10 @@ + + + + DpmaXmlParser.DPMA.Patent.versionResponse, Service References.DPMA.Patent.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.svcmap b/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.svcmap new file mode 100644 index 0000000..1a65c11 --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.svcmap @@ -0,0 +1,31 @@ + + + + false + true + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.vb b/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.vb new file mode 100644 index 0000000..6fbe603 --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/Reference.vb @@ -0,0 +1,391 @@ +'------------------------------------------------------------------------------ +' +' Dieser Code wurde von einem Tool generiert. +' Laufzeitversion:4.0.30319.42000 +' +' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +' der Code erneut generiert wird. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace DPMA.Patent + + _ + Public Interface DPMAregister + + 'CODEGEN: Es wird ein Nachrichtenvertrag generiert, da Elementname user aus Namespace http://ws.patent.register.dpma.de nicht als "nillable" (nullwertfähig) gekennzeichnet ist. + _ + Function search(ByVal request As DPMA.Patent.searchRequest) As DPMA.Patent.searchResponse + + _ + Function searchAsync(ByVal request As DPMA.Patent.searchRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.searchResponse) + + 'CODEGEN: Es wird ein Nachrichtenvertrag generiert, da Elementname versionReturn aus Namespace http://ws.patent.register.dpma.de nicht als "nillable" (nullwertfähig) gekennzeichnet ist. + _ + Function version(ByVal request As DPMA.Patent.versionRequest) As DPMA.Patent.versionResponse + + _ + Function versionAsync(ByVal request As DPMA.Patent.versionRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.versionResponse) + + 'CODEGEN: Es wird ein Nachrichtenvertrag generiert, da Elementname user aus Namespace http://ws.patent.register.dpma.de nicht als "nillable" (nullwertfähig) gekennzeichnet ist. + _ + Function getRegisterInfo(ByVal request As DPMA.Patent.getRegisterInfoRequest) As DPMA.Patent.getRegisterInfoResponse + + _ + Function getRegisterInfoAsync(ByVal request As DPMA.Patent.getRegisterInfoRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.getRegisterInfoResponse) + End Interface + + _ + Partial Public Class searchRequest + + _ + Public Body As DPMA.Patent.searchRequestBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.searchRequestBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class searchRequestBody + + _ + Public user As String + + _ + Public pwd As String + + _ + Public query As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal user As String, ByVal pwd As String, ByVal query As String) + MyBase.New + Me.user = user + Me.pwd = pwd + Me.query = query + End Sub + End Class + + _ + Partial Public Class searchResponse + + _ + Public Body As DPMA.Patent.searchResponseBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.searchResponseBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class searchResponseBody + + _ + Public searchReturn As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal searchReturn As String) + MyBase.New + Me.searchReturn = searchReturn + End Sub + End Class + + _ + Partial Public Class versionRequest + + _ + Public Body As DPMA.Patent.versionRequestBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.versionRequestBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class versionRequestBody + + Public Sub New() + MyBase.New + End Sub + End Class + + _ + Partial Public Class versionResponse + + _ + Public Body As DPMA.Patent.versionResponseBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.versionResponseBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class versionResponseBody + + _ + Public versionReturn As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal versionReturn As String) + MyBase.New + Me.versionReturn = versionReturn + End Sub + End Class + + _ + Partial Public Class getRegisterInfoRequest + + _ + Public Body As DPMA.Patent.getRegisterInfoRequestBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.getRegisterInfoRequestBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class getRegisterInfoRequestBody + + _ + Public user As String + + _ + Public pwd As String + + _ + Public akz As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal user As String, ByVal pwd As String, ByVal akz As String) + MyBase.New + Me.user = user + Me.pwd = pwd + Me.akz = akz + End Sub + End Class + + _ + Partial Public Class getRegisterInfoResponse + + _ + Public Body As DPMA.Patent.getRegisterInfoResponseBody + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Body As DPMA.Patent.getRegisterInfoResponseBody) + MyBase.New + Me.Body = Body + End Sub + End Class + + _ + Partial Public Class getRegisterInfoResponseBody + + _ + Public getRegisterInfoReturn As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal getRegisterInfoReturn As String) + MyBase.New + Me.getRegisterInfoReturn = getRegisterInfoReturn + End Sub + End Class + + _ + Public Interface DPMAregisterChannel + Inherits DPMA.Patent.DPMAregister, System.ServiceModel.IClientChannel + End Interface + + _ + Partial Public Class DPMAregisterClient + Inherits System.ServiceModel.ClientBase(Of DPMA.Patent.DPMAregister) + Implements DPMA.Patent.DPMAregister + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal endpointConfigurationName As String) + MyBase.New(endpointConfigurationName) + End Sub + + Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String) + MyBase.New(endpointConfigurationName, remoteAddress) + End Sub + + Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As System.ServiceModel.EndpointAddress) + MyBase.New(endpointConfigurationName, remoteAddress) + End Sub + + Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, ByVal remoteAddress As System.ServiceModel.EndpointAddress) + MyBase.New(binding, remoteAddress) + End Sub + + _ + Function DPMA_Patent_DPMAregister_search(ByVal request As DPMA.Patent.searchRequest) As DPMA.Patent.searchResponse Implements DPMA.Patent.DPMAregister.search + Return MyBase.Channel.search(request) + End Function + + Public Function search(ByVal user As String, ByVal pwd As String, ByVal query As String) As String + Dim inValue As DPMA.Patent.searchRequest = New DPMA.Patent.searchRequest() + inValue.Body = New DPMA.Patent.searchRequestBody() + inValue.Body.user = user + inValue.Body.pwd = pwd + inValue.Body.query = query + Dim retVal As DPMA.Patent.searchResponse = CType(Me,DPMA.Patent.DPMAregister).search(inValue) + Return retVal.Body.searchReturn + End Function + + _ + Function DPMA_Patent_DPMAregister_searchAsync(ByVal request As DPMA.Patent.searchRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.searchResponse) Implements DPMA.Patent.DPMAregister.searchAsync + Return MyBase.Channel.searchAsync(request) + End Function + + Public Function searchAsync(ByVal user As String, ByVal pwd As String, ByVal query As String) As System.Threading.Tasks.Task(Of DPMA.Patent.searchResponse) + Dim inValue As DPMA.Patent.searchRequest = New DPMA.Patent.searchRequest() + inValue.Body = New DPMA.Patent.searchRequestBody() + inValue.Body.user = user + inValue.Body.pwd = pwd + inValue.Body.query = query + Return CType(Me,DPMA.Patent.DPMAregister).searchAsync(inValue) + End Function + + _ + Function DPMA_Patent_DPMAregister_version(ByVal request As DPMA.Patent.versionRequest) As DPMA.Patent.versionResponse Implements DPMA.Patent.DPMAregister.version + Return MyBase.Channel.version(request) + End Function + + Public Function version() As String + Dim inValue As DPMA.Patent.versionRequest = New DPMA.Patent.versionRequest() + inValue.Body = New DPMA.Patent.versionRequestBody() + Dim retVal As DPMA.Patent.versionResponse = CType(Me,DPMA.Patent.DPMAregister).version(inValue) + Return retVal.Body.versionReturn + End Function + + _ + Function DPMA_Patent_DPMAregister_versionAsync(ByVal request As DPMA.Patent.versionRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.versionResponse) Implements DPMA.Patent.DPMAregister.versionAsync + Return MyBase.Channel.versionAsync(request) + End Function + + Public Function versionAsync() As System.Threading.Tasks.Task(Of DPMA.Patent.versionResponse) + Dim inValue As DPMA.Patent.versionRequest = New DPMA.Patent.versionRequest() + inValue.Body = New DPMA.Patent.versionRequestBody() + Return CType(Me,DPMA.Patent.DPMAregister).versionAsync(inValue) + End Function + + _ + Function DPMA_Patent_DPMAregister_getRegisterInfo(ByVal request As DPMA.Patent.getRegisterInfoRequest) As DPMA.Patent.getRegisterInfoResponse Implements DPMA.Patent.DPMAregister.getRegisterInfo + Return MyBase.Channel.getRegisterInfo(request) + End Function + + Public Function getRegisterInfo(ByVal user As String, ByVal pwd As String, ByVal akz As String) As String + Dim inValue As DPMA.Patent.getRegisterInfoRequest = New DPMA.Patent.getRegisterInfoRequest() + inValue.Body = New DPMA.Patent.getRegisterInfoRequestBody() + inValue.Body.user = user + inValue.Body.pwd = pwd + inValue.Body.akz = akz + Dim retVal As DPMA.Patent.getRegisterInfoResponse = CType(Me,DPMA.Patent.DPMAregister).getRegisterInfo(inValue) + Return retVal.Body.getRegisterInfoReturn + End Function + + _ + Function DPMA_Patent_DPMAregister_getRegisterInfoAsync(ByVal request As DPMA.Patent.getRegisterInfoRequest) As System.Threading.Tasks.Task(Of DPMA.Patent.getRegisterInfoResponse) Implements DPMA.Patent.DPMAregister.getRegisterInfoAsync + Return MyBase.Channel.getRegisterInfoAsync(request) + End Function + + Public Function getRegisterInfoAsync(ByVal user As String, ByVal pwd As String, ByVal akz As String) As System.Threading.Tasks.Task(Of DPMA.Patent.getRegisterInfoResponse) + Dim inValue As DPMA.Patent.getRegisterInfoRequest = New DPMA.Patent.getRegisterInfoRequest() + inValue.Body = New DPMA.Patent.getRegisterInfoRequestBody() + inValue.Body.user = user + inValue.Body.pwd = pwd + inValue.Body.akz = akz + Return CType(Me,DPMA.Patent.DPMAregister).getRegisterInfoAsync(inValue) + End Function + End Class +End Namespace diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/configuration.svcinfo b/app/DpmaXmlParser/Service References/DPMA.Patent/configuration.svcinfo new file mode 100644 index 0000000..8a6125f --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/configuration.svcinfo @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/DpmaXmlParser/Service References/DPMA.Patent/configuration91.svcinfo b/app/DpmaXmlParser/Service References/DPMA.Patent/configuration91.svcinfo new file mode 100644 index 0000000..a77f117 --- /dev/null +++ b/app/DpmaXmlParser/Service References/DPMA.Patent/configuration91.svcinfo @@ -0,0 +1,201 @@ + + + + + + + DPMAregisterSoapBinding + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Sammlung) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + http://dpmaconnect.dpma.de/dpmaws/services/DPMAregisterPatService + + + + + + basicHttpBinding + + + DPMAregisterSoapBinding + + + DPMA.Patent.DPMAregister + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + DPMAregister + + + + + + + + + + + \ No newline at end of file diff --git a/app/DpmaXmlParser/Utils.vb b/app/DpmaXmlParser/Utils.vb new file mode 100644 index 0000000..63413f9 --- /dev/null +++ b/app/DpmaXmlParser/Utils.vb @@ -0,0 +1,5 @@ +Public Class Utils + Public Shared Function ParseShortDate(value As String) + Return DateTime.Parse(value).ToShortDateString() + End Function +End Class diff --git a/app/DpmaXmlParser/app.config b/app/DpmaXmlParser/app.config new file mode 100644 index 0000000..3ed8853 --- /dev/null +++ b/app/DpmaXmlParser/app.config @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +