EDMIService: Automatic indexing, more consolidation of globix logic

This commit is contained in:
Jonathan Jenne
2021-12-06 15:01:14 +01:00
parent 34517ce209
commit 785b138c57
35 changed files with 1259 additions and 255 deletions

View File

@@ -12,6 +12,9 @@ Namespace Modules
Public Const INT_VALUE_MACHINE = "MACHINE"
Public Const INT_VALUE_DOMAIN = "DOMAIN"
Public Const INT_VALUE_DATE = "DATE"
Public Const INT_VALUE_DATE_YYYY = "DATE_YYYY"
Public Const INT_VALUE_DATE_MM = "DATE_MM"
Public Const INT_VALUE_DATE_DD = "DATE_DD"
Public Property PatternIdentifier As String = "INT" Implements IModule.PatternIdentifier
Public Property IsComplex As Boolean = False Implements IModule.IsComplex
@@ -23,30 +26,29 @@ Namespace Modules
Public Function Replace(pInput As String, pReplaceMap As Dictionary(Of String, Object)) As String Implements IModule.Replace
Dim oResult = pInput
Dim oCounter = 0
' Replace Username(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_USERNAME)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(INT_VALUE_USERNAME))
IncrementCounterOrThrow(oCounter)
End While
' Replace Machinename(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_MACHINE)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(INT_VALUE_MACHINE))
IncrementCounterOrThrow(oCounter)
End While
' Replace Domainname(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DOMAIN)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(INT_VALUE_DOMAIN))
IncrementCounterOrThrow(oCounter)
End While
Dim oNow As Date = Now
' Replace CurrentDate(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE)
oResult = ReplacePattern(oResult, PatternIdentifier, pReplaceMap.Item(INT_VALUE_DATE))
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy-MM-dd"))
IncrementCounterOrThrow(oCounter)
End While
' Replace Year(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_YYYY)
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy"))
IncrementCounterOrThrow(oCounter)
End While
' Replace Month(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_MM)
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("MM"))
IncrementCounterOrThrow(oCounter)
End While
' Replace Day(s)
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_DD)
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("dd"))
IncrementCounterOrThrow(oCounter)
End While