ZooFlow: clean up
This commit is contained in:
@@ -5,10 +5,10 @@ Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class GlobixPatterns
|
||||
Private _Logger As Logger
|
||||
Private _idbdata As clsIDBData
|
||||
Private _idbdata As ClassIDBData
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_Logger = LogConfig.GetLogger
|
||||
_idbdata = New clsIDBData(LogConfig)
|
||||
_idbdata = New ClassIDBData(LogConfig)
|
||||
End Sub
|
||||
' Complex patterns that rely on a datasource like a Database or Windream
|
||||
Public Const PATTERN_WMI = "WMI"
|
||||
@@ -261,12 +261,12 @@ Public Class GlobixPatterns
|
||||
End Function
|
||||
Public Function ReplaceIDBAttributes(IDB_OBJ_ID As Long, pInput As String, IS_SQL As Boolean) As String
|
||||
Try
|
||||
Dim result = pInput
|
||||
Dim oResult = pInput
|
||||
Dim oTryCounter As Integer = 0
|
||||
While ContainsPattern(result, PATTERN_IDBA)
|
||||
While ContainsPattern(oResult, PATTERN_IDBA)
|
||||
|
||||
Dim indexName As String = GetNextPattern(result, PATTERN_IDBA).Value
|
||||
Dim oIDBValue
|
||||
Dim indexName As String = GetNextPattern(oResult, PATTERN_IDBA).Value
|
||||
Dim oIDBValue As Object
|
||||
If indexName = "ObjectID" Then
|
||||
oIDBValue = IDB_OBJ_ID
|
||||
ElseIf indexName = "OBJID" Then
|
||||
@@ -280,7 +280,7 @@ Public Class GlobixPatterns
|
||||
If IsNothing(oIDBValue) And oTryCounter = MAX_TRY_COUNT Then
|
||||
_Logger.Warn($"Max tries for [{indexName}] in ReplaceIDBAttributes exceeded - Replacing with [0]!")
|
||||
Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
|
||||
result = result.Replace(oReplaceValue, 0)
|
||||
oResult = oResult.Replace(oReplaceValue, 0)
|
||||
Throw New Exception("Max tries in ReplaceIDBAttributes exceeded.")
|
||||
|
||||
End If
|
||||
@@ -299,87 +299,24 @@ Public Class GlobixPatterns
|
||||
End If
|
||||
_Logger.Debug($"oIDBValue = {oIDBValue}")
|
||||
End If
|
||||
result = result.Replace(oReplaceValue, oIDBValue)
|
||||
oResult = oResult.Replace(oReplaceValue, oIDBValue)
|
||||
Else
|
||||
_Logger.Warn($"IDBValue for [{indexName}] in ReplaceIDBAttributes is nothing or dbnull - Replacing with [0]!")
|
||||
Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
|
||||
result = result.Replace(oReplaceValue, 0)
|
||||
oResult = oResult.Replace(oReplaceValue, 0)
|
||||
End If
|
||||
oTryCounter += 100
|
||||
End While
|
||||
_Logger.Debug("sql after ReplaceIDBAttributes: " & pInput)
|
||||
Return result
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Info("Error in ReplaceIDBAttributes:" & ex.Message)
|
||||
Return pInput
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'Public Function ReplaceWindreamIndicies(input As String, document As WMObject) As String
|
||||
' Try
|
||||
' Dim result = input
|
||||
' Dim oTryCounter As Integer = 0
|
||||
' While ContainsPattern(result, PATTERN_WMI)
|
||||
|
||||
' Dim indexName As String = GetNextPattern(result, PATTERN_WMI).Value
|
||||
' Dim oWMValue = document.GetVariableValue(indexName)
|
||||
' If IsNothing(oWMValue) And oTryCounter = MAX_TRY_COUNT Then
|
||||
' _Logger.Warn("Exit from ReplaceWindreamIndicies as oWMValue is still nothing and oTryCounter is 500!")
|
||||
' Throw New Exception("Max tries in ReplaceWindreamIndicies exceeded.")
|
||||
|
||||
' End If
|
||||
' If oWMValue IsNot Nothing Then
|
||||
' result = ReplacePattern(result, PATTERN_WMI, oWMValue)
|
||||
' End If
|
||||
' oTryCounter += 100
|
||||
' End While
|
||||
' _Logger.Debug("sql after ReplaceWindreamIndicies: " & input)
|
||||
' Return result
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' _Logger.Info("Error in ReplaceWindreamIndicies:" & ex.Message)
|
||||
' End Try
|
||||
'End Function
|
||||
'Public Function ReplaceIDBAttributes(input As String) As String
|
||||
' Try
|
||||
' Dim result = input
|
||||
' Dim oTryCounter As Integer = 0
|
||||
' While ContainsPattern(result, PATTERN_IDBA)
|
||||
|
||||
' Dim indexName As String = GetNextPattern(result, PATTERN_IDBA).Value
|
||||
' Dim oIDBValue
|
||||
' If indexName = "ObjectID" Then
|
||||
' oIDBValue = CURRENT_DOC_ID
|
||||
' ElseIf indexName = "OBJID" Then
|
||||
' oIDBValue = CURRENT_DOC_ID
|
||||
' ElseIf indexName = "DocID" Then
|
||||
' oIDBValue = CURRENT_DOC_ID
|
||||
' Else
|
||||
|
||||
' oIDBValue = IDBData.GetVariableValue(indexName)
|
||||
' End If
|
||||
|
||||
' If IsNothing(oIDBValue) And oTryCounter = MAX_TRY_COUNT Then
|
||||
' _Logger.Warn("Exit from ReplaceIDBIndicies as Value is still nothing and oTryCounter is 500!")
|
||||
' Throw New Exception("Max tries in ReplaceIDBAttributes exceeded.")
|
||||
|
||||
' End If
|
||||
' If oIDBValue IsNot Nothing Then
|
||||
' Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}"
|
||||
' result = result.Replace(oReplaceValue, oIDBValue)
|
||||
' 'result = ReplacePattern(result, oReplaceValue, oIDBValue)
|
||||
' End If
|
||||
' oTryCounter += 100
|
||||
' End While
|
||||
' _Logger.Debug("sql after ReplaceIDBAttributes: " & input)
|
||||
' Return result
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' _Logger.Info("Error in ReplaceIDBAttributes:" & ex.Message)
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Private Function ContainsPattern(input As String, type As String) As String
|
||||
Private Function ContainsPattern(input As String, type As String) As Boolean
|
||||
Dim elements As MatchCollection = myregex.Matches(input)
|
||||
|
||||
For Each element As Match In elements
|
||||
@@ -459,9 +396,9 @@ Public Class GlobixPatterns
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Function HasAnyPatterns(input) As Boolean
|
||||
Public Function HasAnyPatterns(pInput As String) As Boolean
|
||||
Return allPatterns.Any(Function(p)
|
||||
Return HasPattern(input, p)
|
||||
Return HasPattern(pInput, p)
|
||||
End Function)
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user