diff --git a/GUIs.ZooFlow/Administration/ClassDetailForm.vb b/GUIs.ZooFlow/Administration/ClassDetailForm.vb index 42df7a58..9b195401 100644 --- a/GUIs.ZooFlow/Administration/ClassDetailForm.vb +++ b/GUIs.ZooFlow/Administration/ClassDetailForm.vb @@ -64,9 +64,11 @@ Public Class ClassDetailForm Case PAGE_IDB_BUSINESS_ENTITIES Load_IDBEntity(PrimaryKey, IsInsert) Return True + Case PAGE_IDB_OBJECT_STORES Load_IDBObjectstore(PrimaryKey, IsInsert) Return True + Case PAGE_CW_PROFILES Load_CWProfile(PrimaryKey, IsInsert) Return True diff --git a/GUIs.ZooFlow/ClassDataASorDB.vb b/GUIs.ZooFlow/ClassDataASorDB.vb index 0f1a10d5..fe3e236a 100644 --- a/GUIs.ZooFlow/ClassDataASorDB.vb +++ b/GUIs.ZooFlow/ClassDataASorDB.vb @@ -57,7 +57,7 @@ Public Class ClassDataASorDB My.Application.User.ShortName = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")) My.Application.User.Email = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")) My.Application.User.Language = DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE") - My.Application.User.LanguageID = DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE_ID") + My.Application.User.LanguageId = DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE_ID") My.Application.User.DateFormat = DT_CHECKUSER_MODULE.Rows(0).Item("USER_DATE_FORMAT") My.Application.User.IsAdmin = DT_CHECKUSER_MODULE.Rows(0).Item("IS_ADMIN") diff --git a/GUIs.ZooFlow/ClassIDBData.vb b/GUIs.ZooFlow/ClassIDBData.vb index 25f11204..d34c6675 100644 --- a/GUIs.ZooFlow/ClassIDBData.vb +++ b/GUIs.ZooFlow/ClassIDBData.vb @@ -18,9 +18,9 @@ Public Class ClassIDBData _Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) _DataASorDB = New ClassDataASorDB(LogConfig) - Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE LANG_ID = {My.Application.User.LanguageID}" + Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE LANG_ID = {My.Application.User.LanguageId}" - DTVWIDB_BE_ATTRIBUTE = _Database.GetDatatable("VWIDB_BE_ATTRIBUTE", oSQL, DatabaseType.IDB, $"LANG_ID = {My.Application.User.LanguageID}") + DTVWIDB_BE_ATTRIBUTE = _Database.GetDatatable("VWIDB_BE_ATTRIBUTE", oSQL, DatabaseType.IDB, $"LANG_ID = {My.Application.User.LanguageId}") 'DTVWIDB_BE_ATTRIBUTE = _DataASorDB.GetDatatable("IDB", oSQL, "VWIDB_BE_ATTRIBUTE", $"LANG_ID = {My.Application.User.LanguageID}") End Sub Public IDBSystemIndices As List(Of String) diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index c388b6a1..20f76369 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -315,7 +315,7 @@ Public Class ClassInit Case "USER_LANGUAGE" MyApplication.User.Language = NotNull(oValue.ToString, "de-DE") Case "USER_LANGUAGEID" - MyApplication.User.LanguageID = CShort(oValue) + MyApplication.User.LanguageId = CShort(oValue) End Select End Sub Private Sub HandleModuleInfo(MyApplication As My.MyApplication, ModuleName As String, Row As DataRow) diff --git a/GUIs.ZooFlow/Globix/ClassFilehandle.vb b/GUIs.ZooFlow/Globix/ClassFilehandle.vb index 40706c2e..1a2b0ce1 100644 --- a/GUIs.ZooFlow/Globix/ClassFilehandle.vb +++ b/GUIs.ZooFlow/Globix/ClassFilehandle.vb @@ -240,29 +240,29 @@ Public Class ClassFilehandle End Try End Function - '' - ''' Ersetzt alle nicht zulässigen Zeichen im angegebenen Dateinamen - ''' - ''' Dateiname ohne Pfadangabe - ''' Ersatzzeichen für alle unzulässigen Zeichen - ''' im Dateinamen - Public Function CleanFilename(ByVal sFilename As String, Optional ByVal REPLACEChar As String = "") As String - _LOGGER.Info(" Filename before CleanFilename: '" & sFilename & "'") - If sFilename.Contains(".\") Then - sFilename = sFilename.Replace(".\", "\") - End If - 'If sFilename.Contains("'") Then - ' sFilename = sFilename.Replace("'", "") - 'End If - 'If sFilename.Contains("..") Then - ' sFilename = sFilename.Replace("..", ".") - 'End If - ' alle nicht zulässigen Zeichen ersetzen - sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, My.Application.Globix.REGEX_CLEAN_FILENAME, REPLACEChar) - sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, "[\\/:*?""<>|\r\n]", "", System.Text.RegularExpressions.RegexOptions.Singleline) - 'Dim oCleanFileName As String = String.Join(REPLACEChar, sFilename.Split(Path.GetInvalidFileNameChars())) - Dim oCleanFileName As New System.IO.FileInfo(System.Text.RegularExpressions.Regex.Replace(sFilename, String.Format("[{0}]", String.Join(String.Empty, Path.GetInvalidFileNameChars)), REPLACEChar)) - _LOGGER.Info("Filename after CleanFilename: '" & sFilename & "'") - Return sFilename - End Function + ''' + '''' Ersetzt alle nicht zulässigen Zeichen im angegebenen Dateinamen + '''' + '''' Dateiname ohne Pfadangabe + '''' Ersatzzeichen für alle unzulässigen Zeichen + '''' im Dateinamen + 'Public Function CleanFilename(ByVal sFilename As String, Optional ByVal REPLACEChar As String = "") As String + ' _LOGGER.Info(" Filename before CleanFilename: '" & sFilename & "'") + ' If sFilename.Contains(".\") Then + ' sFilename = sFilename.Replace(".\", "\") + ' End If + ' 'If sFilename.Contains("'") Then + ' ' sFilename = sFilename.Replace("'", "") + ' 'End If + ' 'If sFilename.Contains("..") Then + ' ' sFilename = sFilename.Replace("..", ".") + ' 'End If + ' ' alle nicht zulässigen Zeichen ersetzen + ' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, My.Application.Globix.REGEX_CLEAN_FILENAME, REPLACEChar) + ' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, "[\\/:*?""<>|\r\n]", "", System.Text.RegularExpressions.RegexOptions.Singleline) + ' 'Dim oCleanFileName As String = String.Join(REPLACEChar, sFilename.Split(Path.GetInvalidFileNameChars())) + ' Dim oCleanFileName As New System.IO.FileInfo(System.Text.RegularExpressions.Regex.Replace(sFilename, String.Format("[{0}]", String.Join(String.Empty, Path.GetInvalidFileNameChars)), REPLACEChar)) + ' _LOGGER.Info("Filename after CleanFilename: '" & sFilename & "'") + ' Return sFilename + 'End Function End Class diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb index 9d898e53..10a20a6c 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb @@ -247,7 +247,7 @@ Partial Class frmGlobix_Index Me.SplitContainerControl1.Panel2.Controls.Add(Me.DocumentViewer1) Me.SplitContainerControl1.Panel2.Text = "Panel2" Me.SplitContainerControl1.Size = New System.Drawing.Size(1005, 508) - Me.SplitContainerControl1.SplitterPosition = 591 + Me.SplitContainerControl1.SplitterPosition = 522 Me.SplitContainerControl1.TabIndex = 2 ' 'pnlIndex @@ -258,7 +258,7 @@ Partial Class frmGlobix_Index Me.pnlIndex.ForeColor = System.Drawing.SystemColors.ControlText Me.pnlIndex.Location = New System.Drawing.Point(0, 33) Me.pnlIndex.Name = "pnlIndex" - Me.pnlIndex.Size = New System.Drawing.Size(591, 400) + Me.pnlIndex.Size = New System.Drawing.Size(522, 400) Me.pnlIndex.TabIndex = 3 ' 'Panel3 @@ -267,7 +267,7 @@ Partial Class frmGlobix_Index Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom Me.Panel3.Location = New System.Drawing.Point(0, 433) Me.Panel3.Name = "Panel3" - Me.Panel3.Size = New System.Drawing.Size(591, 75) + Me.Panel3.Size = New System.Drawing.Size(522, 75) Me.Panel3.TabIndex = 2 ' 'btnAblageFlow @@ -278,7 +278,7 @@ Partial Class frmGlobix_Index Me.btnAblageFlow.ImageAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnAblageFlow.Location = New System.Drawing.Point(0, 0) Me.btnAblageFlow.Name = "btnAblageFlow" - Me.btnAblageFlow.Size = New System.Drawing.Size(591, 75) + Me.btnAblageFlow.Size = New System.Drawing.Size(522, 75) Me.btnAblageFlow.TabIndex = 1 Me.btnAblageFlow.Text = "Starte Ablage" Me.btnAblageFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft @@ -291,7 +291,7 @@ Partial Class frmGlobix_Index Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top Me.Panel1.Location = New System.Drawing.Point(0, 0) Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(591, 33) + Me.Panel1.Size = New System.Drawing.Size(522, 33) Me.Panel1.TabIndex = 0 ' 'ComboBoxEdit1 @@ -306,7 +306,7 @@ Partial Class frmGlobix_Index Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat Me.ComboBoxEdit1.Properties.NullText = "Bitte wählen Sie ein Profil" Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5) - Me.ComboBoxEdit1.Size = New System.Drawing.Size(591, 30) + Me.ComboBoxEdit1.Size = New System.Drawing.Size(522, 30) Me.ComboBoxEdit1.TabIndex = 4 ' 'DocumentViewer1 @@ -315,7 +315,7 @@ Partial Class frmGlobix_Index Me.DocumentViewer1.FileLoaded = False Me.DocumentViewer1.Location = New System.Drawing.Point(0, 0) Me.DocumentViewer1.Name = "DocumentViewer1" - Me.DocumentViewer1.Size = New System.Drawing.Size(404, 508) + Me.DocumentViewer1.Size = New System.Drawing.Size(473, 508) Me.DocumentViewer1.TabIndex = 0 ' 'GlobixDataset diff --git a/GUIs.ZooFlow/Search/frmFlowSearch.vb b/GUIs.ZooFlow/Search/frmFlowSearch.vb index d43ef1d2..91078724 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch.vb @@ -60,7 +60,7 @@ Public Class frmFlowSearch cmbAttributeDate.Items.Add(IDB_ADDED_WHEN_String_Englisch) End If 'Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}") - Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}", DatabaseType.IDB, $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}") + Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageId}", DatabaseType.IDB, $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageId}") For Each oRow As DataRow In oDT.Rows cmbAttributeDate.Items.Add(oRow.Item("ATTR_TITLE")) @@ -191,7 +191,7 @@ Public Class frmFlowSearch Try oHandle = SplashScreenManager.ShowOverlayForm(Me) - Dim oEXECSQL = $"EXEC PRFLOW_SEARCH_GET_RESULT '{pSearchValue}','{SEARCH_FACT_DATE}', {My.Application.User.UserId},'{oSearchData.SelectInStringAttributeIds}','{oSearchData.SelectInIntegerAttributeIds}',{My.Application.User.LanguageID},'{pOptAttribute}'" + Dim oEXECSQL = $"EXEC PRFLOW_SEARCH_GET_RESULT '{pSearchValue}','{SEARCH_FACT_DATE}', {My.Application.User.UserId},'{oSearchData.SelectInStringAttributeIds}','{oSearchData.SelectInIntegerAttributeIds}',{My.Application.User.LanguageId},'{pOptAttribute}'" Dim oDTOBJECT_RESULT As DataTable = My.DatabaseIDB.GetDatatable(oEXECSQL) If Not IsNothing(oDTOBJECT_RESULT) Then If oDTOBJECT_RESULT.Rows.Count = 0 Then @@ -375,7 +375,7 @@ Public Class frmFlowSearch oHandle = SplashScreenManager.ShowOverlayForm(Me) 'Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}") - Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}", DatabaseType.IDB, $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}") + Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageId}", DatabaseType.IDB, $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageId}") Dim oType = oDT.Rows(0).Item("TYPE_NAME") Dim oEXECSQL = $"EXEC PRFLOW_SEARCH_GET_RESULT_PER_TILE {oSplit(0)},{My.Application.User.UserId},'{oType}',{oSplit(1)},'{My.Application.User.Language}'" diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index 8f18b43f..8d152e11 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -419,7 +419,7 @@ Public Class frmFlowForm Next If oSQLFlowSearch <> String.Empty Then oSQLFlowSearch = oSQLFlowSearch.Replace("@USER_ID", My.Application.User.UserId) - oSQLFlowSearch = oSQLFlowSearch.Replace("@LANGUAGE_ID", My.Application.User.LanguageID) + oSQLFlowSearch = oSQLFlowSearch.Replace("@LANGUAGE_ID", My.Application.User.LanguageId) oSQLFlowSearch = oSQLFlowSearch.Replace("@LANGUAGE", My.Application.User.Language) Dim oForm As New frmFlowSearch(oSQLFlowSearch) oForm.Show() diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index fa3dc210..2b30dc27 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -150,12 +150,14 @@ Public Class Client Dim oFileImportResponse = Await _channel.NewFileAsync(New NewFileRequest With { .BusinessEntity = pBusinessEntity, - .FileName = oFileInfo.Name, - .FileCreatedAt = oFileCreatedAt, - .FileChangedAt = oFileModifiedAt, - .FileContents = oContents, - .FileImportedAt = pImportOptions.DateImported, - .FileChecksum = oFileHash, + .File = New FileProperties With { + .FileName = oFileInfo.Name, + .FileCreatedAt = oFileCreatedAt, + .FileChangedAt = oFileModifiedAt, + .FileContents = oContents, + .FileImportedAt = pImportOptions.DateImported, + .FileChecksum = oFileHash + }, .KindType = pObjectKind, .StoreName = pObjectStoreName, .Who = pImportOptions.Username @@ -529,6 +531,16 @@ Public Class Client End Try End Function + Public Async Function GetDatatableByNameAsync(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As Task(Of TableResult) + Try + Dim oResponse = _channel.ReturnDatatableFromCache(DatatableName, FilterExpression, SortByColumn) + Return oResponse + Catch ex As Exception + _logger.Error(ex) + Throw ex + End Try + End Function + ''' ''' Return infos about a file object ''' diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.NewFile.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.NewFile.xsd similarity index 56% rename from Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.NewFile.xsd rename to Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.NewFile.xsd index 63de4e06..2aa3f71d 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.NewFile.xsd +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.NewFile.xsd @@ -1,15 +1,11 @@  - + + - - - - - - + @@ -19,7 +15,7 @@ - + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.SetAttributeValue.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.SetAttributeValue.xsd similarity index 78% rename from Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.SetAttributeValue.xsd rename to Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.SetAttributeValue.xsd index 84b1eb72..fb7799c9 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.FileStorage.SetAttributeValue.xsd +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.SetAttributeValue.xsd @@ -1,10 +1,11 @@  - + + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.xsd new file mode 100644 index 00000000..0a3fdbd6 --- /dev/null +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.Methods.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl index f228f2f8..e5817814 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl @@ -8,8 +8,9 @@ - - + + + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd index 1f7d2fbf..aa80c7b0 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd @@ -1,8 +1,8 @@  - - + + @@ -162,28 +162,28 @@ - + - + - + - + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap index dbd92a1b..60e088a1 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.svcmap @@ -30,8 +30,9 @@ - - + + + diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb index 69d93431..7a74f601 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb @@ -117,6 +117,7 @@ Namespace EDMIServiceReference System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.ObjectDoesNotExistFault)), _ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NewFileRequest)), _ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.NewFileResponse)), _ + System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.FileProperties)), _ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueRequest)), _ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.SetAttributeValueResponse)), _ System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.RightsAccessRight))> _ @@ -151,8 +152,8 @@ Namespace EDMIServiceReference _ Partial Public Class NewFileResponse Inherits EDMIServiceReference.BaseResponse @@ -176,8 +177,8 @@ Namespace EDMIServiceReference _ Partial Public Class SetAttributeValueResponse Inherits EDMIServiceReference.BaseResponse @@ -336,8 +337,8 @@ Namespace EDMIServiceReference _ Partial Public Class NewFileRequest Inherits Object @@ -350,22 +351,7 @@ Namespace EDMIServiceReference Private BusinessEntityField As String _ - Private FileChangedAtField As String - - _ - Private FileChecksumField As String - - _ - Private FileContentsField() As Byte - - _ - Private FileCreatedAtField As String - - _ - Private FileImportedAtField As Date - - _ - Private FileNameField As String + Private FileField As EDMIServiceReference.FileProperties _ Private KindTypeField As String @@ -402,6 +388,120 @@ Namespace EDMIServiceReference End Set End Property + _ + Public Property File() As EDMIServiceReference.FileProperties + Get + Return Me.FileField + End Get + Set + If (Object.ReferenceEquals(Me.FileField, value) <> true) Then + Me.FileField = value + Me.RaisePropertyChanged("File") + End If + End Set + End Property + + _ + Public Property KindType() As String + Get + Return Me.KindTypeField + End Get + Set + If (Object.ReferenceEquals(Me.KindTypeField, value) <> true) Then + Me.KindTypeField = value + Me.RaisePropertyChanged("KindType") + End If + End Set + End Property + + _ + Public Property Language() As String + Get + Return Me.LanguageField + End Get + Set + If (Object.ReferenceEquals(Me.LanguageField, value) <> true) Then + Me.LanguageField = value + Me.RaisePropertyChanged("Language") + End If + End Set + End Property + + _ + Public Property StoreName() As String + Get + Return Me.StoreNameField + End Get + Set + If (Object.ReferenceEquals(Me.StoreNameField, value) <> true) Then + Me.StoreNameField = value + Me.RaisePropertyChanged("StoreName") + End If + End Set + End Property + + _ + Public Property Who() As String + Get + Return Me.WhoField + End Get + Set + If (Object.ReferenceEquals(Me.WhoField, value) <> true) Then + Me.WhoField = value + Me.RaisePropertyChanged("Who") + 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) + Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent + If (Not (propertyChanged) Is Nothing) Then + propertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName)) + End If + End Sub + End Class + + _ + Partial Public Class FileProperties + Inherits Object + Implements System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged + + _ + Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject + + _ + Private FileChangedAtField As String + + _ + Private FileChecksumField As String + + _ + Private FileContentsField() As Byte + + _ + Private FileCreatedAtField As String + + _ + Private FileImportedAtField As Date + + _ + Private FileNameField As String + + _ + Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData + Get + Return Me.extensionDataField + End Get + Set + Me.extensionDataField = value + End Set + End Property + _ Public Property FileChangedAt() As String Get @@ -480,58 +580,6 @@ Namespace EDMIServiceReference End Set End Property - _ - Public Property KindType() As String - Get - Return Me.KindTypeField - End Get - Set - If (Object.ReferenceEquals(Me.KindTypeField, value) <> true) Then - Me.KindTypeField = value - Me.RaisePropertyChanged("KindType") - End If - End Set - End Property - - _ - Public Property Language() As String - Get - Return Me.LanguageField - End Get - Set - If (Object.ReferenceEquals(Me.LanguageField, value) <> true) Then - Me.LanguageField = value - Me.RaisePropertyChanged("Language") - End If - End Set - End Property - - _ - Public Property StoreName() As String - Get - Return Me.StoreNameField - End Get - Set - If (Object.ReferenceEquals(Me.StoreNameField, value) <> true) Then - Me.StoreNameField = value - Me.RaisePropertyChanged("StoreName") - End If - End Set - End Property - - _ - Public Property Who() As String - Get - Return Me.WhoField - End Get - Set - If (Object.ReferenceEquals(Me.WhoField, value) <> true) Then - Me.WhoField = value - Me.RaisePropertyChanged("Who") - 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) @@ -544,8 +592,8 @@ Namespace EDMIServiceReference _ Partial Public Class SetAttributeValueRequest Inherits Object @@ -560,6 +608,9 @@ Namespace EDMIServiceReference _ Private AttributeValueField As String + _ + Private LanguageField As String + _ Private ObjectIdField As Long @@ -602,6 +653,19 @@ Namespace EDMIServiceReference End Set End Property + _ + Public Property Language() As String + Get + Return Me.LanguageField + End Get + Set + If (Object.ReferenceEquals(Me.LanguageField, value) <> true) Then + Me.LanguageField = value + Me.RaisePropertyChanged("Language") + End If + End Set + End Property + _ Public Property ObjectId() As Long Get diff --git a/Modules.EDMIAPI/EDMI.API.vbproj b/Modules.EDMIAPI/EDMI.API.vbproj index 3dd801ed..47af114d 100644 --- a/Modules.EDMIAPI/EDMI.API.vbproj +++ b/Modules.EDMIAPI/EDMI.API.vbproj @@ -145,15 +145,18 @@ Designer - - Designer - - - Designer - Designer + + Designer + + + Designer + + + Designer + Designer diff --git a/Modules.Language/DataRowEx.vb b/Modules.Language/DataRowEx.vb new file mode 100644 index 00000000..23245305 --- /dev/null +++ b/Modules.Language/DataRowEx.vb @@ -0,0 +1,12 @@ +Imports System.Runtime.CompilerServices + +Public Module DataRowEx + + Public Function ItemEx(Of T)(pRow As DataRow, pFieldName As String, Optional pDefaultValue As T = Nothing) As T + Try + Return Utils.NotNull(pRow.Item(pFieldName), pDefaultValue) + Catch ex As Exception + Return Nothing + End Try + End Function +End Module diff --git a/Modules.Language/Language.vbproj b/Modules.Language/Language.vbproj index b7c52061..3384ce30 100644 --- a/Modules.Language/Language.vbproj +++ b/Modules.Language/Language.vbproj @@ -74,6 +74,7 @@ + diff --git a/Modules.Language/Utils.vb b/Modules.Language/Utils.vb index f84276f5..153e767f 100644 --- a/Modules.Language/Utils.vb +++ b/Modules.Language/Utils.vb @@ -1,4 +1,5 @@ Imports System.Drawing +Imports System.Runtime.CompilerServices Imports System.Text Imports System.Text.RegularExpressions Imports System.Windows.Forms diff --git a/Modules.ZooFlow/State/UserState.vb b/Modules.ZooFlow/State/UserState.vb index dcb8d752..728d5965 100644 --- a/Modules.ZooFlow/State/UserState.vb +++ b/Modules.ZooFlow/State/UserState.vb @@ -17,19 +17,28 @@ Namespace State Public Property MachineName As String Public Property DateFormat As String Public Property Language As String - Public Property LanguageID As Int16 + Public Property LanguageId As Integer Public Property IsAdmin As Boolean = False Public Property HideBasicConfig As Boolean = False ''' - ''' Initialize user object with values that can be read from the environment + ''' Initialize user object with values that can be read from the environment. Only meant for Global Application State ''' Public Sub New() Language = Thread.CurrentThread.CurrentCulture.Name UserName = System.Environment.UserName MachineName = System.Environment.MachineName End Sub + + ''' + ''' Initialize user object with user id. Mandatory for sending user data between systems. + ''' + ''' + Public Sub New(pUserId As Integer) + MyBase.New() + UserId = pUserId + End Sub End Class End Namespace diff --git a/Service.EDMIService/BaseMethod.vb b/Service.EDMIService/BaseMethod.vb index 41770d47..85871ff0 100644 --- a/Service.EDMIService/BaseMethod.vb +++ b/Service.EDMIService/BaseMethod.vb @@ -14,13 +14,13 @@ Public MustInherit Class BaseMethod Helpers = New Helpers(pLogConfig, pMSSQLServer) End Sub - Public Function LogAndThrow(pMessage As String) + Public Sub LogAndThrow(pMessage As String) Logger.Warn(pMessage) Throw New ApplicationException(pMessage) - End Function + End Sub - Public Function LogAndThrow(pException As Exception, pMessage As String) + Public Sub LogAndThrow(pException As Exception, pMessage As String) Logger.Error(pException) Throw New ApplicationException(pMessage, pException) - End Function + End Sub End Class diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index ae0a4dfc..7534cb77 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -10,8 +10,8 @@ Imports DigitalData.Services.EDMIService.Messages Imports DigitalData.Modules.EDMI.API.Rights Imports DigitalData.Services.EDMIService.Exceptions Imports DigitalData.Services.EDMIService.GlobalState -Imports DigitalData.Services.EDMIService.FileStorage -Imports DigitalData.Services.EDMIService.FileStorage.SetAttributeValue +Imports DigitalData.Services.EDMIService.Methods +Imports DigitalData.Services.EDMIService.Methods.SetAttributeValue Public Class EDMIService @@ -81,52 +81,18 @@ Public Class EDMIService #Region "=== Database ===" Public Function ReturnDatatableFromCache(Name As String, FilterExpression As String, SortByColumn As String) As TableResult Implements IEDMIService.ReturnDatatableFromCache - Try - _Logger.Debug($"ReturnDatatableFromCache: Datatable: {Name}") + Dim oReturnDatatableFromCache As New GetDatatableFromCache.GetDatatableFromCacheMethod(LogConfig, MSSQL_ECM, GlobalState.TableStore) + Dim oResult = oReturnDatatableFromCache.Run(New GetDatatableFromCache.GetDatatableFromCacheRequest With { + .DataTable = Name, + .FilterExpression = FilterExpression, + .SortByColumn = SortByColumn + }) - Dim oDataset As DataSet = GlobalState.TableStore - Dim oDataTable As DataTable = Nothing - - _Logger.Debug("ReturnDatatableFromCache: DataSet contains [{0}] datatables", oDataset.Tables.Count) - - If oDataset.Tables.Contains(Name) Then - oDataTable = oDataset.Tables.Item(Name).Copy() - - ' Apply filter and sorting to data - Dim oFilterExpression As String = Utils.NotNull(FilterExpression, String.Empty) - Dim oSortByColumn As String = Utils.NotNull(SortByColumn, String.Empty) - - Dim oFilteredRows = oDataTable.Select(oFilterExpression, oSortByColumn) - Dim oFilteredTable As DataTable = Nothing - - If oFilteredRows.Count > 0 Then - oFilteredTable = oFilteredRows.CopyToDataTable() - oFilteredTable.TableName = Name - Else - ' Produce empty table - oFilteredTable = oDataTable.Clone() - oFilteredTable.TableName = Name - End If - - _Logger.Debug("ReturnDatatableFromCache: Datatable Stats for [{0}]:", Name) - _Logger.Debug("Unfiltered: [{0}] rows", oDataTable.Rows.Count) - _Logger.Debug("Filtered: [{0}] rows", oFilteredTable.Rows.Count) - - Return New TableResult(oFilteredTable) - Else - _Logger.Warn($"ReturnDatatableFromCache: Datatable {Name} does not exist") - Throw GetFault($"ReturnDatatableFromCache: Datatable {Name} does not exist") - End If - - Catch ex As FaultException - _Logger.Error(ex) - Throw ex - - Catch ex As Exception - _Logger.Error(ex) - Throw GetFault(ex) - - End Try + If oResult.OK Then + Return New TableResult(oResult.Table) + Else + Return New TableResult(oResult.ErrorMessage) + End If End Function #End Region diff --git a/Service.EDMIService/EDMIService.vbproj b/Service.EDMIService/EDMIService.vbproj index 552abe87..3d39f8f4 100644 --- a/Service.EDMIService/EDMIService.vbproj +++ b/Service.EDMIService/EDMIService.vbproj @@ -131,15 +131,22 @@ - - - - - - - - - + + + + + + + + + + + + + + + + @@ -148,6 +155,7 @@ + @@ -233,6 +241,10 @@ {903B2D7D-3B80-4BE9-8713-7447B704E1B0} Logging + + {7c3b0c7e-59fe-4e1a-a655-27ae119f9444} + Patterns + diff --git a/Service.EDMIService/GlobalState.vb b/Service.EDMIService/GlobalState.vb index 8ab7b20a..fdab4321 100644 --- a/Service.EDMIService/GlobalState.vb +++ b/Service.EDMIService/GlobalState.vb @@ -26,7 +26,7 @@ Public Class GlobalState ObjectStores.Clear() - _Logger.Debug("Found {0} Object Stores", oDatatable.Rows) + _Logger.Info("Found [{0}] Object Stores", oDatatable.Rows.Count) For Each oRow As DataRow In oDatatable.Rows Dim oStore As New ObjectStore() With { @@ -35,7 +35,7 @@ Public Class GlobalState .Path = oRow.Item("IDB_PRAEFIX"), .Title = oRow.Item("OS_TITLE") } - _Logger.Debug("New Object Store [{0}]", oStore.Title) + _Logger.Info("New Object Store [{0}]", oStore.Title) ObjectStores.Add(oStore) Next Catch ex As Exception diff --git a/Service.EDMIService/IEDMIService.vb b/Service.EDMIService/IEDMIService.vb index 313c00b4..9e2ac29d 100644 --- a/Service.EDMIService/IEDMIService.vb +++ b/Service.EDMIService/IEDMIService.vb @@ -3,7 +3,7 @@ Imports System.ServiceModel Imports DigitalData.Modules.Filesystem Imports DigitalData.Services.EDMIService.Exceptions Imports DigitalData.Services.EDMIService.Messages -Imports DigitalData.Services.EDMIService.FileStorage +Imports DigitalData.Services.EDMIService.Methods Interface IEDMIService diff --git a/Service.EDMIService/Filestorage/NewFile/NewFileRequest.vb b/Service.EDMIService/Methods/FileProperties.vb similarity index 52% rename from Service.EDMIService/Filestorage/NewFile/NewFileRequest.vb rename to Service.EDMIService/Methods/FileProperties.vb index 93c408b4..4ea8a239 100644 --- a/Service.EDMIService/Filestorage/NewFile/NewFileRequest.vb +++ b/Service.EDMIService/Methods/FileProperties.vb @@ -1,9 +1,7 @@ Imports System.Runtime.Serialization -Namespace FileStorage.NewFile - - - Public Class NewFileRequest +Namespace Methods + Public Class FileProperties ''' ''' Absolute filename of the file to be imported ''' @@ -39,38 +37,6 @@ Namespace FileStorage.NewFile ''' Public Property FileChecksum As String - - ''' - ''' Name/title of the ObjectStore to save the file to, ex. Work - ''' - - Public Property StoreName As String - - ''' - ''' The business entity of the file, ex DEFAULT - ''' - - Public Property BusinessEntity As String - - ''' - ''' The kind of object to be created, ex. DOC - ''' - - Public Property KindType As String - - ''' - ''' The name of the user importing the file, ex. JenneJ - ''' - - Public Property Who As String - - ''' - ''' The language of the user - ''' - ''' - - Public Property Language As String End Class -End Namespace - +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueMethod.vb b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb similarity index 89% rename from Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueMethod.vb rename to Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb index 7bdead0f..76dd97e4 100644 --- a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueMethod.vb +++ b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueMethod.vb @@ -1,7 +1,7 @@ Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging -Namespace FileStorage.GetAttributeValue +Namespace Methods.GetAttributeValue Public Class GetAttributeValueMethod Inherits BaseMethod @@ -16,7 +16,7 @@ Namespace FileStorage.GetAttributeValue End If Dim oValue As Object - + ' TODO: Implement GetAttributeValue Return New GetAttributeValueResponse(pData.ObjectId, oValue) Catch ex As Exception diff --git a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueRequest.vb b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueRequest.vb similarity index 72% rename from Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueRequest.vb rename to Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueRequest.vb index 702f74df..84a85408 100644 --- a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueRequest.vb +++ b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueRequest.vb @@ -1,4 +1,4 @@ -Namespace FileStorage.GetAttributeValue +Namespace Methods.GetAttributeValue Public Class GetAttributeValueRequest Public Property ObjectId As Long End Class diff --git a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueResponse.vb b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueResponse.vb similarity index 93% rename from Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueResponse.vb rename to Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueResponse.vb index 7f08b663..7c20e711 100644 --- a/Service.EDMIService/Filestorage/GetAttributeValue/GetAttributeValueResponse.vb +++ b/Service.EDMIService/Methods/GetAttributeValue/GetAttributeValueResponse.vb @@ -1,6 +1,6 @@ Imports System.Runtime.Serialization -Namespace FileStorage.GetAttributeValue +Namespace Methods.GetAttributeValue diff --git a/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb new file mode 100644 index 00000000..a8d6a4c1 --- /dev/null +++ b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheMethod.vb @@ -0,0 +1,62 @@ +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Language +Imports DigitalData.Modules.Logging + +Namespace Methods.GetDatatableFromCache + Public Class GetDatatableFromCacheMethod + Inherits BaseMethod + + Private ReadOnly TableStore As DataSet + + Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet) + MyBase.New(pLogConfig, pMSSQLServer) + TableStore = pTableStore + End Sub + + Public Function Run(pData As GetDatatableFromCacheRequest) As GetDatatableFromCacheResponse + Try + Logger.Debug($"ReturnDatatableFromCache: Datatable: {pData.DataTable}") + + Dim oDataTable As DataTable = Nothing + + Logger.Debug("ReturnDatatableFromCache: DataSet contains [{0}] datatables", TableStore.Tables.Count) + + If TableStore.Tables.Contains(pData.DataTable) Then + oDataTable = TableStore.Tables.Item(pData.DataTable).Copy() + + ' Apply filter and sorting to data + Dim oFilterExpression As String = Utils.NotNull(pData.FilterExpression, String.Empty) + Dim oSortByColumn As String = Utils.NotNull(pData.SortByColumn, String.Empty) + + Dim oFilteredRows = oDataTable.Select(oFilterExpression, oSortByColumn) + Dim oFilteredTable As DataTable = Nothing + + If oFilteredRows.Count > 0 Then + oFilteredTable = oFilteredRows.CopyToDataTable() + oFilteredTable.TableName = pData.DataTable + Else + ' Produce empty table + oFilteredTable = oDataTable.Clone() + oFilteredTable.TableName = pData.DataTable + End If + + Logger.Debug("ReturnDatatableFromCache: Datatable Stats for [{0}]:", pData.DataTable) + Logger.Debug("Unfiltered: [{0}] rows", oDataTable.Rows.Count) + Logger.Debug("Filtered: [{0}] rows", oFilteredTable.Rows.Count) + + Return New GetDatatableFromCacheResponse(oFilteredTable) + Else + Logger.Warn($"ReturnDatatableFromCache: Datatable {pData.DataTable} does not exist") + + Return New GetDatatableFromCacheResponse(New KeyNotFoundException($"Datatable {pData.DataTable} does not exist")) + End If + + Catch ex As Exception + Logger.Error(ex) + Return New GetDatatableFromCacheResponse(ex) + + End Try + End Function + End Class + +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheRequest.vb b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheRequest.vb new file mode 100644 index 00000000..173ef344 --- /dev/null +++ b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheRequest.vb @@ -0,0 +1,14 @@ +Imports System.Runtime.Serialization + +Namespace Methods.GetDatatableFromCache + + + Public Class GetDatatableFromCacheRequest + + Public Property DataTable As String + + Public Property FilterExpression As String + + Public Property SortByColumn As String + End Class +End Namespace diff --git a/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheResponse.vb b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheResponse.vb new file mode 100644 index 00000000..8480e418 --- /dev/null +++ b/Service.EDMIService/Methods/GetDatatableFromCache/GetDatatableFromCacheResponse.vb @@ -0,0 +1,22 @@ +Imports System.Runtime.Serialization + +Namespace Methods.GetDatatableFromCache + + + Public Class GetDatatableFromCacheResponse + Inherits Messages.BaseResponse + + + Public Property Table As DataTable + + Public Sub New(pTable As DataTable) + MyBase.New() + Table = pTable + End Sub + + Public Sub New(pException As Exception, Optional pDetails As String = "") + MyBase.New(pException, pDetails) + End Sub + End Class + +End Namespace diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb new file mode 100644 index 00000000..41d13746 --- /dev/null +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb @@ -0,0 +1,227 @@ +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Patterns +Imports DigitalData.Modules.Language +Imports DigitalData.Services.EDMIService.Methods.GetDatatableFromCache + +Namespace Methods.GlobalIndexer.ImportFile + Public Class ImportFileMethod + Inherits BaseMethod + + Private ReadOnly TableStore As DataSet + Private ReadOnly Patterns As Patterns2 + Private ReadOnly GetDatatable As GetDatatableFromCacheMethod + + Private ManualIndexes As DataTable + Private AutomaticIndexes As DataTable + Private ManualIndexesPostProcessing As DataTable + + Private Const VIEW_INDEX_MANUAL = "VWDDINDEX_MAN" + Private Const VIEW_INDEX_AUTOMATIC = "VWDDINDEX_AUTOM" + Private Const TABLE_POST_PROCESSING = "TBDD_INDEX_MAN_POSTPROCESSING" + + Private Const TYPE_VBSPLIT = "VBSPLIT" + Private Const TYPE_VBREPLACE = "VBREPLACE" + Private Const TYPE_REGEXPRESSION = "REG. EXPRESSION" + + Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pTableStore As DataSet) + MyBase.New(pLogConfig, pMSSQLServer) + + TableStore = pTableStore + Patterns = New Patterns2(pLogConfig) + GetDatatable = New GetDatatableFromCacheMethod(LogConfig, Database, TableStore) + End Sub + + ''' + ''' + ''' + ''' + ''' + ''' + ''' + ''' + Public Function Run(pData As ImportFileRequest) + Try + LoadIndexes(pData.ProfileId) + + Dim oFinalAttributes = pData.AttributeValues + + ' apply the post processing + oFinalAttributes = ApplyManualPostprocessing(oFinalAttributes, ManualIndexesPostProcessing) + + ' TODO: apply the manual attributes + oFinalAttributes = ApplyAutomaticeAttributes(oFinalAttributes) + + + Catch ex As Exception + Return New ImportFileResponse(ex) + End Try + End Function + + Private Function ApplyManualPostprocessing(pManualAttributes As List(Of UserAttributeValue), pPostprocessingSteps As DataTable) As List(Of UserAttributeValue) + Logger.Debug("Start of Method [ApplyManualPostprocessing]") + Dim oAttributes = pManualAttributes + + For Each oProcessingRow As DataRow In pPostprocessingSteps.Rows + + Dim oIndexId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID") + Dim oIndexRow As DataRow = ManualIndexes.Select($"GUID = {oIndexId}").FirstOrDefault() + Dim oIndex As UserAttributeValue = pManualAttributes. + Where(Function(attr) attr.AttributeId = oProcessingRow.ItemEx(Of Integer)("IDXMAN_ID")). + FirstOrDefault() + + Dim oValue = GetPostprocessingValue(oIndex.AttributeValues, oIndexRow) + + oAttributes.Add(New UserAttributeValue With { + .AttributeId = oIndexId, + .AttributeName = oIndex.AttributeName, + .AttributeValues = oIndex.AttributeValues, + .ControlName = oIndex.ControlName + }) + Next + + Return oAttributes + End Function + + Private Function ApplyAutomaticeAttributes(pManualAttributes As List(Of UserAttributeValue)) As List(Of UserAttributeValue) + Logger.Debug("Start of Method [ApplyAutomaticeAttributes]") + + Return pManualAttributes + End Function + + Private Function GetPostprocessingValue(pValues As List(Of String), pRow As DataRow) + Logger.Debug("Start of Method [GetPostprocessingValue]") + + Dim oType = pRow.Item("TYPE") + Dim oResult As New List(Of String) + + Logger.Debug("Type of Postprocessing is [{0}]", oType) + + Select Case oType + Case TYPE_VBREPLACE + Dim oFindString = pRow.Item("TEXT1") + Dim oReplaceString = pRow.Item("TEXT2") + + Logger.Debug("Replacing [{0}] with [{1}]", oFindString, oReplaceString) + + For Each oIndexValue In pValues + Dim oReplaceResult = oIndexValue.Replace(oFindString, oReplaceString) + If oReplaceResult.Equals(oIndexValue) Then + Logger.Debug("Replace did not succeed, ReplaceString was not found.") + Else + Logger.Debug("Replace successful for [{0}].", oIndexValue) + End If + + oResult.Add(oReplaceResult) + Next + + Case TYPE_VBSPLIT + Dim oSeparator As String = pRow.Item("TEXT1") + Dim oSplitIndex As Integer = 0 + Integer.TryParse(pRow.Item("TEXT2"), oSplitIndex) + + Logger.Debug("Splitting String at Separator [{0}] and Index [{1}]", oSeparator, oSplitIndex) + + For Each oIndexValue In pValues + Dim oSplitted As List(Of String) = oIndexValue.Split(oSeparator).ToList() + Logger.Debug("Split succeeded, resulting list has [{0}] items.", oSplitted.Count) + + If oSplitIndex < oSplitted.Count Then + Dim oValue = oSplitted.Item(oSplitIndex) + Logger.Debug("Saving value [{0}] from Index [{1}]", oValue, oSplitIndex) + oResult.Add(oValue) + Else + Logger.Debug("SplitIndex(TEXT2) was out of array bounds. Skipping.") + End If + + Next + + Case Else + LogAndThrow($"Postprocessing type [{oType}] is not supported!") + End Select + + Return oResult + End Function + + Private Sub LoadIndexes(pProfileId As Integer) + Logger.Debug("Start of Method [LoadIndexes]") + + LoadManualIndexes(pProfileId) + LoadAutomaticIndexes(pProfileId) + LoadPostProcessingSteps() + End Sub + + Private Sub LoadAutomaticIndexes(pProfileId As Integer) + Logger.Debug("Start of Method [LoadAutomaticIndexes]") + + Try + ' Load automatic Indexes for this Import + Dim oAutomaticIndexes = GetDatatable.Run( + New GetDatatableFromCacheRequest With { + .DataTable = VIEW_INDEX_MANUAL, + .FilterExpression = $"DOK_ID = {pProfileId}" + }) + + If oAutomaticIndexes.OK = False Then + LogAndThrow(oAutomaticIndexes.ErrorMessage) + End If + + AutomaticIndexes = oAutomaticIndexes.Table + Catch ex As Exception + LogAndThrow(ex, "Error while automatic loading indexes!") + End Try + End Sub + + Private Sub LoadManualIndexes(pProfileId As Integer) + 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 + + ManualIndexes = oManualIndexes.Table + + Catch ex As Exception + LogAndThrow(ex, "Error while loading indexes!") + End Try + End Sub + + Private Sub LoadPostProcessingSteps() + Logger.Debug("Start of Method [LoadPostProcessingSteps]") + + Try + ' Generate a string containing all index ids joined into a string + Dim oIndexIdList As New List(Of Integer) + For Each oRow As DataRow In ManualIndexes.Rows + oIndexIdList.Add(oRow.ItemEx(Of Integer)("GUID")) + Next + Dim oIndexIds As String = String.Join(",", oIndexIdList) + + ' 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 + + ManualIndexesPostProcessing = oPostProcessingSteps.Table + Catch ex As Exception + LogAndThrow(ex, "Error while loading post processing steps!") + End Try + End Sub + End Class + +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb new file mode 100644 index 00000000..34ede782 --- /dev/null +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileRequest.vb @@ -0,0 +1,36 @@ +Imports System.Runtime.Serialization + +Namespace Methods.GlobalIndexer.ImportFile + + + Public Class ImportFileRequest + ''' + ''' Important File properties like, Name, Contents, CreatedAt, ModifiedAt, Checksum + ''' + + Public Property File As FileProperties + + ''' + ''' The ProfileId the file will be imported with + ''' + Public Property ProfileId As Integer + + ''' + ''' The attribute values given by the user in the form of + ''' Attribute Name/Attribute Value/ControlName + ''' + Public Property AttributeValues As List(Of UserAttributeValue) + + ''' + ''' The name of the user importing the file, ex. JenneJ + ''' + + Public Property Who As String + + ''' + ''' The language of the user, ex. de-DE + ''' + + Public Property Language As String + End Class +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileResponse.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileResponse.vb new file mode 100644 index 00000000..6f62fc57 --- /dev/null +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileResponse.vb @@ -0,0 +1,22 @@ +Imports System.Runtime.Serialization + +Namespace Methods.GlobalIndexer.ImportFile + + + Public Class ImportFileResponse + Inherits Messages.BaseResponse + + + Public Property ObjectId As Long + + Public Sub New(pObjectId As Long) + MyBase.New() + ObjectId = pObjectId + End Sub + + Public Sub New(pException As Exception, Optional pDetails As String = "") + MyBase.New(pException, pDetails) + End Sub + End Class + +End Namespace diff --git a/Service.EDMIService/Filestorage/NewFile/NewFileMethod.vb b/Service.EDMIService/Methods/NewFile/NewFileMethod.vb similarity index 92% rename from Service.EDMIService/Filestorage/NewFile/NewFileMethod.vb rename to Service.EDMIService/Methods/NewFile/NewFileMethod.vb index 4268f33b..f08b822d 100644 --- a/Service.EDMIService/Filestorage/NewFile/NewFileMethod.vb +++ b/Service.EDMIService/Methods/NewFile/NewFileMethod.vb @@ -2,7 +2,7 @@ Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database.MSSQLServer.TransactionMode Imports DigitalData.Modules.Logging -Imports DigitalData.Services.EDMIService.FileStorage +Imports DigitalData.Services.EDMIService.Methods Imports DigitalData.Services.EDMIService.GlobalState Public Class NewFileMethod @@ -23,7 +23,7 @@ Public Class NewFileMethod Public Function Run(pData As NewFile.NewFileRequest) As NewFile.NewFileResponse Dim oFilePath As String = Nothing - Dim oExistingObjectId = TestFileChecksumExists(pData.FileChecksum) + Dim oExistingObjectId = TestFileChecksumExists(pData.File.FileChecksum) If oExistingObjectId > 0 Then Return New NewFile.NewFileResponse(oExistingObjectId) End If @@ -51,10 +51,10 @@ Public Class NewFileMethod ' Get directory by DateImported or, if not supplied, by current date Dim oSubDirectory As String - If IsNothing(pData.FileImportedAt) Then + If IsNothing(pData.File.FileImportedAt) Then oSubDirectory = GetDateSubDirectory(Now) Else - oSubDirectory = GetDateSubDirectory(pData.FileImportedAt) + oSubDirectory = GetDateSubDirectory(pData.File.FileImportedAt) End If Logger.Debug("Subdirectory is [{0}]", oSubDirectory) @@ -78,25 +78,25 @@ Public Class NewFileMethod oKeepFileName = True End If - Dim oFileName As String = GetFileObjectFileName(oObjectId, pData.FileName, oKeepFileName) + Dim oFileName As String = GetFileObjectFileName(oObjectId, pData.File.FileName, oKeepFileName) Logger.Debug("Filename is [{0}]", oFileName) oFilePath = IO.Path.Combine(oFinalPath, oFileName) Dim oFileObjectInfo As IO.FileInfo = New IO.FileInfo(oFilePath) - Dim oFileObjectSize As Long = pData.FileContents.Length + Dim oFileObjectSize As Long = pData.File.FileContents.Length Dim oFileObjectExtension As String = oFileObjectInfo.Extension.Substring(1) Dim oFileObjectName As String = oFileObjectInfo.Name Logger.Debug("File Information for [{0}]:", oFileObjectName) Logger.Debug("Size: [{0}]", oFileObjectSize) Logger.Debug("Extension: [{0}]", oFileObjectExtension) - Logger.Debug("Checksum: [{0}]", pData.FileChecksum) + Logger.Debug("Checksum: [{0}]", pData.File.FileChecksum) Try Using oStream = New IO.FileStream(oFilePath, IO.FileMode.Create, IO.FileAccess.Write) Logger.Info("Saving file to path [{0}]", oFilePath) - oStream.Write(pData.FileContents, 0, oFileObjectSize) + oStream.Write(pData.File.FileContents, 0, oFileObjectSize) oStream.Flush(True) oStream.Close() End Using @@ -109,7 +109,7 @@ Public Class NewFileMethod Logger.Info("Creating IDB FileObject for ObjectId [{0}].", oObjectId) ' Insert into DB - Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{oFinalPath}', '{oFileObjectName}', '{oFileObjectExtension}',{oFileObjectSize},'{pData.FileChecksum}' ,'{pData.Who}','{oObjectId}',{oStore.Id}" + Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{oFinalPath}', '{oFileObjectName}', '{oFileObjectExtension}',{oFileObjectSize},'{pData.File.FileChecksum}' ,'{pData.Who}','{oObjectId}',{oStore.Id}" Dim oResult As Boolean = Database.ExecuteNonQueryWithConnectionObject(oSQL, Connection, ExternalTransaction, Transaction) If oResult = False Then @@ -121,9 +121,9 @@ Public Class NewFileMethod 'TODO: File dates in try catch Dim oDefaultAttributes As New Dictionary(Of String, Object) From { - {"OriginFileName", pData?.FileName}, - {"OriginCreationDatetime", pData?.FileCreatedAt}, - {"OriginChangedDatetime", pData?.FileChangedAt} + {"OriginFileName", pData.File.FileName}, + {"OriginCreationDatetime", pData.File.FileCreatedAt}, + {"OriginChangedDatetime", pData.File.FileChangedAt} } For Each oAttribute As KeyValuePair(Of String, Object) In oDefaultAttributes diff --git a/Service.EDMIService/Methods/NewFile/NewFileRequest.vb b/Service.EDMIService/Methods/NewFile/NewFileRequest.vb new file mode 100644 index 00000000..27fd1bb3 --- /dev/null +++ b/Service.EDMIService/Methods/NewFile/NewFileRequest.vb @@ -0,0 +1,43 @@ +Imports System.Runtime.Serialization + +Namespace Methods.NewFile + + + Public Class NewFileRequest + + Public Property File As FileProperties + + ''' + ''' Name/title of the ObjectStore to save the file to, ex. Work + ''' + + Public Property StoreName As String + + ''' + ''' The business entity of the file, ex DEFAULT + ''' + + Public Property BusinessEntity As String + + ''' + ''' The kind of object to be created, ex. DOC + ''' + + Public Property KindType As String + + ''' + ''' The name of the user importing the file, ex. JenneJ + ''' + + Public Property Who As String + + ''' + ''' The language of the user + ''' + ''' + + Public Property Language As String + End Class + +End Namespace + diff --git a/Service.EDMIService/Filestorage/NewFile/NewFileResponse.vb b/Service.EDMIService/Methods/NewFile/NewFileResponse.vb similarity index 92% rename from Service.EDMIService/Filestorage/NewFile/NewFileResponse.vb rename to Service.EDMIService/Methods/NewFile/NewFileResponse.vb index 2302d40f..6537e477 100644 --- a/Service.EDMIService/Filestorage/NewFile/NewFileResponse.vb +++ b/Service.EDMIService/Methods/NewFile/NewFileResponse.vb @@ -1,6 +1,6 @@ Imports System.Runtime.Serialization -Namespace FileStorage.SetAttributeValue +Namespace Methods.SetAttributeValue Public Class SetAttributeValueResponse diff --git a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueMethod.vb b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb similarity index 96% rename from Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueMethod.vb rename to Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb index c38d8ef0..b9c17373 100644 --- a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueMethod.vb +++ b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueMethod.vb @@ -3,7 +3,7 @@ Imports DigitalData.Modules.Database Imports DigitalData.Services.EDMIService.IDB Imports System.Data.SqlClient -Namespace FileStorage.SetAttributeValue +Namespace Methods.SetAttributeValue Public Class SetAttributeValueMethod Inherits BaseMethod diff --git a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueRequest.vb b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueRequest.vb similarity index 93% rename from Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueRequest.vb rename to Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueRequest.vb index 353c8171..413987ed 100644 --- a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueRequest.vb +++ b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueRequest.vb @@ -1,6 +1,6 @@ Imports System.Runtime.Serialization -Namespace FileStorage.SetAttributeValue +Namespace Methods.SetAttributeValue Public Class SetAttributeValueRequest diff --git a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueResponse.vb b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueResponse.vb similarity index 94% rename from Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueResponse.vb rename to Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueResponse.vb index 26d1e11f..a8633736 100644 --- a/Service.EDMIService/Filestorage/SetAttributeValue/SetAttributeValueResponse.vb +++ b/Service.EDMIService/Methods/SetAttributeValue/SetAttributeValueResponse.vb @@ -1,6 +1,6 @@ Imports System.Runtime.Serialization -Namespace FileStorage.NewFile +Namespace Methods.NewFile Public Class NewFileResponse diff --git a/Service.EDMIService/Methods/UserAttributeValue.vb b/Service.EDMIService/Methods/UserAttributeValue.vb new file mode 100644 index 00000000..2d385c83 --- /dev/null +++ b/Service.EDMIService/Methods/UserAttributeValue.vb @@ -0,0 +1,10 @@ +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 + End Class + +End Namespace \ No newline at end of file diff --git a/Service.EDMIService/SettingsModule.vb b/Service.EDMIService/SettingsModule.vb index 2e7ba8be..01f1f3a3 100644 --- a/Service.EDMIService/SettingsModule.vb +++ b/Service.EDMIService/SettingsModule.vb @@ -1,4 +1,5 @@ Module SettingsModule Public Const SERVICE_NAME As String = "DDEDMIService" Public Const SERVICE_DISPLAY_NAME As String = "Digital Data EDMI Service" + Public Const SERVICE_BASE_ADDRESS As String = "net.tcp://localhost:9000/DigitalData/Services/Main" End Module diff --git a/Service.EDMIService/WindowsService.vb b/Service.EDMIService/WindowsService.vb index 3ff995f8..b7d000d9 100644 --- a/Service.EDMIService/WindowsService.vb +++ b/Service.EDMIService/WindowsService.vb @@ -92,7 +92,7 @@ Public Class WindowsService _Logger.Debug("Starting WCF ServiceHost") - Dim oBaseAddresses() As Uri = {New Uri("net.tcp://localhost:9000/DigitalData/Services/Main")} + Dim oBaseAddresses() As Uri = {New Uri(SERVICE_BASE_ADDRESS)} _ServiceHost = New ServiceHost(Of EDMIService)(oBaseAddresses) _ServiceHost.EnableMetadataExchange(False)