EDMI: Update Service, Add TestObjectIdExists, Work on GetVariableValue

This commit is contained in:
Jonathan Jenne 2021-07-05 16:31:22 +02:00
parent bd6fa93a45
commit 3ef80383ea
12 changed files with 405 additions and 238 deletions

View File

@ -10,11 +10,12 @@ Public Class Client
Private Const INVALID_OBEJCT_ID As Long = 0
Private Const KIND_TYPE_DOC = "DOC"
Public Const DEFAULT_SERVICE_PORT = 9000
Private ReadOnly _logger As Logger
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
Private ReadOnly _IPAddressServer As String
Private _dummy_table_attributes As DataTable
Private _channel As IEDMIServiceChannel
Public Class StreamedFile
@ -107,8 +108,6 @@ Public Class Client
End Try
End Function
''' <summary>
''' TODO: Creates a new object
''' </summary>
@ -140,10 +139,12 @@ Public Class Client
''' <returns>The ObjectId of the newly generated filesystem object</returns>
Public Async Function NewFileAsync(pFilePath As String, pAddedWho As String, pAddedWhen As Date, pObjectStoreType As String, pBusinessEntity As String, Optional pImportOptions As NewFileOptions = Nothing) As Task(Of Long)
Try
' Set default options
If pImportOptions Is Nothing Then
pImportOptions = New NewFileOptions()
End If
' Check if file exists
If File.Exists(pFilePath) = False Then
Throw New FileNotFoundException("ImportFileAsync: Path does not exist")
End If
@ -151,6 +152,7 @@ Public Class Client
Dim oFileInfo As New FileInfo(pFilePath)
Dim oExtension As String = oFileInfo.Extension
' Creating new ObjectId
Dim oObjectIdResponse = Await _channel.NewObjectIdAsync(New NewObjectIdRequest With {
.BusinessEntity = pBusinessEntity,
.KindType = KIND_TYPE_DOC,
@ -161,6 +163,7 @@ Public Class Client
Throw New ApplicationException("ImportFileAsync: Could not get ObjectId")
End If
' Create new FileObject for ObjectId
Dim oFilePathResponse = Await _channel.NewFileObjectAsync(New NewFileObjectRequest With {
.DateImported = pAddedWhen,
.Extension = oExtension,
@ -173,6 +176,7 @@ Public Class Client
Throw New ApplicationException("ImportFileAsync: Could not get FileObject Path")
End If
' Importing the file now
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
Using oMemoryStream As New MemoryStream()
oFileStream.CopyTo(oMemoryStream)
@ -208,13 +212,15 @@ Public Class Client
''' <summary>
''' Sets a value to an attribute
''' </summary>
''' <param name="pAttributeName"></param>
''' <param name="pAttributeType"></param>
''' <param name="pObjectId">IDB ObjectId</param>
''' <param name="pAttributeName">Name of the attribute</param>
''' <param name="pAttributeType">The type of Attribute</param>
''' <param name="pValue"></param>
''' <param name="pOptions"></param>
''' <returns></returns>
Public Function SetVariableValue(pObjectId As Long, pAttributeName As String, pAttributeType As AttributeType, pValue As Object, Optional pOptions As SetVariableValueOptions = Nothing) As Boolean
Try
' Set default options
If pOptions Is Nothing Then
pOptions = New SetVariableValueOptions()
End If
@ -222,68 +228,93 @@ Public Class Client
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
Try
Dim oResponse = _channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
If oResponse.Exists = False Then
Return False
End If
Catch ex As Exception
_logger.Error(ex)
Return False
End Try
' TODO: Check if Attribute exists
Dim oType = pValue.GetType.Name
If oType = GetType(DataTable).Name Then
Dim oDTMyNewValues As DataTable = pValue
Dim oOldAttributeResult As Object
Dim oTypeOldResult As Object
Dim oValueTable As DataTable = pValue
Dim oCurrentValue As Object
Dim oCurrentValueType As String
If pOptions.CheckDeleted = True Then
oOldAttributeResult = GetVariableValue(pAttributeName, pAttributeType)
oTypeOldResult = oOldAttributeResult.GetType.Name
If oTypeOldResult = GetType(DataTable).Name Then
Dim oOldValues As DataTable = oOldAttributeResult
If oOldValues.Rows.Count > 1 Then
Dim oOptions As New GetVariableValueOptions With {
.Language = oLanguage,
.Username = oUsername
}
' Get current value
oCurrentValue = GetVariableValue(pObjectId, pAttributeName, pAttributeType, oOptions)
' Get current type
oCurrentValueType = oCurrentValue.GetType.Name
' If current value is datatable
If oCurrentValueType = GetType(DataTable).Name Then
' Convert value to Datatable
Dim oCurrentTable As DataTable = oCurrentValue
If oCurrentTable.Rows.Count > 1 Then
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
For Each oOldValueRow As DataRow In oOldValues.Rows
For Each oRow As DataRow In oCurrentTable.Rows
Dim oExists As Boolean = False
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
Dim oInfo = $"Checking oldValue[{oOldValueRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
If oNewValueRow.Item(1).ToString.ToUpper = oOldValueRow.Item(0).ToString.ToUpper Then
For Each oNewValueRow As DataRow In oValueTable.Rows
Dim oInfo = $"Checking oldValue[{oRow.Item(0)}] vs NewValue [{oNewValueRow.Item(1)}]"
If oNewValueRow.Item(1).ToString.ToUpper = oRow.Item(0).ToString.ToUpper Then
oExists = True
Exit For
End If
Next
If oExists = False Then
Dim oInfo = $"Value [{oOldValueRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
_logger.Debug(oInfo)
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldValueRow.Item(0))
_logger.Debug($"Value [{oRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oRow.Item(0))
End If
Next
End If
Else
If oDTMyNewValues.Rows.Count > 1 Then
If oValueTable.Rows.Count > 1 Then
Dim oExists As Boolean = False
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
Dim oInfo1 = $"Checking oldValue[{oOldAttributeResult}] vs NewValue [{oNewValueRow.Item(1)}]"
If oNewValueRow.Item(1).ToString.ToUpper = oOldAttributeResult.ToString.ToUpper Then
For Each oNewValueRow As DataRow In oValueTable.Rows
_logger.Debug($"Checking oldValue[{oCurrentValue}] vs NewValue [{oNewValueRow.Item(1)}]")
If oNewValueRow.Item(1).ToString.ToUpper = oCurrentValue.ToString.ToUpper Then
oExists = True
Exit For
End If
Next
If oExists = False Then
Dim oInfo = $"Value [{oOldAttributeResult}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!"
_logger.Debug(oInfo)
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
_logger.Debug($"Value [{oCurrentValue}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue)
End If
Else
Dim oInfo = $"Value [{oOldAttributeResult}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!"
_logger.Debug(oInfo)
SetVariableValue(pObjectId, My.Application.Globix.CURRENT_PROFILE_LOG_INDEX, AttributeType.Varchar, oInfo)
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oOldAttributeResult)
_logger.Debug($"Value [{oCurrentValue}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue)
End If
End If
End If
For Each oNewValueRow As DataRow In oDTMyNewValues.Rows
For Each oNewValueRow As DataRow In oValueTable.Rows
Dim oSuccess As Boolean = False
Dim oSQL = $"DECLARE @NEW_OBJ_MD_ID BIGINT
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{oNewValueRow.Item(1)}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
@ -324,21 +355,57 @@ Public Class Client
Dim oLanguage = NotNull(pOptions.Language, GetUserLanguage())
Dim oUsername = NotNull(pOptions.Username, Environment.UserName)
' Check if ObjectId exists
Try
Dim oSingleAttribute As Boolean
Dim oResponse = _channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
If oResponse.Exists = False Then
Return Nothing
End If
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
' Get Attributes and Values from Database
Dim oTable As DataTable
Try
Dim oResult As TableResult = _channel.ReturnDatatable_MSSQL_IDB($"EXEC [PRIDB_GET_VALUE_DT]({pObjectId}, '{oLanguage}')")
If oResult.OK = False Then
Throw New ApplicationException(oResult.ErrorMessage)
End If
If oResult.Table Is Nothing OrElse oResult.Table.Rows.Count = 0 Then
Return Nothing
End If
oTable = oResult.Table
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
' TODO: Check if Attribute exists & REfactor
Try
Dim oVectorAttribute As Boolean = False
Select Case pAttributeType
Case AttributeType.VectorInteger
oSingleAttribute = False
oVectorAttribute = True
Case AttributeType.VectorString
oSingleAttribute = False
oVectorAttribute = True
Case Else
oSingleAttribute = True
oVectorAttribute = False
End Select
Dim oAttributeValue As Object = Nothing
If Not IsNothing(My.Tables.DTIDB_DOC_DATA) Then
If oSingleAttribute = True And My.Tables.DTIDB_DOC_DATA.Rows.Count = 1 And pOptions.FromIDB = False Then
If Not IsNothing(_dummy_table_attributes) Then
If oVectorAttribute = True And _dummy_table_attributes.Rows.Count = 1 And pOptions.FromIDB = False Then
Try
If pAttributeName = "IDBCreatedWhen" Then
pAttributeName = "ADDED_WHEN"
@ -350,7 +417,7 @@ Public Class Client
pAttributeName = "CHANGED_WHO"
End If
oAttributeValue = My.Tables.DTIDB_DOC_DATA.Rows(0).Item(pAttributeName)
oAttributeValue = _dummy_table_attributes.Rows(0).Item(pAttributeName)
Catch ex As Exception
_logger.Debug($"Error getting Attribute from IDB_DT_DOC_DATA: {ex.Message}")
End Try
@ -367,17 +434,18 @@ Public Class Client
Dim oDatatable As TableResult = _channel.ReturnDatatable_MSSQL_IDB(oFNSQL)
If oDatatable.OK = False Then
_logger.Warn(oDatatable.ErrorMessage)
Return Nothing
Throw New ApplicationException(oDatatable.ErrorMessage)
End If
If oDatatable.Table.Rows.Count = 1 Then
oAttributeValue = oDatatable.Table.Rows.Item(0).Item(0)
End If
Return oAttributeValue
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
End Function
@ -397,90 +465,6 @@ Public Class Client
End Try
End Function
'Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
' Try
' Dim oResponse = _channel.NewObjectId(New NewObjectIdRequest With {
' .KindType = pKindType,
' .BusinessEntity = pBusinessEntity,
' .Who = pWho
' })
' Return oResponse.ObjectId
' Catch ex As Exception
' _logger.Error(ex)
' Throw ex
' End Try
'End Function
'Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
' Try
' ' Remove dot in Extension
' If pExtension.StartsWith(".") Then
' pExtension = pExtension.Substring(1)
' End If
' Dim oArgs As New NewFileObjectRequest With {
' .ObjectId = pObjectId,
' .StoreType = pStoreType,
' .DateImported = pDate,
' .Extension = pExtension,
' .KeepExtension = pKeepExtension
' }
' Dim oResponse = _channel.NewFileObject(oArgs)
' Return oResponse.FileObjectPath
' Catch ex As Exception
' _logger.Error(ex)
' Throw ex
' End Try
'End Function
'Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreType As String, pFileObjectPath As String) As Task(Of Boolean)
' Try
' Dim oData As New ImportFileIntoFileObjectRequest() With {
' .Contents = pContent,
' .Who = pWho,
' .FilePath = pFileObjectPath,
' .ObjectId = pObjectId,
' .ObjectStoreType = pObjectStoreType
' }
' Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
' Return oResponse.Result
' Catch ex As Exception
' _logger.Error(ex)
' Return False
' End Try
'End Function
'Public Async Function GetFileByObjectIdAsync(ObjectId As Long) As Task(Of StreamedFile)
' Try
' Dim oData As New DocumentStreamRequest() With {.ObjectId = ObjectId}
' Dim oResponse As DocumentStreamResponse = Await _channel.GetFileByObjectIdAsync(oData)
' Dim oMemoryStream As New MemoryStream()
' oResponse.FileContents.CopyTo(oMemoryStream)
' oMemoryStream.Position = 0
' Return New StreamedFile() With {
' .Stream = oMemoryStream,
' .FileName = oResponse.FileName
' }
' Catch ex As Exception
' _logger.Error(ex)
' Throw ex
' End Try
'End Function
'Public Async Function ListFilesForUserAsync() As Task(Of FileList)
' Try
' Dim oResponse As DocumentListResponse = Await _channel.ListFilesForUserAsync(New ListFilesForUserRequest())
' Return New FileList() With {
' .Datatable = oResponse.Datatable
' }
' Catch ex As Exception
' _logger.Error(ex)
' Throw ex
' End Try
'End Function
Public Function GetDatatableFromIDB(SQL As String) As TableResult
Try
Dim oResponse = _channel.ReturnDatatable_MSSQL_IDB(SQL)

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="TestObjectIdExistsResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.EDMIServiceReference.TestObjectIdExistsResponse, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -178,6 +178,15 @@
<wsdl:message name="IEDMIService_ImportFileIntoFileObject_UnexpectedErrorFaultFault_FaultMessage">
<wsdl:part xmlns:q19="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Exceptions" name="detail" element="q19:UnexpectedErrorFault" />
</wsdl:message>
<wsdl:message name="TestObjectIdExistsRequest">
<wsdl:part name="parameters" element="tns:TestObjectIdExistsRequest" />
</wsdl:message>
<wsdl:message name="TestObjectIdExistsResponse">
<wsdl:part name="parameters" element="tns:TestObjectIdExistsResponse" />
</wsdl:message>
<wsdl:message name="IEDMIService_TestObjectIdExists_UnexpectedErrorFaultFault_FaultMessage">
<wsdl:part xmlns:q20="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Exceptions" name="detail" element="q20:UnexpectedErrorFault" />
</wsdl:message>
<wsdl:portType name="IEDMIService">
<wsdl:operation name="Heartbeat">
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/Heartbeat" message="tns:IEDMIService_Heartbeat_InputMessage" />
@ -270,5 +279,10 @@
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileIntoFileObjectResponse" name="ImportFileIntoFileObjectResponse" message="tns:ImportFileIntoFileObjectResponse" />
<wsdl:fault wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileIntoFileObjectUnexpectedErrorFaultFault" name="UnexpectedErrorFaultFault" message="tns:IEDMIService_ImportFileIntoFileObject_UnexpectedErrorFaultFault_FaultMessage" />
</wsdl:operation>
<wsdl:operation name="TestObjectIdExists">
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExists" name="TestObjectIdExistsRequest" message="tns:TestObjectIdExistsRequest" />
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExistsResponse" name="TestObjectIdExistsResponse" message="tns:TestObjectIdExistsResponse" />
<wsdl:fault wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExistsUnexpectedErrorFaultFault" name="UnexpectedErrorFaultFault" message="tns:IEDMIService_TestObjectIdExists_UnexpectedErrorFaultFault_FaultMessage" />
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>

View File

@ -278,4 +278,20 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TestObjectIdExistsRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ObjectId" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TestObjectIdExistsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="Deleted" type="xs:boolean" />
<xs:element minOccurs="0" name="Exists" type="xs:boolean" />
<xs:element minOccurs="0" name="Inactive" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -475,6 +475,16 @@ Namespace EDMIServiceReference
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileIntoFileObject", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileIntoFileObjectResp"& _
"onse")> _
Function ImportFileIntoFileObjectAsync(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse)
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExists", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExistsResponse"), _
System.ServiceModel.FaultContractAttribute(GetType(EDMIServiceReference.UnexpectedErrorFault), Action:="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExistsUnexpected"& _
"ErrorFaultFault", Name:="UnexpectedErrorFault", [Namespace]:="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService.Exceptio"& _
"ns")> _
Function TestObjectIdExists(ByVal request As EDMIServiceReference.TestObjectIdExistsRequest) As EDMIServiceReference.TestObjectIdExistsResponse
'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Vorgang mehrere Rückgabewerte aufweist.
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExists", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExistsResponse")> _
Function TestObjectIdExistsAsync(ByVal request As EDMIServiceReference.TestObjectIdExistsRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.TestObjectIdExistsResponse)
End Interface
<System.Diagnostics.DebuggerStepThroughAttribute(), _
@ -756,16 +766,16 @@ Namespace EDMIServiceReference
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public Contents() As Byte
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)>
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)> _
Public FilePath As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)>
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)> _
Public ObjectId As Long
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)>
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=3)> _
Public ObjectStoreType As String
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)>
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=4)> _
Public Who As String
Public Sub New()
@ -782,13 +792,13 @@ Namespace EDMIServiceReference
End Sub
End Class
<System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"),
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced),
System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=True)>
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _
System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced), _
System.ServiceModel.MessageContractAttribute(WrapperName:="ImportFileIntoFileObjectResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=true)> _
Partial Public Class ImportFileIntoFileObjectResponse
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)>
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public Result As Boolean
Public Sub New()
@ -801,13 +811,57 @@ Namespace EDMIServiceReference
End Sub
End Class
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")>
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _
System.ServiceModel.MessageContractAttribute(WrapperName:="TestObjectIdExistsRequest", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=true)> _
Partial Public Class TestObjectIdExistsRequest
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public ObjectId As Long
Public Sub New()
MyBase.New
End Sub
Public Sub New(ByVal ObjectId As Long)
MyBase.New
Me.ObjectId = ObjectId
End Sub
End Class
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0"), _
System.ServiceModel.MessageContractAttribute(WrapperName:="TestObjectIdExistsResponse", WrapperNamespace:="http://DigitalData.Services.EDMIService", IsWrapped:=true)> _
Partial Public Class TestObjectIdExistsResponse
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=0)> _
Public Deleted As Boolean
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=1)> _
Public Exists As Boolean
<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://DigitalData.Services.EDMIService", Order:=2)> _
Public Inactive As Boolean
Public Sub New()
MyBase.New
End Sub
Public Sub New(ByVal Deleted As Boolean, ByVal Exists As Boolean, ByVal Inactive As Boolean)
MyBase.New
Me.Deleted = Deleted
Me.Exists = Exists
Me.Inactive = Inactive
End Sub
End Class
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _
Public Interface IEDMIServiceChannel
Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel
End Interface
<System.Diagnostics.DebuggerStepThroughAttribute(),
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")>
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")> _
Partial Public Class EDMIServiceClient
Inherits System.ServiceModel.ClientBase(Of EDMIServiceReference.IEDMIService)
Implements EDMIServiceReference.IEDMIService
@ -920,7 +974,7 @@ Namespace EDMIServiceReference
Return MyBase.Channel.ExecuteNonQuery_MSSQL_ECMAsync(SQL)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ImportFile(ByVal request As EDMIServiceReference.DocumentImportRequest) As EDMIServiceReference.DocumentImportResponse Implements EDMIServiceReference.IEDMIService.ImportFile
Return MyBase.Channel.ImportFile(request)
End Function
@ -932,11 +986,11 @@ Namespace EDMIServiceReference
inValue.FileName = FileName
inValue.ObjectStoreId = ObjectStoreId
inValue.RetentionDays = RetentionDays
Dim retVal As EDMIServiceReference.DocumentImportResponse = CType(Me, EDMIServiceReference.IEDMIService).ImportFile(inValue)
Dim retVal As EDMIServiceReference.DocumentImportResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportFile(inValue)
Return retVal.ObjectId
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ImportFileAsync(ByVal request As EDMIServiceReference.DocumentImportRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportResponse) Implements EDMIServiceReference.IEDMIService.ImportFileAsync
Return MyBase.Channel.ImportFileAsync(request)
End Function
@ -948,10 +1002,10 @@ Namespace EDMIServiceReference
inValue.FileName = FileName
inValue.ObjectStoreId = ObjectStoreId
inValue.RetentionDays = RetentionDays
Return CType(Me, EDMIServiceReference.IEDMIService).ImportFileAsync(inValue)
Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_GetFileByObjectId(ByVal request As EDMIServiceReference.DocumentStreamRequest) As EDMIServiceReference.DocumentStreamResponse Implements EDMIServiceReference.IEDMIService.GetFileByObjectId
Return MyBase.Channel.GetFileByObjectId(request)
End Function
@ -959,12 +1013,12 @@ Namespace EDMIServiceReference
Public Function GetFileByObjectId(ByVal ObjectId As Long, <System.Runtime.InteropServices.OutAttribute()> ByRef FileContents As System.IO.Stream) As String
Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest()
inValue.ObjectId = ObjectId
Dim retVal As EDMIServiceReference.DocumentStreamResponse = CType(Me, EDMIServiceReference.IEDMIService).GetFileByObjectId(inValue)
Dim retVal As EDMIServiceReference.DocumentStreamResponse = CType(Me,EDMIServiceReference.IEDMIService).GetFileByObjectId(inValue)
FileContents = retVal.FileContents
Return retVal.FileName
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_GetFileByObjectIdAsync(ByVal request As EDMIServiceReference.DocumentStreamRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse) Implements EDMIServiceReference.IEDMIService.GetFileByObjectIdAsync
Return MyBase.Channel.GetFileByObjectIdAsync(request)
End Function
@ -972,10 +1026,10 @@ Namespace EDMIServiceReference
Public Function GetFileByObjectIdAsync(ByVal ObjectId As Long) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentStreamResponse)
Dim inValue As EDMIServiceReference.DocumentStreamRequest = New EDMIServiceReference.DocumentStreamRequest()
inValue.ObjectId = ObjectId
Return CType(Me, EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue)
Return CType(Me,EDMIServiceReference.IEDMIService).GetFileByObjectIdAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_GetFileInfoByObjectId(ByVal request As EDMIServiceReference.DocumentInfoRequest) As EDMIServiceReference.DocumentInfoResponse Implements EDMIServiceReference.IEDMIService.GetFileInfoByObjectId
Return MyBase.Channel.GetFileInfoByObjectId(request)
End Function
@ -984,7 +1038,7 @@ Namespace EDMIServiceReference
Dim inValue As EDMIServiceReference.DocumentInfoRequest = New EDMIServiceReference.DocumentInfoRequest()
inValue.ObjectId = ObjectId
inValue.UserId = UserId
Dim retVal As EDMIServiceReference.DocumentInfoResponse = CType(Me, EDMIServiceReference.IEDMIService).GetFileInfoByObjectId(inValue)
Dim retVal As EDMIServiceReference.DocumentInfoResponse = CType(Me,EDMIServiceReference.IEDMIService).GetFileInfoByObjectId(inValue)
FullPath = retVal.FullPath
Return retVal.FileRight
End Function
@ -993,28 +1047,28 @@ Namespace EDMIServiceReference
Return MyBase.Channel.GetFileInfoByObjectIdAsync(request)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ListFilesForUser(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As EDMIServiceReference.DocumentListResponse Implements EDMIServiceReference.IEDMIService.ListFilesForUser
Return MyBase.Channel.ListFilesForUser(request)
End Function
Public Function ListFilesForUser() As System.Data.DataTable
Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
Dim retVal As EDMIServiceReference.DocumentListResponse = CType(Me, EDMIServiceReference.IEDMIService).ListFilesForUser(inValue)
Dim retVal As EDMIServiceReference.DocumentListResponse = CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUser(inValue)
Return retVal.Datatable
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ListFilesForUserAsync(ByVal request As EDMIServiceReference.ListFilesForUserRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse) Implements EDMIServiceReference.IEDMIService.ListFilesForUserAsync
Return MyBase.Channel.ListFilesForUserAsync(request)
End Function
Public Function ListFilesForUserAsync() As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentListResponse)
Dim inValue As EDMIServiceReference.ListFilesForUserRequest = New EDMIServiceReference.ListFilesForUserRequest()
Return CType(Me, EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue)
Return CType(Me,EDMIServiceReference.IEDMIService).ListFilesForUserAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_NewObjectId(ByVal request As EDMIServiceReference.NewObjectIdRequest) As EDMIServiceReference.NewObjectIdResponse Implements EDMIServiceReference.IEDMIService.NewObjectId
Return MyBase.Channel.NewObjectId(request)
End Function
@ -1024,11 +1078,11 @@ Namespace EDMIServiceReference
inValue.BusinessEntity = BusinessEntity
inValue.KindType = KindType
inValue.Who = Who
Dim retVal As EDMIServiceReference.NewObjectIdResponse = CType(Me, EDMIServiceReference.IEDMIService).NewObjectId(inValue)
Dim retVal As EDMIServiceReference.NewObjectIdResponse = CType(Me,EDMIServiceReference.IEDMIService).NewObjectId(inValue)
Return retVal.ObjectId
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_NewObjectIdAsync(ByVal request As EDMIServiceReference.NewObjectIdRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewObjectIdResponse) Implements EDMIServiceReference.IEDMIService.NewObjectIdAsync
Return MyBase.Channel.NewObjectIdAsync(request)
End Function
@ -1038,10 +1092,10 @@ Namespace EDMIServiceReference
inValue.BusinessEntity = BusinessEntity
inValue.KindType = KindType
inValue.Who = Who
Return CType(Me, EDMIServiceReference.IEDMIService).NewObjectIdAsync(inValue)
Return CType(Me,EDMIServiceReference.IEDMIService).NewObjectIdAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_NewFileObject(ByVal request As EDMIServiceReference.NewFileObjectRequest) As EDMIServiceReference.NewFileObjectResponse Implements EDMIServiceReference.IEDMIService.NewFileObject
Return MyBase.Channel.NewFileObject(request)
End Function
@ -1053,11 +1107,11 @@ Namespace EDMIServiceReference
inValue.KeepExtension = KeepExtension
inValue.ObjectId = ObjectId
inValue.StoreType = StoreType
Dim retVal As EDMIServiceReference.NewFileObjectResponse = CType(Me, EDMIServiceReference.IEDMIService).NewFileObject(inValue)
Dim retVal As EDMIServiceReference.NewFileObjectResponse = CType(Me,EDMIServiceReference.IEDMIService).NewFileObject(inValue)
Return retVal.FileObjectPath
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_NewFileObjectAsync(ByVal request As EDMIServiceReference.NewFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.NewFileObjectResponse) Implements EDMIServiceReference.IEDMIService.NewFileObjectAsync
Return MyBase.Channel.NewFileObjectAsync(request)
End Function
@ -1069,10 +1123,10 @@ Namespace EDMIServiceReference
inValue.KeepExtension = KeepExtension
inValue.ObjectId = ObjectId
inValue.StoreType = StoreType
Return CType(Me, EDMIServiceReference.IEDMIService).NewFileObjectAsync(inValue)
Return CType(Me,EDMIServiceReference.IEDMIService).NewFileObjectAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObject(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As EDMIServiceReference.ImportFileIntoFileObjectResponse Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObject
Return MyBase.Channel.ImportFileIntoFileObject(request)
End Function
@ -1084,11 +1138,11 @@ Namespace EDMIServiceReference
inValue.ObjectId = ObjectId
inValue.ObjectStoreType = ObjectStoreType
inValue.Who = Who
Dim retVal As EDMIServiceReference.ImportFileIntoFileObjectResponse = CType(Me, EDMIServiceReference.IEDMIService).ImportFileIntoFileObject(inValue)
Dim retVal As EDMIServiceReference.ImportFileIntoFileObjectResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObject(inValue)
Return retVal.Result
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_ImportFileIntoFileObjectAsync(ByVal request As EDMIServiceReference.ImportFileIntoFileObjectRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.ImportFileIntoFileObjectResponse) Implements EDMIServiceReference.IEDMIService.ImportFileIntoFileObjectAsync
Return MyBase.Channel.ImportFileIntoFileObjectAsync(request)
End Function
@ -1102,5 +1156,23 @@ Namespace EDMIServiceReference
inValue.Who = Who
Return CType(Me,EDMIServiceReference.IEDMIService).ImportFileIntoFileObjectAsync(inValue)
End Function
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Function EDMIServiceReference_IEDMIService_TestObjectIdExists(ByVal request As EDMIServiceReference.TestObjectIdExistsRequest) As EDMIServiceReference.TestObjectIdExistsResponse Implements EDMIServiceReference.IEDMIService.TestObjectIdExists
Return MyBase.Channel.TestObjectIdExists(request)
End Function
Public Function TestObjectIdExists(ByVal ObjectId As Long, <System.Runtime.InteropServices.OutAttribute()> ByRef Exists As Boolean, <System.Runtime.InteropServices.OutAttribute()> ByRef Inactive As Boolean) As Boolean
Dim inValue As EDMIServiceReference.TestObjectIdExistsRequest = New EDMIServiceReference.TestObjectIdExistsRequest()
inValue.ObjectId = ObjectId
Dim retVal As EDMIServiceReference.TestObjectIdExistsResponse = CType(Me,EDMIServiceReference.IEDMIService).TestObjectIdExists(inValue)
Exists = retVal.Exists
Inactive = retVal.Inactive
Return retVal.Deleted
End Function
Public Function TestObjectIdExistsAsync(ByVal request As EDMIServiceReference.TestObjectIdExistsRequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.TestObjectIdExistsResponse) Implements EDMIServiceReference.IEDMIService.TestObjectIdExistsAsync
Return MyBase.Channel.TestObjectIdExistsAsync(request)
End Function
End Class
End Namespace

View File

@ -261,6 +261,18 @@
<soap12:fault use="literal" name="UnexpectedErrorFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="TestObjectIdExists">
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/TestObjectIdExists" style="document" />
<wsdl:input name="TestObjectIdExistsRequest">
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output name="TestObjectIdExistsResponse">
<soap12:body use="literal" />
</wsdl:output>
<wsdl:fault name="UnexpectedErrorFaultFault">
<soap12:fault use="literal" name="UnexpectedErrorFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EDMIService">
<wsdl:port name="NetTcpBinding_IEDMIService" binding="tns:NetTcpBinding_IEDMIService">

View File

@ -1,4 +1,6 @@
Public Class Constants
Public Const DEFAULT_SERVICE_PORT = 9000
Public Enum DatabaseType
ECM
IDB

View File

@ -142,6 +142,9 @@
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.TableResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.EDMIServiceReference.TestObjectIdExistsResponse.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\EDMIServiceReference\DigitalData.Modules.EDMI.API.xsd">
<SubType>Designer</SubType>
</None>

View File

@ -469,6 +469,32 @@ Public Class EDMIService
End Try
End Function
Public Function TestObjectIdExists(Data As TestObjectIdExistsRequest) As TestObjectIdExistsResponse Implements IEDMIService.TestObjectIdExists
Try
Dim oSQL As String = $"SELECT IDB_OBJ_ID, ACTIVE, DELETED FROM TBIDB_OBJECT WHERE IDB_OBJ_ID = {Data.ObjectId}"
Dim oTable As DataTable = MSSQL_IDB.GetDatatable(oSQL)
If IsNothing(oTable) OrElse oTable.Rows.Count = 0 Then
_Logger.Warn("ObjectId {0} does not exist")
Return New TestObjectIdExistsResponse(False)
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oActive = Utils.NotNull(oRow.Item("ACTIVE"), False)
Dim oDeleted = Utils.NotNull(oRow.Item("DELETED"), False)
Return New TestObjectIdExistsResponse(True) With {
.Deleted = oDeleted,
.Inactive = Not oActive
}
Catch ex As Exception
_Logger.Error(ex)
Return New TestObjectIdExistsResponse(False)
End Try
End Function
Public Function NewFileObject(Data As NewFileObjectRequest) As NewFileObjectResponse Implements IEDMIService.NewFileObject
Try
Dim oStoreType As String = Data.StoreType

View File

@ -131,6 +131,28 @@ Namespace Messages
End Class
#End Region
#Region "Helpers"
<MessageContract>
Public Class TestObjectIdExistsRequest
<MessageBodyMember>
Public ObjectId As Long
End Class
<MessageContract>
Public Class TestObjectIdExistsResponse
Public Sub New(pExists As Boolean)
Exists = pExists
End Sub
<MessageBodyMember>
Public Exists As Boolean = False
<MessageBodyMember>
Public Inactive As Boolean = False
<MessageBodyMember>
Public Deleted As Boolean = False
End Class
#End Region
End Namespace

View File

@ -92,4 +92,10 @@ Interface IEDMIService
Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse
#End Region
#Region "Helpers"
<OperationContract>
<FaultContract(GetType(UnexpectedErrorFault))>
Function TestObjectIdExists(Data As TestObjectIdExistsRequest) As TestObjectIdExistsResponse
#End Region
End Interface

View File

@ -38,7 +38,7 @@ Public Class WindowsService
Try
Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"))
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), Nothing, Nothing, Nothing, 3)
_Logger = _LogConfig.GetLogger()
Try