EDMIService: WIP

This commit is contained in:
Jonathan Jenne
2021-12-09 16:28:26 +01:00
parent a509842616
commit e6b3a53477
15 changed files with 147 additions and 108 deletions

View File

@@ -8,13 +8,13 @@
''' Attribute values supplied by the user
''' </summary>
Public Class UserAttributeValue
Public Property AttributeName As String
Public Property AttributeValues As List(Of String)
Public Property AttributeId As Integer
Public Property Id As Integer
Public Property Name As String
Public Property Values As List(Of String)
Public Property ControlName As String
Public Overrides Function ToString() As String
Return AttributeName
Return Name
End Function
End Class

View File

@@ -112,10 +112,10 @@ Namespace Methods.GlobalIndexer.ImportFile
End Try
End Function
Private Function GetVirtualPath(pFileInfo As FileInfo, pPathConvention As String, pUser As UserState, pAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue))
Private Function GetVirtualPath(pFileInfo As FileInfo, pPathConvention As String, pUser As UserState, pUserAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue))
Logger.Info("Generating virtual path for file [{0}]", pFileInfo.Name)
Dim oAttributeDict = Helpers.UserAttributesToDictionary(pAttributes)
Dim oUserAttributeDict = Helpers.UserAttributesToDictionary(pUserAttributes)
Dim oAutoAttributeDict = Helpers.UserAttributesToDictionary(pAutoAttributes)
If pPathConvention Is Nothing OrElse pPathConvention = String.Empty Then
@@ -124,14 +124,15 @@ Namespace Methods.GlobalIndexer.ImportFile
End If
Dim oVirtualPath As String = Helpers.GetPlaceholderValue(pPathConvention, pFileInfo, pUser, oAttributeDict, oAutoAttributeDict)
Return oVirtualPath
Dim oDynamicPath As String = Helpers.GetPlaceholderValue(pPathConvention, pFileInfo, pUser, oUserAttributeDict, oAutoAttributeDict)
Logger.Info("Virtual Path for file [{0}] is [{1}]", pFileInfo.Name, oDynamicPath)
Return oDynamicPath
End Function
Private Function GetFilenameByNameconvention(pFileInfo As FileInfo, pNameconvention As String, pUser As UserState, pAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue)) As String
Private Function GetFilenameByNameconvention(pFileInfo As FileInfo, pNameconvention As String, pUser As UserState, pUserAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue)) As String
Logger.Info("Generating display filename for file [{0}]", pFileInfo.Name)
Dim oAttributeDict = Helpers.UserAttributesToDictionary(pAttributes)
Dim oUserAttributeDict = Helpers.UserAttributesToDictionary(pUserAttributes)
Dim oAutoAttributeDict = Helpers.UserAttributesToDictionary(pAutoAttributes)
If pNameconvention Is Nothing OrElse pNameconvention = String.Empty Then
@@ -140,7 +141,8 @@ Namespace Methods.GlobalIndexer.ImportFile
End If
Dim oFileName As String = Helpers.GetPlaceholderValue(pNameconvention, pFileInfo, pUser, oAttributeDict, oAutoAttributeDict)
Dim oFileName As String = Helpers.GetPlaceholderValue(pNameconvention, pFileInfo, pUser, oUserAttributeDict, oAutoAttributeDict)
Return oFileName & pFileInfo.Extension
End Function
@@ -158,7 +160,7 @@ Namespace Methods.GlobalIndexer.ImportFile
' Now make the call to the database
Dim oSuccess = Helpers.SetAttributeValue(Connection, Transaction, pObjectId, oAttribute.Key, oValue, User.Language, User.UserName)
If oSuccess Then
Logger.Info("Attribute [{0}] written with value [{1}]", oAttribute.Key, oAttribute.Value)
Logger.Info("Attribute [{0}] written with value [{1}]", oAttribute.Key, oAttribute.Value.First())
Else
Logger.Warn("Attribute value could not be written")
End If

View File

@@ -77,9 +77,9 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
pAutomaticIndex.Value, pFileInfo, pUserState, oAttributeDict, oAutoAttributeDict)
Return New UserAttributeValue With {
.AttributeValues = New List(Of String) From {oResult},
.AttributeName = pAutomaticIndex.Name,
.AttributeId = pAutomaticIndex.Id
.Values = New List(Of String) From {oResult},
.Name = pAutomaticIndex.Name,
.Id = pAutomaticIndex.Id
}
End If
@@ -107,9 +107,9 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
' TODO: Return multiple values
Return New UserAttributeValue With {
.AttributeValues = New List(Of String) From {oValue},
.AttributeName = pAutomaticIndex.Name,
.AttributeId = pAutomaticIndex.Id
.Values = New List(Of String) From {oValue},
.Name = pAutomaticIndex.Name,
.Id = pAutomaticIndex.Id
}
Catch ex As Exception
Logger.Warn("Automatic Indexing for index failed.")

View File

@@ -32,21 +32,21 @@ Namespace Methods.GlobalIndexer.ImportFile.Steps
For Each oProcessingRow As DataRow In PostprocessingSteps.Rows
Dim oIndexId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")
Dim oIndex As UserAttributeValue = pManualAttributes.
Where(Function(attr) attr.AttributeId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")).
Where(Function(attr) attr.Id = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")).
FirstOrDefault()
Dim oIndexPosition = pManualAttributes.IndexOf(oIndex)
Logger.Info("Postprocessing Index [{0}]", oIndex.AttributeName)
Logger.Info("Postprocessing Index [{0}]", oIndex.Name)
Dim oValues = GetPostprocessingValue(oIndex.AttributeValues, oProcessingRow)
Dim oValues = GetPostprocessingValue(oIndex.Values, oProcessingRow)
Logger.Info("New Value for Index [{0}] is [{1}]", oIndex.AttributeName, String.Join(",", oValues))
Logger.Info("New Value for Index [{0}] is [{1}]", oIndex.Name, String.Join(",", oValues))
' Replace the old AttributeValue with the new one
oAttributes.Item(oIndexPosition) = New UserAttributeValue With {
.AttributeId = oIndexId,
.AttributeName = oIndex.AttributeName,
.AttributeValues = oValues,
.Id = oIndexId,
.Name = oIndex.Name,
.Values = oValues,
.ControlName = oIndex.ControlName
}
Next

View File

@@ -23,7 +23,7 @@ Namespace Methods.GlobalIndexer
''' Load Profiles for this Import
''' </summary>
Public Function LoadProfile(pProfileId As Integer) As Profile
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
Logger.Debug("Start of Method [LoadProfile]")
Try
Dim oProfile = GetDatatable.Run(
@@ -44,12 +44,12 @@ Namespace Methods.GlobalIndexer
.NameConvention = oRow.ItemEx("NAMENKONVENTION", ""),
.ObjectStore = oRow.ItemEx("OBJECT_STORE", "Work"),
.ShortName = oRow.ItemEx("KURZNAME", ""),
.DynamicPath = oRow.ItemEx("DYNAMIC_PATH", "")
.DynamicPath = oRow.ItemEx("DYNAMIC_FOLDER", "")
}
Return oProfileObject
Catch ex As Exception
LogAndThrow(ex, "Error while automatic loading indexes!")
LogAndThrow(ex, "Error while automatic loading profile!")
Return Nothing
End Try
End Function