MONSTER: Rename Monorepo to Modules, only keep Projects under Modules.*

This commit is contained in:
Jonathan Jenne
2022-09-29 13:46:00 +02:00
parent e87b97bfec
commit 042bbce9f4
1557 changed files with 380 additions and 160017 deletions

View File

@@ -0,0 +1,21 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules
Public Class BaseMethod
Friend ReadOnly LogConfig As LogConfig
Friend ReadOnly Logger As Logger
Friend ReadOnly Channel As IEDMIServiceChannel
Friend ReadOnly FileEx As Filesystem.File
Friend ReadOnly Helpers As Helpers
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
LogConfig = pLogConfig
Logger = pLogConfig.GetLogger()
Channel = pChannel
FileEx = New Filesystem.File(pLogConfig)
Helpers = New Helpers(pLogConfig)
End Sub
End Class
End Namespace

View File

@@ -0,0 +1,61 @@
Imports System.IO
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules.Globix
Public Class ImportFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pFilePath As String,
pProfileId As Integer,
pAttributeValues As List(Of UserAttributeValue),
pObjectStoreName As String,
pObjectKind As String,
pIDBDoctypeId As Long,
pImportOptions As Options.ImportFileOptions) As Task(Of Globix_ImportFileResponse)
Try
' Set default options
If pImportOptions Is Nothing Then
pImportOptions = New Options.ImportFileOptions()
End If
' Check if file exists
If File.Exists(pFilePath) = False Then
Throw New FileNotFoundException("Path does not exist")
End If
' Try to load file properties
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, pImportOptions.DateImported)
If oFileProperties Is Nothing Then
Throw New IOException("File could not be read!")
End If
' Importing the file now
Dim oFileImportResponse = Await Channel.Globix_ImportFileAsync(New Globix_ImportFileRequest With {
.IDBDoctypeId = pIDBDoctypeId,
.File = oFileProperties,
.KindType = pObjectKind,
.StoreName = pObjectStoreName,
.User = New UserState() With {
.UserName = pImportOptions.Username,
.Language = pImportOptions.Language
},
.ProfileId = pProfileId,
.AttributeValues = pAttributeValues.ToArray
})
Return oFileImportResponse
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,34 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class CheckInFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pObjectId As Long, Optional pOptions As Options.CheckOutInOptions = Nothing) As Task(Of Long)
' Set default options
If pOptions Is Nothing Then
pOptions = New Options.CheckOutInOptions()
End If
Dim oCheckInFileResponse = Await Channel.CheckInOutFileAsync(New CheckInOutFileRequest With {
.User = New UserState With {
.Language = pOptions.Language,
.UserName = pOptions.Username
},
.Action = CheckInOutFileAction.CheckIn,
.ObjectId = pObjectId
})
If oCheckInFileResponse.OK = False Then
Throw New ApplicationException(oCheckInFileResponse.ErrorMessage)
End If
Return oCheckInFileResponse.ObjectId
End Function
End Class
End Namespace

View File

@@ -0,0 +1,37 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class CheckOutFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pObjectId As Long, Optional pComment As String = "", Optional pOptions As Options.CheckOutInOptions = Nothing) As Task(Of Long)
' Set default options
If pOptions Is Nothing Then
pOptions = New Options.CheckOutInOptions()
End If
Dim oArgs = New CheckInOutFileRequest With {
.User = New UserState With {
.Language = pOptions.Language,
.UserName = pOptions.Username
},
.Action = CheckInOutFileAction.CheckOut,
.Comment = pComment,
.ObjectId = pObjectId
}
Dim oCheckOutFileResponse = Await Channel.CheckInOutFileAsync(oArgs)
If oCheckOutFileResponse.OK = False Then
Throw New ApplicationException(oCheckOutFileResponse.ErrorMessage)
End If
Return oCheckOutFileResponse.ObjectId
End Function
End Class
End Namespace

View File

@@ -0,0 +1,60 @@
Imports System.IO
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class ImportFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pFilePath As String,
pAttributeValues As List(Of UserAttributeValue),
pObjectStoreName As String,
pObjectKind As String,
pIDBDoctypeId As Long,
pImportOptions As Options.ImportFileOptions) As Task(Of ImportFileResponse)
Try
' Set default options
If pImportOptions Is Nothing Then
pImportOptions = New Options.ImportFileOptions()
End If
' Check if file exists
If File.Exists(pFilePath) = False Then
Throw New FileNotFoundException("Path does not exist")
End If
' Try to load file properties
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, pImportOptions.DateImported)
If oFileProperties Is Nothing Then
Throw New IOException("File could not be read!")
End If
' Importing the file now
Dim oFileImportResponse = Await Channel.ImportFileAsync(New ImportFileRequest With {
.IDBDoctypeId = pIDBDoctypeId,
.File = oFileProperties,
.KindType = pObjectKind,
.StoreName = pObjectStoreName,
.User = New UserState() With {
.UserName = pImportOptions.Username,
.Language = pImportOptions.Language
},
.ProfileId = -1,
.AttributeValues = pAttributeValues.ToArray
})
Return oFileImportResponse
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,49 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Filesystem
Namespace Modules.IDB
Public Class NewFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pFilePath As String, pObjectStoreName As String, pObjectKind As String, pIDBDoctypeId As Long, Optional pOptions As Options.NewFileOptions = Nothing) As Task(Of Long)
Try
' Set default options
If pOptions Is Nothing Then
pOptions = New Options.NewFileOptions()
End If
' Check if file exists
If IO.File.Exists(pFilePath) = False Then
Throw New IO.FileNotFoundException("Path does not exist")
End If
' Importing the file now
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, pOptions.DateImported)
Dim oFileImportResponse = Await Channel.NewFileAsync(New NewFileRequest With {
.IDBDoctypeId = pIDBDoctypeId,
.File = oFileProperties,
.KindType = pObjectKind,
.StoreName = pObjectStoreName,
.User = New UserState With {
.Language = pOptions.Language,
.UserName = pOptions.Username
}
})
If oFileImportResponse.OK = False Then
Throw New ApplicationException("Could not Import File Contents!")
End If
Return oFileImportResponse.ObjectId
Catch ex As Exception
Logger.Error(ex)
Return Constants.INVALID_OBEJCT_ID
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,38 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.EDMI.API.Options
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class SetAttributeValue
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pObjectId As String, pAttributeName As String, pAttributeValue As Object, Optional pOptions As SetAttributeValueOptions = Nothing) As Task(Of Boolean)
Try
Dim oParams As New SetAttributeValueRequest With {
.ObjectId = pObjectId,
.Language = pOptions.Language,
.Who = pOptions.Username,
.AttributeName = pAttributeName,
.AttributeValue = pAttributeValue
}
Dim oResponse As SetAttributeValueResponse = Await Channel.SetAttributeValueAsync(oParams)
If oResponse.OK Then
Return True
End If
Logger.Warn("Error while setting Attribute Value: [{0}]", oResponse.ErrorMessage)
Return False
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,34 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.EDMI.API.Options
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class SetObjectState
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pObjectId As String, pState As String, Optional pOptions As SetObjectStateOptions = Nothing) As Task(Of Boolean)
Try
Dim oSql As String = $"EXEC PRIDB_OBJECT_SET_STATE {pObjectId}, '{pState}', '{pOptions.Username}'"
Dim oResult = Await Channel.ExecuteNonQuery_MSSQL_IDBAsync(oSql)
If oResult.OK Then
Return True
End If
Logger.Warn("Error while setting Object State: [{0}]", oResult.ErrorMessage)
Return False
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,53 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.EDMI.API.Options
Imports DigitalData.Modules.Logging
Namespace Modules.IDB
Public Class UpdateFile
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pFilePath As String, pObjectId As Long, Optional pOptions As UpdateFileOptions = Nothing) As Task(Of Long)
Try
' Set default options
If pOptions Is Nothing Then
pOptions = New UpdateFileOptions()
End If
' Check if file exists
If IO.File.Exists(pFilePath) = False Then
Throw New IO.FileNotFoundException("Path does not exist")
End If
' Importing the file now
Dim oFileProperties = Helpers.GetFileProperties(pFilePath, Date.Now)
Dim oUpdateFileResponse = Await Channel.UpdateFileAsync(New UpdateFileRequest With {
.File = oFileProperties,
.ObjectId = pObjectId,
.CreateNewVersion = pOptions.CreateNewFileVersion,
.User = New UserState With {
.Language = pOptions.Language,
.UserName = pOptions.Username
}
})
If oUpdateFileResponse.OK = False Then
Throw New ApplicationException("Could not Import File Contents!")
End If
Return oUpdateFileResponse.ObjectId
Catch ex As Exception
Logger.Error(ex)
Return Constants.INVALID_OBEJCT_ID
End Try
End Function
End Class
End Namespace

View File

@@ -0,0 +1,48 @@
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Namespace Modules.Zooflow
Public Class GetFileObject
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
MyBase.New(pLogConfig, pChannel)
End Sub
Public Async Function RunAsync(pObjectId As Long, pLoadFileContents As Boolean) As Task(Of FileObject)
Try
Dim oParams = New GetFileObjectRequest With {
.ObjectId = pObjectId,
.LoadFileContents = pLoadFileContents
}
Dim oResult = Await Channel.GetFileObjectAsync(oParams)
If oResult.OK Then
Return oResult.FileObject
Else
Return Nothing
End If
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function Run(pObjectId As Long, pLoadFileContents As Boolean) As FileObject
Try
Dim oParams = New GetFileObjectRequest With {
.ObjectId = pObjectId,
.LoadFileContents = pLoadFileContents
}
Dim oResult = Channel.GetFileObject(oParams)
If oResult.OK Then
Return oResult.FileObject
Else
Return Nothing
End If
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class
End Namespace