|
| 1 | +'********************************************************************************** |
| 2 | +'* Copyright (C) 2007,2016 Hitachi Solutions,Ltd. |
| 3 | +'********************************************************************************** |
| 4 | + |
| 5 | +#Region "Apache License" |
| 6 | +' |
| 7 | +' Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +' you may not use this file except in compliance with the License. |
| 9 | +' You may obtain a copy of the License at |
| 10 | +' |
| 11 | +' http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +' |
| 13 | +' Unless required by applicable law or agreed to in writing, software |
| 14 | +' distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +' See the License for the specific language governing permissions and |
| 17 | +' limitations under the License. |
| 18 | +' |
| 19 | +#End Region |
| 20 | + |
| 21 | +'********************************************************************************** |
| 22 | +'* クラス名 :LayerB |
| 23 | +'* クラス日本語名 :LayerB |
| 24 | +'* |
| 25 | +'* 日時 更新者 内容 |
| 26 | +'* ---------- ---------------- ------------------------------------------------- |
| 27 | +'* 11/28/2014 Supragyan Created LayerB class for AsyncProcessing Service |
| 28 | +'* 11/28/2014 Supragyan Created Insert,Update,Select method for AsyncProcessing Service |
| 29 | +'* 04/15/2015 Sandeep Did code modification of insert, update and select for AsyncProcessing Service |
| 30 | +'* 06/09/2015 Sandeep Implemented code to update stop command to all the running asynchronous task |
| 31 | +'* Modified code to reset Exception information, before starting asynchronous task |
| 32 | +'* 06/26/2015 Sandeep Implemented code to get commandID in the SelectTask method, |
| 33 | +'* to resolve unstable "Register" state, when you invoke [Abort] to AsyncTask, at this "Register" state |
| 34 | +'* 06/01/2016 Sandeep Implemented method to test the connection of specified database |
| 35 | +'* 2018/08/24 西野 大介 クラス名称の変更( ---> Aps) |
| 36 | +'********************************************************************************** |
| 37 | + |
| 38 | +Imports System |
| 39 | +Imports System.Data |
| 40 | + |
| 41 | +Imports Touryo.Infrastructure.Business.Business |
| 42 | + |
| 43 | +Namespace Touryo.Infrastructure.Business.AsyncProcessingService |
| 44 | + |
| 45 | + ''' <summary> |
| 46 | + ''' LayerB class for AsyncProcessing Service |
| 47 | + ''' </summary> |
| 48 | + Public Class ApsLayerB |
| 49 | + Inherits MyFcBaseLogic |
| 50 | + #Region "Insert" |
| 51 | + |
| 52 | + ''' <summary> |
| 53 | + ''' Inserts Async Parameter values to Database through LayerD |
| 54 | + ''' </summary> |
| 55 | + ''' <param name="parameterValue"></param> |
| 56 | + Public Sub UOC_InsertTask(parameterValue As ApsParameterValue) |
| 57 | + ' 戻り値クラスを生成して、事前に戻り値に設定しておく。 |
| 58 | + Dim returnValue As New ApsReturnValue() |
| 59 | + Me.ReturnValue = returnValue |
| 60 | + |
| 61 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 62 | + layerD.InsertTask(parameterValue, returnValue) |
| 63 | + End Sub |
| 64 | + |
| 65 | + #End Region |
| 66 | + |
| 67 | + #Region "Update" |
| 68 | + |
| 69 | + #Region "UpdateTaskStart" |
| 70 | + |
| 71 | + ''' <summary> |
| 72 | + ''' Updates information in the database that the asynchronous task is started |
| 73 | + ''' </summary> |
| 74 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 75 | + Private Sub UOC_UpdateTaskStart(parameterValue As ApsParameterValue) |
| 76 | + Dim returnValue As New ApsReturnValue() |
| 77 | + Me.ReturnValue = returnValue |
| 78 | + |
| 79 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 80 | + layerD.UpdateTaskStart(parameterValue, returnValue) |
| 81 | + End Sub |
| 82 | + |
| 83 | + #End Region |
| 84 | + |
| 85 | + #Region "UpdateTaskRetry" |
| 86 | + |
| 87 | + ''' <summary> |
| 88 | + ''' Updates information in the database that the asynchronous task is failed and can be retried later |
| 89 | + ''' </summary> |
| 90 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 91 | + Private Sub UOC_UpdateTaskRetry(parameterValue As ApsParameterValue) |
| 92 | + Dim returnValue As New ApsReturnValue() |
| 93 | + Me.ReturnValue = returnValue |
| 94 | + |
| 95 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 96 | + layerD.UpdateTaskRetry(parameterValue, returnValue) |
| 97 | + End Sub |
| 98 | + |
| 99 | + #End Region |
| 100 | + |
| 101 | + #Region "UpdateTaskFail" |
| 102 | + |
| 103 | + ''' <summary> |
| 104 | + ''' Updates information in the database that the asynchronous task is failed and abort this task [status=Abort] |
| 105 | + ''' </summary> |
| 106 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 107 | + Private Sub UOC_UpdateTaskFail(parameterValue As ApsParameterValue) |
| 108 | + Dim returnValue As New ApsReturnValue() |
| 109 | + Me.ReturnValue = returnValue |
| 110 | + |
| 111 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 112 | + layerD.UpdateTaskFail(parameterValue, returnValue) |
| 113 | + End Sub |
| 114 | + |
| 115 | + #End Region |
| 116 | + |
| 117 | + #Region "UpdateTaskSuccess" |
| 118 | + |
| 119 | + ''' <summary> |
| 120 | + ''' Updates information in the database that the asynchronous task is completed |
| 121 | + ''' </summary> |
| 122 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 123 | + Private Sub UOC_UpdateTaskSuccess(parameterValue As ApsParameterValue) |
| 124 | + Dim returnValue As New ApsReturnValue() |
| 125 | + Me.ReturnValue = returnValue |
| 126 | + |
| 127 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 128 | + layerD.UpdateTaskSuccess(parameterValue, returnValue) |
| 129 | + End Sub |
| 130 | + |
| 131 | + #End Region |
| 132 | + |
| 133 | + #Region "UpdateTaskProgress" |
| 134 | + |
| 135 | + ''' <summary> |
| 136 | + ''' Updates progress rate of the asynchronous task in the database. |
| 137 | + ''' </summary> |
| 138 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 139 | + Private Sub UOC_UpdateTaskProgress(parameterValue As ApsParameterValue) |
| 140 | + Dim returnValue As New ApsReturnValue() |
| 141 | + Me.ReturnValue = returnValue |
| 142 | + |
| 143 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 144 | + layerD.UpdateTaskProgress(parameterValue, returnValue) |
| 145 | + End Sub |
| 146 | + |
| 147 | + #End Region |
| 148 | + |
| 149 | + #Region "UpdateTaskCommand" |
| 150 | + |
| 151 | + ''' <summary> |
| 152 | + ''' Updates command value information of a selected asynchronous task |
| 153 | + ''' </summary> |
| 154 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 155 | + Private Sub UOC_UpdateTaskCommand(parameterValue As ApsParameterValue) |
| 156 | + Dim returnValue As New ApsReturnValue() |
| 157 | + Me.ReturnValue = returnValue |
| 158 | + |
| 159 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 160 | + layerD.UpdateTaskCommand(parameterValue, returnValue) |
| 161 | + End Sub |
| 162 | + |
| 163 | + #End Region |
| 164 | + |
| 165 | + #Region "StopAllTask" |
| 166 | + |
| 167 | + ''' <summary> |
| 168 | + ''' Set stop command for all running asynchronous task |
| 169 | + ''' </summary> |
| 170 | + ''' <param name="parameterValue">Asynchronous Parameter Values</param> |
| 171 | + Private Sub UOC_StopAllTask(parameterValue As ApsParameterValue) |
| 172 | + Dim returnValue As New ApsReturnValue() |
| 173 | + Me.ReturnValue = returnValue |
| 174 | + |
| 175 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 176 | + layerD.StopAllTask(parameterValue, returnValue) |
| 177 | + End Sub |
| 178 | + |
| 179 | + #End Region |
| 180 | + |
| 181 | + #End Region |
| 182 | + |
| 183 | + #Region "Select" |
| 184 | + |
| 185 | + #Region "SelectCommand" |
| 186 | + |
| 187 | + ''' <summary> |
| 188 | + ''' Selects user command from Database through LayerD |
| 189 | + ''' </summary> |
| 190 | + ''' <param name="parameterValue"></param> |
| 191 | + Private Sub UOC_SelectCommand(parameterValue As ApsParameterValue) |
| 192 | + Dim returnValue As New ApsReturnValue() |
| 193 | + Me.ReturnValue = returnValue |
| 194 | + |
| 195 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 196 | + layerD.SelectCommand(parameterValue, returnValue) |
| 197 | + End Sub |
| 198 | + |
| 199 | + #End Region |
| 200 | + |
| 201 | + #Region "SelectTask" |
| 202 | + |
| 203 | + ''' <summary> |
| 204 | + ''' Selects Asynchronous task from LayerD |
| 205 | + ''' </summary> |
| 206 | + ''' <param name="parameterValue">Async Parameter Value</param> |
| 207 | + Private Sub UOC_SelectTask(parameterValue As ApsParameterValue) |
| 208 | + Dim returnValue As New ApsReturnValue() |
| 209 | + Me.ReturnValue = returnValue |
| 210 | + |
| 211 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 212 | + layerD.SelectTask(parameterValue, returnValue) |
| 213 | + |
| 214 | + Dim dt As DataTable = DirectCast(returnValue.Obj, DataTable) |
| 215 | + returnValue.Obj = Nothing |
| 216 | + |
| 217 | + If dt IsNot Nothing Then |
| 218 | + If dt.Rows.Count <> 0 Then |
| 219 | + returnValue.TaskId = Convert.ToInt32(dt.Rows(0)("Id")) |
| 220 | + returnValue.UserId = dt.Rows(0)("UserId").ToString() |
| 221 | + returnValue.ProcessName = dt.Rows(0)("ProcessName").ToString() |
| 222 | + returnValue.Data = dt.Rows(0)("Data").ToString() |
| 223 | + returnValue.NumberOfRetries = Convert.ToInt32(dt.Rows(0)("NumberOfRetries")) |
| 224 | + returnValue.ReservedArea = dt.Rows(0)("ReservedArea").ToString() |
| 225 | + returnValue.CommandId = Convert.ToInt32(dt.Rows(0)("CommandId")) |
| 226 | + End If |
| 227 | + End If |
| 228 | + End Sub |
| 229 | + |
| 230 | + #End Region |
| 231 | + |
| 232 | + #End Region |
| 233 | + |
| 234 | + #Region "TestConnection" |
| 235 | + |
| 236 | + ''' <summary> |
| 237 | + ''' Tests the connection with the specified database |
| 238 | + ''' </summary> |
| 239 | + ''' <param name="parameterValue">Async Parameter Value</param> |
| 240 | + Private Sub UOC_TestConnection(parameterValue As ApsParameterValue) |
| 241 | + Dim layerD As New ApsLayerD(Me.GetDam()) |
| 242 | + End Sub |
| 243 | + |
| 244 | + #End Region |
| 245 | + End Class |
| 246 | +End Namespace |
0 commit comments