diff --git a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueMethod.vb b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueMethod.vb index 530d61a0..53ccc815 100644 --- a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueMethod.vb +++ b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueMethod.vb @@ -1,6 +1,5 @@ Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging -Imports DigitalData.Services.EDMIService.Methods.IDB.GetAttributeValue Namespace Methods.IDB.GetAttributeValue Public Class GetAttributeValueMethod @@ -16,15 +15,28 @@ Namespace Methods.IDB.GetAttributeValue LogAndThrow("ObjectId does not exist!") End If - Dim oValue As Object - ' TODO: Implement GetAttributeValue + Dim oSQL As String = $"SELECT TERM_VALUE FROM FNIDB_GET_VARIABLE_VALUE ({pData.ObjectId}, '{pData.AttributeName}', '{pData.User.Language}')" + Dim oTable As DataTable = DatabaseIDB.GetDatatable(oSQL) + + If oTable Is Nothing Then + Throw New ApplicationException($"Error while getting value for Attribute '{pData.AttributeName}'!") + End If + + If oTable.Rows.Count = 0 Then + Throw New KeyNotFoundException($"Attribute '{pData.AttributeName}' is empty!") + End If + + Dim oRow As DataRow = oTable.Rows.Item(0) + Dim oValue As Object = oRow.Item("TERM_VALUE") Return New GetAttributeValueResponse(pData.ObjectId, oValue) + Catch ex As Exception Logger.Warn("Error occurred while getting attribute value!") + Logger.Error(ex) Return New GetAttributeValueResponse(ex) + End Try End Function End Class - End Namespace \ No newline at end of file diff --git a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueRequest.vb b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueRequest.vb index 3147a73b..76e0a99f 100644 --- a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueRequest.vb +++ b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueRequest.vb @@ -1,5 +1,19 @@ -Namespace Methods.IDB.GetAttributeValue +Imports System.Runtime.Serialization +Imports DigitalData.Modules.ZooFlow.State + +Namespace Methods.IDB.GetAttributeValue Public Class GetAttributeValueRequest + Public Property ObjectId As Long + + + Public Property AttributeName As String + + ''' + ''' User Importing the file + ''' + ''' + + Public Property User As UserState End Class End Namespace diff --git a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueResponse.vb b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueResponse.vb index 96622a23..d8012737 100644 --- a/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueResponse.vb +++ b/Service.EDMIService/Methods/IDB/GetAttributeValue/GetAttributeValueResponse.vb @@ -9,6 +9,7 @@ Namespace Methods.IDB.GetAttributeValue Public Property ObjectId As Long + Public Property Value As Object Public Sub New(pObjectId As Long, pValue As Object)