Merge branch 'master' of http://dd-vmp07-com04:3000/AppStd/Monorepo
This commit is contained in:
commit
ea1cdeef58
10
GUIs.Test.ZUGFeRDTest/Form1.Designer.vb
generated
10
GUIs.Test.ZUGFeRDTest/Form1.Designer.vb
generated
@ -68,18 +68,18 @@ Partial Class Form1
|
||||
'
|
||||
Me.Button2.Location = New System.Drawing.Point(6, 19)
|
||||
Me.Button2.Name = "Button2"
|
||||
Me.Button2.Size = New System.Drawing.Size(221, 23)
|
||||
Me.Button2.Size = New System.Drawing.Size(246, 23)
|
||||
Me.Button2.TabIndex = 2
|
||||
Me.Button2.Text = "Validate PDF"
|
||||
Me.Button2.Text = "Validate and Serialize PDF"
|
||||
Me.Button2.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button3
|
||||
'
|
||||
Me.Button3.Location = New System.Drawing.Point(6, 48)
|
||||
Me.Button3.Name = "Button3"
|
||||
Me.Button3.Size = New System.Drawing.Size(221, 23)
|
||||
Me.Button3.Size = New System.Drawing.Size(246, 23)
|
||||
Me.Button3.TabIndex = 3
|
||||
Me.Button3.Text = "Validate and Serialize PDF"
|
||||
Me.Button3.Text = "Validate and Serialize PDF and Parse Props"
|
||||
Me.Button3.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button4
|
||||
@ -136,7 +136,7 @@ Partial Class Form1
|
||||
'
|
||||
Me.Button7.Location = New System.Drawing.Point(6, 77)
|
||||
Me.Button7.Name = "Button7"
|
||||
Me.Button7.Size = New System.Drawing.Size(221, 23)
|
||||
Me.Button7.Size = New System.Drawing.Size(246, 23)
|
||||
Me.Button7.TabIndex = 3
|
||||
Me.Button7.Text = "Extract PDF Attachments"
|
||||
Me.Button7.UseVisualStyleBackColor = True
|
||||
|
||||
@ -102,9 +102,13 @@ Public Class Form1
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
Dim oArgs As New WorkerArgs()
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
_zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
|
||||
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
|
||||
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Console.WriteLine()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -161,7 +165,7 @@ Public Class Form1
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
|
||||
Dim oZUGFERD As CrossIndustryDocumentType = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Dim oPropName As String = txtPropName.Text
|
||||
|
||||
Try
|
||||
|
||||
@ -10,7 +10,7 @@ Public Class ClassHelpers
|
||||
|
||||
Public Function GetValueFromDatatable(pDatatable As DataTable, pFilterString As String, pCheckColumn As String, pSortString As String) As Object
|
||||
Try
|
||||
If pDatatable.Rows.Count = 0 Then
|
||||
If pDatatable Is Nothing OrElse pDatatable.Rows.Count = 0 Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
|
||||
@ -52,10 +52,7 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
' ========================= COMBO BOX =========================
|
||||
If oControl.Name.StartsWith("cmbSingle") Then
|
||||
ElseIf oControl.Name.StartsWith("cmbSingle") Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
|
||||
If cmbSingle.Text = "" Then
|
||||
@ -68,9 +65,8 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If oControl.Name.StartsWith("cmb") Then
|
||||
ElseIf oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
If cmb.Text = "" Then
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
@ -82,6 +78,7 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
' ========================= DATE PICKER =========================
|
||||
@ -139,8 +136,8 @@ Public Class ClassValidator
|
||||
'End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(oTextBox.Text),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(oTextBox.Text),
|
||||
.ControlName = oTextBox.Name
|
||||
})
|
||||
End If
|
||||
@ -155,14 +152,13 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(oValues),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(oValues),
|
||||
.ControlName = oLookup.Name
|
||||
})
|
||||
End If
|
||||
|
||||
' ========================= COMBO BOX =========================
|
||||
If oControl.Name.StartsWith("cmbSingle") Then
|
||||
|
||||
ElseIf oControl.Name.StartsWith("cmbSingle") Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmbSingle, "cmbSingle")
|
||||
|
||||
@ -170,13 +166,12 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(cmbSingle.Text),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(cmbSingle.Text),
|
||||
.ControlName = cmbSingle.Name
|
||||
})
|
||||
End If
|
||||
|
||||
If oControl.Name.StartsWith("cmb") Then
|
||||
ElseIf oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
|
||||
@ -184,8 +179,8 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(cmb.Text),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(cmb.Text),
|
||||
.ControlName = cmb.Name
|
||||
})
|
||||
End If
|
||||
@ -196,8 +191,8 @@ Public Class ClassValidator
|
||||
Dim oIndexName As String = GetIndexName(dtp, "dtp")
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(dtp.EditValue.ToString),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(dtp.EditValue.ToString),
|
||||
.ControlName = dtp.Name
|
||||
})
|
||||
End If
|
||||
@ -209,8 +204,8 @@ Public Class ClassValidator
|
||||
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.AttributeName = oIndexName,
|
||||
.AttributeValues = WrapIndexValue(chk.Checked.ToString),
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(chk.Checked.ToString),
|
||||
.ControlName = chk.Name
|
||||
})
|
||||
End If
|
||||
|
||||
@ -12,6 +12,7 @@ Imports DigitalData.Controls.LookupGrid
|
||||
Imports Independentsoft
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Database
|
||||
|
||||
Public Class frmGlobix_Index
|
||||
#Region "+++++ Variablen ++++++"
|
||||
@ -588,6 +589,7 @@ Public Class frmGlobix_Index
|
||||
End Sub
|
||||
Private Function GetLookupData(pLookup As LookupControl3, pSQLCommand As String, pConnectionId As Integer)
|
||||
Dim oConnectionString = GetConnectionString(pConnectionId)
|
||||
oConnectionString = MSSQLServer.DecryptConnectionString(oConnectionString)
|
||||
|
||||
If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then
|
||||
_Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30))
|
||||
|
||||
@ -41,8 +41,8 @@ Public Class frmtest
|
||||
txtProfileId.Text,
|
||||
New List(Of EDMIServiceReference.UserAttributeValue) From {
|
||||
New EDMIServiceReference.UserAttributeValue With {
|
||||
.AttributeName = "Attribut String1",
|
||||
.AttributeValues = New List(Of String) From {"SchreiberM"}.ToArray
|
||||
.Name = "Attribut String1",
|
||||
.Values = New List(Of String) From {"SchreiberM"}.ToArray
|
||||
}
|
||||
},
|
||||
"WORK",
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
<xs:element name="ArrayOfUserAttributeValue" nillable="true" type="tns:ArrayOfUserAttributeValue" />
|
||||
<xs:complexType name="UserAttributeValue">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="AttributeId" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="AttributeName" nillable="true" type="xs:string" />
|
||||
<xs:element xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" minOccurs="0" name="AttributeValues" nillable="true" type="q2:ArrayOfstring" />
|
||||
<xs:element minOccurs="0" name="ControlName" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="Id" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
|
||||
<xs:element xmlns:q2="http://schemas.microsoft.com/2003/10/Serialization/Arrays" minOccurs="0" name="Values" nillable="true" type="q2:ArrayOfstring" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="UserAttributeValue" nillable="true" type="tns:UserAttributeValue" />
|
||||
|
||||
@ -635,18 +635,18 @@ Namespace EDMIServiceReference
|
||||
<System.NonSerializedAttribute()> _
|
||||
Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private AttributeIdField As Integer
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private AttributeNameField As String
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private AttributeValuesField() As String
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private ControlNameField As String
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private IdField As Integer
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private NameField As String
|
||||
|
||||
<System.Runtime.Serialization.OptionalFieldAttribute()> _
|
||||
Private ValuesField() As String
|
||||
|
||||
<Global.System.ComponentModel.BrowsableAttribute(false)> _
|
||||
Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
|
||||
Get
|
||||
@ -657,45 +657,6 @@ Namespace EDMIServiceReference
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property AttributeId() As Integer
|
||||
Get
|
||||
Return Me.AttributeIdField
|
||||
End Get
|
||||
Set
|
||||
If (Me.AttributeIdField.Equals(value) <> true) Then
|
||||
Me.AttributeIdField = value
|
||||
Me.RaisePropertyChanged("AttributeId")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property AttributeName() As String
|
||||
Get
|
||||
Return Me.AttributeNameField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.AttributeNameField, value) <> true) Then
|
||||
Me.AttributeNameField = value
|
||||
Me.RaisePropertyChanged("AttributeName")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property AttributeValues() As String()
|
||||
Get
|
||||
Return Me.AttributeValuesField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.AttributeValuesField, value) <> true) Then
|
||||
Me.AttributeValuesField = value
|
||||
Me.RaisePropertyChanged("AttributeValues")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property ControlName() As String
|
||||
Get
|
||||
@ -709,6 +670,45 @@ Namespace EDMIServiceReference
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property Id() As Integer
|
||||
Get
|
||||
Return Me.IdField
|
||||
End Get
|
||||
Set
|
||||
If (Me.IdField.Equals(value) <> true) Then
|
||||
Me.IdField = value
|
||||
Me.RaisePropertyChanged("Id")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property Name() As String
|
||||
Get
|
||||
Return Me.NameField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.NameField, value) <> true) Then
|
||||
Me.NameField = value
|
||||
Me.RaisePropertyChanged("Name")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
<System.Runtime.Serialization.DataMemberAttribute()> _
|
||||
Public Property Values() As String()
|
||||
Get
|
||||
Return Me.ValuesField
|
||||
End Get
|
||||
Set
|
||||
If (Object.ReferenceEquals(Me.ValuesField, value) <> true) Then
|
||||
Me.ValuesField = value
|
||||
Me.RaisePropertyChanged("Values")
|
||||
End If
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
Protected Sub RaisePropertyChanged(ByVal propertyName As String)
|
||||
@ -933,7 +933,7 @@ Namespace EDMIServiceReference
|
||||
End Property
|
||||
|
||||
Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
|
||||
|
||||
|
||||
Protected Sub RaisePropertyChanged(ByVal propertyName As String)
|
||||
Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent
|
||||
If (Not (propertyChanged) Is Nothing) Then
|
||||
|
||||
@ -109,11 +109,13 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="ZUGFeRDInterface\CrossIndustryDocumentType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version1.0\CrossIndustryDocumentType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\FileGroups.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\PDFEmbeds.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\PropertyValues.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.0\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.1.1\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\XmlItemProperty.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.5.10.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.10.0")>
|
||||
<Assembly: AssemblyVersion("1.6.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.6.0.0")>
|
||||
|
||||
@ -11,9 +11,6 @@ Public Class ZUGFeRDInterface
|
||||
Private _logConfig As LogConfig
|
||||
Private _logger As Logger
|
||||
|
||||
Private Const ZUGFERD_CONVERTER_EXE = "ZUGFeRDInterface\pdf_zugferd_test.exe" 'ZUGFeRDInterface\pdf_zugferd_lib\pdf_zugferd_test.exe
|
||||
Private Const ZUGFERD_CONVERTER_SUCCESS_MESSAGE = "Document contains ZUGFeRD data."
|
||||
|
||||
Public Enum ErrorType
|
||||
NoValidFile
|
||||
NoZugferd
|
||||
@ -46,7 +43,7 @@ Public Class ZUGFeRDInterface
|
||||
''' <param name="Path"></param>
|
||||
''' <exception cref="ZUGFeRDExecption"></exception>
|
||||
''' <returns></returns>
|
||||
Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As CrossIndustryDocumentType
|
||||
Public Function ExtractZUGFeRDFileWithGDPicture(Path As String) As Object
|
||||
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(Path)
|
||||
|
||||
If IsNothing(oXmlDocument) Then
|
||||
@ -62,7 +59,7 @@ Public Class ZUGFeRDInterface
|
||||
''' <param name="Stream"></param>
|
||||
''' <exception cref="ZUGFeRDExecption"></exception>
|
||||
''' <returns></returns>
|
||||
Public Function ExtractZUGFeRDFileWithGDPicture(Stream As Stream) As CrossIndustryDocumentType
|
||||
Public Function ExtractZUGFeRDFileWithGDPicture(Stream As Stream) As Object
|
||||
Dim oXmlDocument = ValidateZUGFeRDFileWithGDPicture(Stream)
|
||||
|
||||
If IsNothing(oXmlDocument) Then
|
||||
@ -164,16 +161,45 @@ Public Class ZUGFeRDInterface
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function SerializeZUGFeRDDocument(Document As XPathDocument) As CrossIndustryDocumentType
|
||||
Public Function SerializeZUGFeRDDocument(Document As XPathDocument) As Object
|
||||
Try
|
||||
Dim oNavigator As XPathNavigator = Document.CreateNavigator()
|
||||
Dim oReader = oNavigator.ReadSubtree()
|
||||
Dim oSerializer As New XmlSerializer(GetType(CrossIndustryDocumentType))
|
||||
Dim oReader As XmlReader
|
||||
Dim oResult = Nothing
|
||||
|
||||
Dim oTypes As New List(Of Type) From {
|
||||
GetType(ZUGFeRD.Version1_0.CrossIndustryDocumentType),
|
||||
GetType(ZUGFeRD.Version2_0.CrossIndustryInvoiceType),
|
||||
GetType(ZUGFeRD.Version2_1_1.CrossIndustryInvoiceType)
|
||||
}
|
||||
|
||||
For Each oType In oTypes
|
||||
_logger.Debug("Trying Type [{0}]", oType.FullName)
|
||||
Dim oSerializer As New XmlSerializer(oType)
|
||||
|
||||
Try
|
||||
oReader = oNavigator.ReadSubtree()
|
||||
oResult = oSerializer.Deserialize(oReader)
|
||||
_logger.Debug("Serializing with type [{0}] succeeded", oType.FullName)
|
||||
Exit For
|
||||
Catch ex As Exception
|
||||
_logger.Debug("Serializing with type [{0}] failed", oType.FullName)
|
||||
_logger.Debug(ex.Message)
|
||||
_logger.Error(ex.InnerException?.Message)
|
||||
End Try
|
||||
Next
|
||||
|
||||
If oResult Is Nothing Then
|
||||
Throw New ApplicationException("No Types matched the given document. Document could not be serialized.")
|
||||
End If
|
||||
|
||||
Return oResult
|
||||
|
||||
Return oSerializer.Deserialize(oReader)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, "Datei ist eine ungültige ZUGFeRD Datei.")
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ Public Class PropertyValues
|
||||
Public Value As String
|
||||
End Class
|
||||
|
||||
Public Function CheckPropertyValues(Document As CrossIndustryDocumentType, PropertyMap As Dictionary(Of String, XmlItemProperty), MessageId As String) As CheckPropertyValuesResult
|
||||
Public Function CheckPropertyValues(Document As Object, PropertyMap As Dictionary(Of String, XmlItemProperty), MessageId As String) As CheckPropertyValuesResult
|
||||
Dim oGlobalGroupCounter = 0
|
||||
Dim oMissingProperties As New List(Of String)
|
||||
Dim oResult As New CheckPropertyValuesResult()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -197,7 +197,10 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Try
|
||||
For Each oFile In oFileGroupFiles
|
||||
Dim oDocument As CrossIndustryDocumentType
|
||||
' 09.12.2021: oDocument is now an Object, because have different classes corresponding to the
|
||||
' different versions of ZUGFeRD and the type is unknown at compile-time.
|
||||
Dim oDocument As Object
|
||||
|
||||
' Start a global group counter for each file
|
||||
Dim oGlobalGroupCounter = 0
|
||||
' Clear missing properties for the new file
|
||||
|
||||
@ -73,12 +73,14 @@ Public Class LogConfig
|
||||
|
||||
Private Const FILE_NAME_FORMAT_DEFAULT As String = "${shortdate}-${var:product}${var:suffix}${event-properties:item=ModuleName}.log"
|
||||
Private Const FILE_NAME_FORMAT_DEBUG As String = "${shortdate}-${var:product}${var:suffix}${event-properties:item=ModuleName}-Debug.log"
|
||||
Private Const FILE_NAME_FORMAT_TRACE As String = "${shortdate}-${var:product}${var:suffix}${event-properties:item=ModuleName}-Trace.log"
|
||||
Private Const FILE_NAME_FORMAT_ERROR As String = "${shortdate}-${var:product}${var:suffix}${event-properties:item=ModuleName}-Error.log"
|
||||
|
||||
Private Const TARGET_DEFAULT As String = "defaultTarget"
|
||||
Private Const TARGET_ERROR_EX As String = "errorExceptionTarget"
|
||||
Private Const TARGET_ERROR As String = "errorTarget"
|
||||
Private Const TARGET_DEBUG As String = "debugTarget"
|
||||
Private Const TARGET_TRACE As String = "traceTarget"
|
||||
Private Const TARGET_MEMORY As String = "memoryTarget"
|
||||
|
||||
Private Const LOG_FORMAT_BASE As String = "${time}|${logger:shortName=True}|${level:uppercase=true}"
|
||||
@ -252,6 +254,7 @@ Public Class LogConfig
|
||||
|
||||
Dim oLogger = GetLogger()
|
||||
oLogger.Info("Logging started for [{0}{1}] in [{2}]", oProductName, logFileSuffix, LogFile)
|
||||
oLogger.Info("Logging Version [{0}]", Assembly.GetExecutingAssembly().GetName().Version)
|
||||
|
||||
' Clear old Logfiles as defined in `FileKeepInterval`
|
||||
ClearOldLogfiles(FileKeepRangeInDays)
|
||||
@ -427,6 +430,7 @@ Public Class LogConfig
|
||||
_config.AddTarget(TARGET_ERROR, GetErrorLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_DEFAULT, GetDefaultLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_DEBUG, GetDebugLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_TRACE, GetTraceLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_MEMORY, GetMemoryDebugTarget())
|
||||
|
||||
' Add default rules
|
||||
@ -472,8 +476,9 @@ Public Class LogConfig
|
||||
|
||||
' Add debug rule, if configured
|
||||
If Debug Then
|
||||
_config.AddRuleForAllLevels(TARGET_DEBUG)
|
||||
_config.AddRuleForAllLevels(TARGET_MEMORY)
|
||||
_config.AddRuleForAllLevels(TARGET_TRACE)
|
||||
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_DEBUG)
|
||||
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_MEMORY)
|
||||
End If
|
||||
|
||||
' Reload all running loggers
|
||||
@ -535,6 +540,22 @@ Public Class LogConfig
|
||||
Return debugLog
|
||||
End Function
|
||||
|
||||
Private Function GetTraceLogTarget(basePath As String) As FileTarget
|
||||
Dim debugLog As New FileTarget() With {
|
||||
.FileName = Path.Combine(basePath, FILE_NAME_FORMAT_TRACE),
|
||||
.Name = TARGET_DEBUG,
|
||||
.Layout = LOG_FORMAT_DEBUG,
|
||||
.MaxArchiveFiles = MAX_ARCHIVE_FILES_DEBUG_DETAIL,
|
||||
.ArchiveEvery = ARCHIVE_EVERY,
|
||||
.KeepFileOpen = KEEP_FILES_OPEN_DEBUG,
|
||||
.OpenFileCacheTimeout = OPEN_FILE_CACHE_TIMEOUT,
|
||||
.AutoFlush = AUTO_FLUSH,
|
||||
.OpenFileFlushTimeout = OPEN_FILE_FLUSH_TIMEOUT
|
||||
}
|
||||
|
||||
Return debugLog
|
||||
End Function
|
||||
|
||||
Private Function GetMemoryDebugTarget() As MemoryTarget
|
||||
Dim memoryLog As New MemoryTarget() With {
|
||||
.Layout = LOG_FORMAT_DEBUG,
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.4.0")>
|
||||
<Assembly: AssemblyFileVersion("2.4.4.0")>
|
||||
<Assembly: AssemblyVersion("2.5.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.5.0.0")>
|
||||
|
||||
@ -4,7 +4,7 @@ Imports System.Text.RegularExpressions
|
||||
Namespace Modules
|
||||
Public Class BaseModule
|
||||
Friend ReadOnly Logger As Logger
|
||||
Private ReadOnly MyRegex As Regex = New Regex("{#(\w+)#([\:\.\w\s_-]+)}+")
|
||||
Private ReadOnly MyRegex As Regex = New Regex("{#(\w+)#([\:\.\w\s_/-]+)}+")
|
||||
Private ReadOnly SqlPhrases As New List(Of String) From {
|
||||
"SELECT ", "UPDATE ", "DELETE ", "EXEC "
|
||||
}
|
||||
|
||||
@ -12,9 +12,12 @@ 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 Const INT_VALUE_DATE_YYYY = "YYYY"
|
||||
Public Const INT_VALUE_DATE_MM = "MM"
|
||||
Public Const INT_VALUE_DATE_DD = "DD"
|
||||
Public Const INT_VALUE_DATE_YYYY_MM_DD = "YYYY/MM/DD"
|
||||
Public Const INT_VALUE_DATE_YYYY_MM_DD_2 = "YYYY_MM_DD"
|
||||
|
||||
Public Property PatternIdentifier As String = "INT" Implements IModule.PatternIdentifier
|
||||
Public Property IsComplex As Boolean = False Implements IModule.IsComplex
|
||||
@ -28,30 +31,55 @@ Namespace Modules
|
||||
Dim oCounter = 0
|
||||
Dim oNow As Date = Now
|
||||
|
||||
'TODO: Make date patterns dynamic
|
||||
|
||||
Logger.Trace("Replacing Internal Patterns")
|
||||
|
||||
' Replace CurrentDate(s)
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy-MM-dd"))
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_YYYY_MM_DD)
|
||||
Logger.Trace("Replacing Pattern [{0}]", INT_VALUE_DATE_YYYY_MM_DD)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy/MM/dd"))
|
||||
IncrementCounterOrThrow(oCounter)
|
||||
End While
|
||||
|
||||
Logger.Trace("Replace Counter: [{0}]", oCounter)
|
||||
|
||||
' Replace CurrentDate(s)
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_YYYY_MM_DD_2)
|
||||
Logger.Trace("Replacing Pattern [{0}]", INT_VALUE_DATE_YYYY_MM_DD_2)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy_MM_dd"))
|
||||
IncrementCounterOrThrow(oCounter)
|
||||
End While
|
||||
|
||||
Logger.Trace("Replace Counter: [{0}]", oCounter)
|
||||
|
||||
' Replace Year(s)
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_YYYY)
|
||||
Logger.Trace("Replacing Pattern [{0}]", INT_VALUE_DATE_YYYY)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("yyyy"))
|
||||
IncrementCounterOrThrow(oCounter)
|
||||
End While
|
||||
|
||||
Logger.Trace("Replace Counter: [{0}]", oCounter)
|
||||
|
||||
' Replace Month(s)
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_MM)
|
||||
Logger.Trace("Replacing Pattern [{0}]", INT_VALUE_DATE_MM)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("MM"))
|
||||
IncrementCounterOrThrow(oCounter)
|
||||
End While
|
||||
|
||||
Logger.Trace("Replace Counter: [{0}]", oCounter)
|
||||
|
||||
' Replace Day(s)
|
||||
While ContainsPatternAndValue(oResult, PatternIdentifier, INT_VALUE_DATE_DD)
|
||||
Logger.Trace("Replacing Pattern [{0}]", INT_VALUE_DATE_DD)
|
||||
oResult = ReplacePattern(oResult, PatternIdentifier, oNow.ToString("dd"))
|
||||
IncrementCounterOrThrow(oCounter)
|
||||
End While
|
||||
|
||||
Logger.Trace("Replace Counter: [{0}]", oCounter)
|
||||
|
||||
Return oResult
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -11,11 +11,19 @@ Public Class BaseClass
|
||||
Logger = pLogConfig.GetLogger(oClassName)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
'''
|
||||
''' </summary>
|
||||
''' <exception cref="ApplicationException"></exception>
|
||||
Public Sub LogAndThrow(pMessage As String)
|
||||
Logger.Warn(pMessage)
|
||||
Throw New ApplicationException(pMessage)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
'''
|
||||
''' </summary>
|
||||
''' <exception cref="ApplicationException"></exception>
|
||||
Public Sub LogAndThrow(pException As Exception, pMessage As String)
|
||||
Logger.Error(pException)
|
||||
Throw New ApplicationException(pMessage, pException)
|
||||
|
||||
@ -6,7 +6,6 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules
|
||||
Imports DigitalData.Modules.EDMI
|
||||
Imports DigitalData.Modules.EDMI.File
|
||||
Imports DigitalData.Modules.EDMI.API.Rights
|
||||
Imports DigitalData.Services.EDMIService.Messages
|
||||
Imports DigitalData.Services.EDMIService.Exceptions
|
||||
|
||||
@ -145,7 +145,9 @@
|
||||
<Compile Include="Methods\GlobalIndexer\ImportFile\ImportFileRequest.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\ImportFile\ImportFileResponse.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\ImportFile\Steps\PostProcessing.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\Loader.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\ManualIndex.vb" />
|
||||
<Compile Include="Methods\GlobalIndexer\Profile.vb" />
|
||||
<Compile Include="Methods\NewFile\NewFileMethod.vb" />
|
||||
<Compile Include="Methods\NewFile\NewFileRequest.vb" />
|
||||
<Compile Include="Methods\NewFile\NewFileResponse.vb" />
|
||||
@ -160,7 +162,7 @@
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="Messages\DatabaseResult.vb" />
|
||||
<Compile Include="EDMIService.vb" />
|
||||
<Compile Include="Methods\UserAttributeValue.vb" />
|
||||
<Compile Include="Methods\AttributeValue.vb" />
|
||||
<Compile Include="Scheduler\Scheduler.vb" />
|
||||
<Compile Include="Scheduler\DatatableJob.vb" />
|
||||
<Compile Include="Scheduler\JobListener.vb" />
|
||||
|
||||
@ -37,9 +37,13 @@ Namespace IDB
|
||||
End Function
|
||||
|
||||
Public Function UserAttributesToDictionary(pUserAttributes As List(Of UserAttributeValue)) As Dictionary(Of String, List(Of String))
|
||||
If pUserAttributes Is Nothing OrElse pUserAttributes.Count = 0 Then
|
||||
Return New Dictionary(Of String, List(Of String))
|
||||
End If
|
||||
|
||||
Return pUserAttributes.ToDictionary(
|
||||
Function(attr) attr.AttributeName,
|
||||
Function(attr) attr.AttributeValues)
|
||||
Function(attr) attr.Name,
|
||||
Function(attr) attr.Values)
|
||||
End Function
|
||||
|
||||
Public Function TestObjectIdExists(pObjectId As Long, Optional ByRef IsDeleted As Boolean = False, Optional ByRef IsActive As Boolean = False) As Boolean
|
||||
|
||||
29
Service.EDMIService/Methods/AttributeValue.vb
Normal file
29
Service.EDMIService/Methods/AttributeValue.vb
Normal file
@ -0,0 +1,29 @@
|
||||
Namespace Methods
|
||||
|
||||
Public MustInherit Class BaseAttributeValue
|
||||
|
||||
End Class
|
||||
|
||||
''' <summary>
|
||||
''' Attribute values supplied by the user
|
||||
''' </summary>
|
||||
Public Class UserAttributeValue
|
||||
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 Name
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Class AutoAttributeValue
|
||||
Inherits BaseAttributeValue
|
||||
End Class
|
||||
|
||||
Public Class SystemAttributeValue
|
||||
Inherits BaseAttributeValue
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -10,24 +10,19 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
Public Class ImportFileMethod
|
||||
Inherits BaseMethod
|
||||
|
||||
Private ReadOnly Loader As Loader
|
||||
Private ReadOnly Patterns As Patterns2
|
||||
Private ReadOnly GetDatatable As GetDatatableFromCacheMethod
|
||||
Private ReadOnly Connection As SqlClient.SqlConnection
|
||||
Private ReadOnly Transaction As SqlClient.SqlTransaction
|
||||
|
||||
Private User As UserState
|
||||
Private Profile As DataRow
|
||||
|
||||
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
|
||||
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
|
||||
Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM"
|
||||
Private Const TABLE_POST_PROCESSING = "TBDD_INDEX_MAN_POSTPROCESSING"
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig, pMSSQLServer, pGlobalState)
|
||||
|
||||
Patterns = New Patterns2(pLogConfig)
|
||||
GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, GlobalState)
|
||||
Loader = New Loader(pLogConfig, Database, pGlobalState)
|
||||
Connection = Database.GetConnection()
|
||||
Transaction = Connection.BeginTransaction()
|
||||
End Sub
|
||||
@ -47,10 +42,10 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
' TODO: Add missing user properties in UserState from TBDD_USER
|
||||
'pData.User = ResolveUserFromUserName(pData.User.UserName)
|
||||
|
||||
Dim oManualIndexes = LoadManualIndexes(pData.ProfileId)
|
||||
Dim oAutomaticIndexes = LoadAutomaticIndexes(pData.ProfileId)
|
||||
Dim oPostProcessingSteps As DataTable = LoadPostProcessingSteps(oManualIndexes)
|
||||
LoadProfile(pData.ProfileId)
|
||||
Dim oManualIndexes = Loader.LoadManualIndexes(pData.ProfileId)
|
||||
Dim oAutomaticIndexes = Loader.LoadAutomaticIndexes(pData.ProfileId)
|
||||
Dim oPostProcessingSteps As DataTable = Loader.LoadPostProcessingSteps(oManualIndexes)
|
||||
Dim oProfile = Loader.LoadProfile(pData.ProfileId)
|
||||
|
||||
Dim oUserAttributes = pData.AttributeValues
|
||||
Dim oAutoAttributes As List(Of UserAttributeValue) = Nothing
|
||||
@ -79,15 +74,19 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
Throw New ApplicationException(oResponse.ErrorMessage)
|
||||
End If
|
||||
|
||||
Logger.Info("Generating display filename for file [{0}]", pData.File.FileName)
|
||||
' Generate display Filename from nameconvention
|
||||
Dim oDisplayFilename = GetFilenameByNameconvention(
|
||||
pData.File.FileInfoRaw, oProfile.NameConvention, User, oUserAttributes, oAutoAttributes)
|
||||
|
||||
Dim oNameconvention As String = Profile.ItemEx(Of String)("NAMENKONVENTION")
|
||||
Dim oDisplayFilename = GetFilenameByNameconvention(pData.File.FileInfoRaw, oNameconvention, User, oUserAttributes, oAutoAttributes)
|
||||
' Generate virtual path from profile
|
||||
Dim oDynamicFilePath = GetVirtualPath(
|
||||
pData.File.FileInfoRaw, oProfile.DynamicPath, User, oUserAttributes, oAutoAttributes)
|
||||
|
||||
Logger.Info("Collecting Attributes for ObjectId [{0}]", oResponse.ObjectId)
|
||||
|
||||
Dim oFinalAttributes As New Dictionary(Of String, List(Of String)) From {
|
||||
{"DisplayFileName", New List(Of String) From {oDisplayFilename}}
|
||||
{"DisplayFileName", New List(Of String) From {oDisplayFilename}},
|
||||
{"Dynamic Folder", New List(Of String) From {oDynamicFilePath}}
|
||||
}
|
||||
oFinalAttributes = oFinalAttributes.
|
||||
Concat(Helpers.UserAttributesToDictionary(oUserAttributes)).
|
||||
@ -113,8 +112,27 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
End Try
|
||||
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
|
||||
Dim oAttributeDict = Helpers.UserAttributesToDictionary(pAttributes)
|
||||
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 oUserAttributeDict = Helpers.UserAttributesToDictionary(pUserAttributes)
|
||||
Dim oAutoAttributeDict = Helpers.UserAttributesToDictionary(pAutoAttributes)
|
||||
|
||||
If pPathConvention Is Nothing OrElse pPathConvention = String.Empty Then
|
||||
Logger.Warn("Virtual path template for File [{0}] was empty. Returning empty string.", pFileInfo.Name)
|
||||
Return String.Empty
|
||||
|
||||
End If
|
||||
|
||||
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, pUserAttributes As List(Of UserAttributeValue), pAutoAttributes As List(Of UserAttributeValue)) As String
|
||||
Logger.Info("Generating display filename for file [{0}]", pFileInfo.Name)
|
||||
|
||||
Dim oUserAttributeDict = Helpers.UserAttributesToDictionary(pUserAttributes)
|
||||
Dim oAutoAttributeDict = Helpers.UserAttributesToDictionary(pAutoAttributes)
|
||||
|
||||
If pNameconvention Is Nothing OrElse pNameconvention = String.Empty Then
|
||||
@ -123,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
|
||||
|
||||
@ -141,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
|
||||
@ -150,148 +169,6 @@ Namespace Methods.GlobalIndexer.ImportFile
|
||||
End Try
|
||||
Next
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load Profiles for this Import
|
||||
''' </summary>
|
||||
Private Sub LoadProfile(pProfileId As Integer)
|
||||
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
||||
|
||||
Try
|
||||
Dim oProfile = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_PROFILE,
|
||||
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oProfile.OK = False Then
|
||||
LogAndThrow(oProfile.ErrorMessage)
|
||||
End If
|
||||
|
||||
Profile = oProfile.Table.Rows.Item(0)
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while automatic loading indexes!")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load automatic indexes for this Import
|
||||
''' </summary>
|
||||
Private Function LoadAutomaticIndexes(pProfileId As Integer) As List(Of AutomaticIndex)
|
||||
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
||||
|
||||
Try
|
||||
' Load automatic Indexes for this Import
|
||||
Dim oAutomaticIndexes = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_INDEX_AUTOMATIC,
|
||||
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oAutomaticIndexes.OK = False Then
|
||||
LogAndThrow(oAutomaticIndexes.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oIndexes As New List(Of AutomaticIndex)
|
||||
|
||||
For Each oRow As DataRow In oAutomaticIndexes.Table.Rows
|
||||
Dim oAutomaticIndex As New AutomaticIndex With {
|
||||
.Id = oRow.ItemEx(Of Integer)("GUID"),
|
||||
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
|
||||
.ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"),
|
||||
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
|
||||
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
|
||||
.Sequence = oRow.ItemEx(Of String)("SEQUENCE"),
|
||||
.Value = oRow.ItemEx(Of String)("VALUE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oAutomaticIndex)
|
||||
Next
|
||||
|
||||
Logger.Info("Automatic indexes loaded: [{0}]", oIndexes.Count)
|
||||
|
||||
Return oIndexes
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while automatic loading indexes!")
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Load manual indexes for this Import
|
||||
''' </summary>
|
||||
Private Function LoadManualIndexes(pProfileId As Integer) As List(Of ManualIndex)
|
||||
Logger.Debug("Start of Method [LoadManualIndexes]")
|
||||
|
||||
Try
|
||||
' Load manual Indexes for this Import
|
||||
Dim oManualIndexes = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_INDEX_MANUAL,
|
||||
.FilterExpression = $"DOK_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oManualIndexes.OK = False Then
|
||||
LogAndThrow(oManualIndexes.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oIndexes As New List(Of ManualIndex)
|
||||
|
||||
For Each oRow As DataRow In oManualIndexes.Table.Rows
|
||||
Dim oManualIndex As New ManualIndex With {
|
||||
.Id = oRow.ItemEx(Of Integer)("GUID"),
|
||||
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
|
||||
.ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"),
|
||||
.IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"),
|
||||
.IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"),
|
||||
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
|
||||
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
|
||||
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
|
||||
.DataType = oRow.ItemEx(Of String)("DATA_TYPE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oManualIndex)
|
||||
Next
|
||||
|
||||
Logger.Info("Manual indexes loaded: [{0}]", oIndexes.Count)
|
||||
|
||||
Return oIndexes
|
||||
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading indexes!")
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As DataTable
|
||||
Logger.Debug("Start of Method [LoadPostProcessingSteps]")
|
||||
|
||||
Try
|
||||
' Generate a string containing all index ids joined into a string
|
||||
Dim oIndexIdList As List(Of Integer) = pManualIndexes.
|
||||
Select(Function(index) index.Id).
|
||||
ToList()
|
||||
Dim oIndexIds As String = String.Join(",", oIndexIdList)
|
||||
|
||||
If oIndexIdList.Count = 0 Then
|
||||
Logger.Debug("No Postprocessing steps found for this profile. Exiting.")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
' Load all relevant postprocessing steps
|
||||
Dim oPostProcessingSteps = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = TABLE_POST_PROCESSING,
|
||||
.FilterExpression = $"IDXMAN_ID IN ({oIndexIds})"
|
||||
})
|
||||
|
||||
If oPostProcessingSteps.OK = False Then
|
||||
LogAndThrow(oPostProcessingSteps.ErrorMessage)
|
||||
End If
|
||||
|
||||
Return oPostProcessingSteps.Table
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading post processing steps!")
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -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.")
|
||||
|
||||
@ -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
|
||||
|
||||
181
Service.EDMIService/Methods/GlobalIndexer/Loader.vb
Normal file
181
Service.EDMIService/Methods/GlobalIndexer/Loader.vb
Normal file
@ -0,0 +1,181 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Services.EDMIService.Methods.GetDatatableFromCache
|
||||
|
||||
Namespace Methods.GlobalIndexer
|
||||
Public Class Loader
|
||||
Inherits BaseClass
|
||||
|
||||
Private Const VIEW_PROFILE = "VWGI_DOCTYPE_IDB"
|
||||
Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN"
|
||||
Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM"
|
||||
Private Const TABLE_POST_PROCESSING = "TBDD_INDEX_MAN_POSTPROCESSING"
|
||||
|
||||
Private GetDatatable As GetDatatableFromCacheMethod
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pGlobalState As GlobalState)
|
||||
MyBase.New(pLogConfig)
|
||||
GetDatatable = New GetDatatableFromCacheMethod(pLogConfig, pDatabase, pGlobalState)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load Profiles for this Import
|
||||
''' </summary>
|
||||
Public Function LoadProfile(pProfileId As Integer) As Profile
|
||||
Logger.Debug("Start of Method [LoadProfile]")
|
||||
|
||||
Try
|
||||
Dim oProfile = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_PROFILE,
|
||||
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oProfile.OK = False Then
|
||||
LogAndThrow(oProfile.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oProfile.Table.Rows.Item(0)
|
||||
Dim oProfileObject As New Profile With {
|
||||
.Id = oRow.ItemEx("DOCTYPE_ID", 0),
|
||||
.Name = oRow.ItemEx("DOCTYPE", "Missing Profile Name"),
|
||||
.IsActive = oRow.ItemEx("AKTIV", False),
|
||||
.NameConvention = oRow.ItemEx("NAMENKONVENTION", ""),
|
||||
.ObjectStore = oRow.ItemEx("OBJECT_STORE", "Work"),
|
||||
.ShortName = oRow.ItemEx("KURZNAME", ""),
|
||||
.DynamicPath = oRow.ItemEx("DYNAMIC_FOLDER", "")
|
||||
}
|
||||
|
||||
Return oProfileObject
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while automatic loading profile!")
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Load automatic indexes for this Import
|
||||
''' </summary>
|
||||
Public Function LoadAutomaticIndexes(pProfileId As Integer) As List(Of AutomaticIndex)
|
||||
Logger.Debug("Start of Method [LoadAutomaticIndexes]")
|
||||
|
||||
Try
|
||||
' Load automatic Indexes for this Import
|
||||
Dim oAutomaticIndexes = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_INDEX_AUTOMATIC,
|
||||
.FilterExpression = $"DOCTYPE_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oAutomaticIndexes.OK = False Then
|
||||
LogAndThrow(oAutomaticIndexes.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oIndexes As New List(Of AutomaticIndex)
|
||||
|
||||
For Each oRow As DataRow In oAutomaticIndexes.Table.Rows
|
||||
Dim oAutomaticIndex As New AutomaticIndex With {
|
||||
.Id = oRow.ItemEx(Of Integer)("GUID"),
|
||||
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
|
||||
.ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"),
|
||||
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
|
||||
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
|
||||
.Sequence = oRow.ItemEx(Of String)("SEQUENCE"),
|
||||
.Value = oRow.ItemEx(Of String)("VALUE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oAutomaticIndex)
|
||||
Next
|
||||
|
||||
Logger.Info("Automatic indexes loaded: [{0}]", oIndexes.Count)
|
||||
|
||||
Return oIndexes
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while automatic loading indexes!")
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Load manual indexes for this Import
|
||||
''' </summary>
|
||||
Public Function LoadManualIndexes(pProfileId As Integer) As List(Of ManualIndex)
|
||||
Logger.Debug("Start of Method [LoadManualIndexes]")
|
||||
|
||||
Try
|
||||
' Load manual Indexes for this Import
|
||||
Dim oManualIndexes = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = VIEW_INDEX_MANUAL,
|
||||
.FilterExpression = $"DOK_ID = {pProfileId}"
|
||||
})
|
||||
|
||||
If oManualIndexes.OK = False Then
|
||||
LogAndThrow(oManualIndexes.ErrorMessage)
|
||||
End If
|
||||
|
||||
Dim oIndexes As New List(Of ManualIndex)
|
||||
|
||||
For Each oRow As DataRow In oManualIndexes.Table.Rows
|
||||
Dim oManualIndex As New ManualIndex With {
|
||||
.Id = oRow.ItemEx(Of Integer)("GUID"),
|
||||
.Name = oRow.ItemEx(Of String)("INDEXNAME"),
|
||||
.ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"),
|
||||
.IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"),
|
||||
.IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"),
|
||||
.SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"),
|
||||
.SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"),
|
||||
.DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"),
|
||||
.DataType = oRow.ItemEx(Of String)("DATA_TYPE")
|
||||
}
|
||||
|
||||
oIndexes.Add(oManualIndex)
|
||||
Next
|
||||
|
||||
Logger.Info("Manual indexes loaded: [{0}]", oIndexes.Count)
|
||||
|
||||
Return oIndexes
|
||||
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading indexes!")
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function LoadPostProcessingSteps(pManualIndexes As List(Of ManualIndex)) As DataTable
|
||||
Logger.Debug("Start of Method [LoadPostProcessingSteps]")
|
||||
|
||||
Try
|
||||
' Generate a string containing all index ids joined into a string
|
||||
Dim oIndexIdList As List(Of Integer) = pManualIndexes.
|
||||
Select(Function(index) index.Id).
|
||||
ToList()
|
||||
Dim oIndexIds As String = String.Join(",", oIndexIdList)
|
||||
|
||||
If oIndexIdList.Count = 0 Then
|
||||
Logger.Debug("No Postprocessing steps found for this profile. Exiting.")
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
' Load all relevant postprocessing steps
|
||||
Dim oPostProcessingSteps = GetDatatable.Run(
|
||||
New GetDatatableFromCacheRequest With {
|
||||
.DataTable = TABLE_POST_PROCESSING,
|
||||
.FilterExpression = $"IDXMAN_ID IN ({oIndexIds})"
|
||||
})
|
||||
|
||||
If oPostProcessingSteps.OK = False Then
|
||||
LogAndThrow(oPostProcessingSteps.ErrorMessage)
|
||||
End If
|
||||
|
||||
Return oPostProcessingSteps.Table
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, "Error while loading post processing steps!")
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
11
Service.EDMIService/Methods/GlobalIndexer/Profile.vb
Normal file
11
Service.EDMIService/Methods/GlobalIndexer/Profile.vb
Normal file
@ -0,0 +1,11 @@
|
||||
Namespace Methods.GlobalIndexer
|
||||
Public Class Profile
|
||||
Public Property Id As Integer
|
||||
Public Property Name As String
|
||||
Public Property ShortName As String
|
||||
Public Property DynamicPath As String
|
||||
Public Property IsActive As Boolean
|
||||
Public Property NameConvention As String
|
||||
Public Property ObjectStore As String
|
||||
End Class
|
||||
End Namespace
|
||||
@ -1,14 +0,0 @@
|
||||
Namespace Methods
|
||||
|
||||
Public Class UserAttributeValue
|
||||
Public Property AttributeId As Integer
|
||||
Public Property AttributeName As String
|
||||
Public Property AttributeValues As List(Of String)
|
||||
Public Property ControlName As String
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return AttributeName
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -81,7 +81,7 @@ Public Class DatatableJob
|
||||
oResultTable.TableRelationColumn = oParentColumn
|
||||
End If
|
||||
|
||||
oLogger.Debug("Fetched Datatable [{0}]", oDatatableName)
|
||||
oLogger.Info("Fetched Datatable [{0}]", oDatatableName)
|
||||
oResult.Tables.Add(oResultTable)
|
||||
Catch ex As Exception
|
||||
oLogger.Warn("Execute: Error while saving Table: [{0}]", oDatatableName)
|
||||
|
||||
@ -106,8 +106,6 @@ Public Class Scheduler
|
||||
_Logger.Warn("Unexpected Error while setting up scheduler: " & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Async Function GetCronJobs() As Task(Of DataTable)
|
||||
Try
|
||||
Dim oSQL As String = "SELECT * FROM TBAPPSERV_CRON_JOB WHERE ACTIVE = 1"
|
||||
|
||||
@ -36,24 +36,35 @@ Public Class WindowsService
|
||||
|
||||
Protected Overrides Sub OnStart(ByVal args As String())
|
||||
Try
|
||||
' Init
|
||||
Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory
|
||||
Dim oServiceVersion As String = My.Application.Info.Version.ToString()
|
||||
|
||||
' Initializing Logger
|
||||
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), FileKeepRangeInDays:=3)
|
||||
LogConfigScheduler = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), Suffix:="Scheduler", FileKeepRangeInDays:=3)
|
||||
Logger = LogConfig.GetLogger()
|
||||
|
||||
Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
||||
Logger.Info("ServiceDirectory: {0}", oServicePath)
|
||||
' Log Initial
|
||||
Logger.Info("Service [{0}] is starting...", SERVICE_DISPLAY_NAME)
|
||||
Logger.Info("ServiceDirectory: [{0}]", oServicePath)
|
||||
Logger.Info("Version: [{0}]", oServiceVersion)
|
||||
|
||||
' Initializing Config
|
||||
Logger.Info("Loading Config")
|
||||
ConfigManager = New ConfigManager(Of Config)(LogConfig, oServicePath)
|
||||
Config = ConfigManager.Config
|
||||
LogConfig.Debug = ConfigManager.Config.Debug
|
||||
|
||||
' Setup Reload-timer for config
|
||||
Dim oTimer As New Timers.Timer(60000)
|
||||
AddHandler oTimer.Elapsed, AddressOf ReloadTimer_Tick
|
||||
oTimer.Start()
|
||||
|
||||
' Setting Debug Flag
|
||||
Logger.Info("Setting DEBUG Flag to [{0}]", ConfigManager.Config.Debug)
|
||||
LogConfig.Debug = ConfigManager.Config.Debug
|
||||
LogConfigScheduler.Debug = ConfigManager.Config.Debug
|
||||
|
||||
Logger.Debug("Connecting to Databases")
|
||||
|
||||
Firebird = StartFirebird()
|
||||
@ -61,7 +72,6 @@ Public Class WindowsService
|
||||
MSSQL_IDB = GetMSSQL_IDB(LogConfig)
|
||||
|
||||
Logger.Debug("Initializing EDMI Functions")
|
||||
|
||||
Archive = New EDMI.File.Archive(LogConfig)
|
||||
Filesystem = New Filesystem.File(LogConfig)
|
||||
GlobalState = New GlobalState(LogConfig, MSSQL_IDB, MSSQL_ECM)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user