EDMIService: Small tweaks for AppServer
This commit is contained in:
parent
54e93d0f73
commit
2529c30726
@ -106,8 +106,7 @@ Public Class EDMIService
|
|||||||
Return New TableResult(oFilteredTable)
|
Return New TableResult(oFilteredTable)
|
||||||
Else
|
Else
|
||||||
_Logger.Warn($"ReturnDatatableFromCache: Datatable {Name} does not exist")
|
_Logger.Warn($"ReturnDatatableFromCache: Datatable {Name} does not exist")
|
||||||
Dim oDetails As New DataTableDoesNotExistFault(Name)
|
Throw GetFault($"ReturnDatatableFromCache: Datatable {Name} does not exist")
|
||||||
Throw New FaultException(Of DataTableDoesNotExistFault)(oDetails)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As FaultException
|
Catch ex As FaultException
|
||||||
@ -116,8 +115,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -137,8 +135,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -155,8 +152,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -173,8 +169,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -194,8 +189,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -212,8 +206,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -230,8 +223,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -251,8 +243,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -269,8 +260,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -287,8 +277,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -345,8 +334,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -390,8 +378,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -417,10 +404,9 @@ Public Class EDMIService
|
|||||||
Throw ex
|
Throw ex
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
_Logger.Warn("GetFileInfoByObjectId: " & ex.Message)
|
||||||
_Logger.Warn("GetFileInfoByObjectId: " & oDetails.ErrorMessage)
|
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
Throw GetFault(ex)
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -439,8 +425,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -528,8 +513,7 @@ Public Class EDMIService
|
|||||||
Dim oObjectId = MSSQL_IDB.GetScalarValue(oSQL)
|
Dim oObjectId = MSSQL_IDB.GetScalarValue(oSQL)
|
||||||
|
|
||||||
If oObjectId Is Nothing Then
|
If oObjectId Is Nothing Then
|
||||||
Dim oDetails As New UnexpectedErrorFault(New Exception("NewObjectId: Could not create new ObjectId!"))
|
Throw GetFault("NewObjectId: Could not create new ObjectId!")
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return New NewObjectIdResponse With {.ObjectId = oObjectId}
|
Return New NewObjectIdResponse With {.ObjectId = oObjectId}
|
||||||
@ -539,37 +523,50 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewFileObject(Data As NewFileObjectRequest) As NewFileObjectResponse Implements IEDMIService.NewFileObject
|
Public Function NewFileObject(Data As NewFileObjectRequest) As NewFileObjectResponse Implements IEDMIService.NewFileObject
|
||||||
Try
|
Try
|
||||||
Dim oRelpath As String
|
|
||||||
Dim oStoreType As String = Data.StoreType
|
Dim oStoreType As String = Data.StoreType
|
||||||
|
|
||||||
|
_Logger.Debug("DataStore type is [{0}]", oStoreType)
|
||||||
|
|
||||||
If oStoreType = String.Empty Then
|
If oStoreType = String.Empty Then
|
||||||
|
_Logger.Debug("DataStore empty, set to [{0}]", ClassConstants.FileStoreWork)
|
||||||
oStoreType = ClassConstants.FileStoreWork
|
oStoreType = ClassConstants.FileStoreWork
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oRelpath = GetFileStorePraefix(oStoreType)
|
Dim oRelpath As String = GetFileStorePraefix(oStoreType)
|
||||||
|
Dim oSubDirectory As String
|
||||||
|
|
||||||
If IsNothing(Data.DateImported) Then
|
If IsNothing(Data.DateImported) Then
|
||||||
oRelpath = GetFolderToday(oRelpath)
|
oSubDirectory = GetDateSubDirectory(Now)
|
||||||
Else
|
Else
|
||||||
|
oSubDirectory = GetDateSubDirectory(Data.DateImported)
|
||||||
|
End If
|
||||||
|
|
||||||
|
_Logger.Debug("Subdirectory is [{0}]", oSubDirectory)
|
||||||
|
|
||||||
|
oRelpath = Path.Combine(oRelpath, oSubDirectory)
|
||||||
|
|
||||||
|
If Not Directory.Exists(oRelpath) Then
|
||||||
Try
|
Try
|
||||||
Dim oDate = CDate(Data.DateImported)
|
_Logger.Debug("Path does not exist, creating: [{0}]", oRelpath)
|
||||||
oRelpath = GetFolderDate(oRelpath, oDate)
|
Directory.CreateDirectory(oRelpath)
|
||||||
|
_Logger.Debug("Created folder [{0}]", oRelpath)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_Logger.Debug($"oRelpath is [{oRelpath}]")
|
_Logger.Debug("Relative Path is [{0}]", oRelpath)
|
||||||
|
|
||||||
Dim oFileObjectPath As String = Path.Combine(oRelpath, GetFileObjectFileName(Data.ObjectId, Data.Extension, Data.KeepExtension))
|
Dim oFileObjectPath As String = Path.Combine(oRelpath, GetFileObjectFileName(Data.ObjectId, Data.Extension, Data.KeepExtension))
|
||||||
|
_Logger.Debug("Final Path is [{0}]", oFileObjectPath)
|
||||||
|
|
||||||
Return New NewFileObjectResponse With {.FileObjectPath = oFileObjectPath}
|
Return New NewFileObjectResponse With {.FileObjectPath = oFileObjectPath}
|
||||||
Catch ex As FaultException
|
Catch ex As FaultException
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
@ -577,8 +574,7 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -609,63 +605,49 @@ Public Class EDMIService
|
|||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Dim oDetails As New UnexpectedErrorFault(ex)
|
Throw GetFault(ex)
|
||||||
Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage)
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pExtension As String, pKeepExtension As Boolean) As String
|
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pExtension As String, pKeepExtension As Boolean) As String
|
||||||
|
If Not pExtension.StartsWith("."c) Then
|
||||||
|
pExtension &= "."c
|
||||||
|
End If
|
||||||
|
|
||||||
If pKeepExtension Then
|
If pKeepExtension Then
|
||||||
Return $"{IDB_OBJ_ID}.{pExtension}"
|
Return $"{IDB_OBJ_ID}{pExtension}"
|
||||||
Else
|
Else
|
||||||
Return $"{IDB_OBJ_ID}.ddfo"
|
Return $"{IDB_OBJ_ID}.ddfo"
|
||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetFileStorePraefix(pStoreType As String) As String
|
Private Function GetFileStorePraefix(pStoreType As String) As String
|
||||||
Dim oObjectStore
|
Dim oObjectStore
|
||||||
|
|
||||||
If pStoreType = ClassConstants.FileStoreArchive Then
|
If pStoreType = ClassConstants.FileStoreArchive Then
|
||||||
oObjectStore = GlobalState.ObjectStores.Item(0)
|
oObjectStore = GlobalState.ObjectStores.Item(0)
|
||||||
Else ' pStoreType = ClassConstants.FileStoreWork Then
|
Else ' pStoreType = ClassConstants.FileStoreWork Then
|
||||||
oObjectStore = GlobalState.ObjectStores.Item(1)
|
oObjectStore = GlobalState.ObjectStores.Item(1)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_Logger.Debug($"oObjectStore is [{oObjectStore.Path}]")
|
_Logger.Debug($"oObjectStore is [{oObjectStore.Path}]")
|
||||||
Return oObjectStore.Path
|
Return oObjectStore.Path
|
||||||
End Function
|
End Function
|
||||||
Private Function GetFolderToday(pRelationalPath As String) As String
|
|
||||||
Dim oDateSubDirectoryName As String = GetDateSubDirectory(Now)
|
Private Function GetDateSubDirectory(pDate As Date) As String
|
||||||
Dim oFolderToday As String = Path.Combine(pRelationalPath, oDateSubDirectoryName)
|
Return Path.Combine(pDate.ToString("yyyy"), pDate.ToString("MM"), pDate.ToString("dd"))
|
||||||
' Create the destination directory if it does not exist
|
|
||||||
If Not Directory.Exists(oFolderToday) Then
|
|
||||||
Try
|
|
||||||
Directory.CreateDirectory(oFolderToday)
|
|
||||||
_Logger.Debug($"Created NEW todayFolder [{oFolderToday}]")
|
|
||||||
Catch ex As Exception
|
|
||||||
_Logger.Error(ex)
|
|
||||||
Return ""
|
|
||||||
End Try
|
|
||||||
End If
|
|
||||||
Return oFolderToday
|
|
||||||
End Function
|
|
||||||
Private Function GetFolderDate(pRelationalPath As String, pDate As Date) As String
|
|
||||||
Dim oDateSubDirectoryName As String = GetDateSubDirectory(pDate)
|
|
||||||
Dim oFolderDateSepecial As String = Path.Combine(pRelationalPath, oDateSubDirectoryName)
|
|
||||||
' Create the destination directory if it does not exist
|
|
||||||
If Not Directory.Exists(oFolderDateSepecial) Then
|
|
||||||
Try
|
|
||||||
Directory.CreateDirectory(oFolderDateSepecial)
|
|
||||||
_Logger.Debug($"Created NEW DateSpecialFolder [{oFolderDateSepecial}]")
|
|
||||||
Catch ex As Exception
|
|
||||||
_Logger.Error(ex)
|
|
||||||
Return ""
|
|
||||||
End Try
|
|
||||||
End If
|
|
||||||
Return oFolderDateSepecial
|
|
||||||
End Function
|
|
||||||
Private Function GetDateSubDirectory([Date] As Date) As String
|
|
||||||
Return [Date].ToString("yyyy-MM-dd")
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GetFault(Exception As Exception) As FaultException
|
||||||
|
Dim oFault As New UnexpectedErrorFault(Exception)
|
||||||
|
Return New FaultException(Of UnexpectedErrorFault)(oFault, New FaultReason(oFault.InnerException.Message))
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetFault(ErrorMessage As String) As FaultException
|
||||||
|
Dim oFault As New UnexpectedErrorFault(New ApplicationException(ErrorMessage))
|
||||||
|
Return New FaultException(Of UnexpectedErrorFault)(oFault, New FaultReason(oFault.InnerException.Message))
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@ -12,10 +12,6 @@ Namespace Exceptions
|
|||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<DataContract>
|
<DataContract>
|
||||||
Public Class BaseFault
|
Public Class BaseFault
|
||||||
''' <summary>
|
''' <summary>
|
||||||
|
|||||||
@ -22,7 +22,8 @@ Public Class Scheduler
|
|||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, MSSQL_ECM As MSSQLServer, TableStore As DataSet)
|
Public Sub New(LogConfig As LogConfig, MSSQL_ECM As MSSQLServer, TableStore As DataSet)
|
||||||
_LogConfig = LogConfig
|
_LogConfig = LogConfig
|
||||||
_Logger = LogConfig.GetLogger()
|
_Logger = LogConfig.GetLoggerFor("Scheduler")
|
||||||
|
|
||||||
_Factory = New StdSchedulerFactory(_Props)
|
_Factory = New StdSchedulerFactory(_Props)
|
||||||
_MSSQL = MSSQL_ECM
|
_MSSQL = MSSQL_ECM
|
||||||
_JobListener = New JobListener(LogConfig, _MSSQL, TableStore)
|
_JobListener = New JobListener(LogConfig, _MSSQL, TableStore)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user