DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
TriggerEvent.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Collections.Generic;
19 
20 using Deveel.Data.Diagnostics;
21 using Deveel.Data.Sql.Tables;
22 
23 namespace Deveel.Data.Sql.Triggers {
24  public sealed class TriggerEvent : Event {
25  internal TriggerEvent(IEventSource source, ObjectName triggerName, ObjectName sourceName, TriggerEventType eventType, RowId oldRowId, Row newRow) {
26  if (triggerName == null)
27  throw new ArgumentNullException("triggerName");
28  if (sourceName == null)
29  throw new ArgumentNullException("sourceName");
30 
31  Source = source;
32  TriggerName = triggerName;
33  SourceName = sourceName;
34  TriggerEventType = eventType;
35  OldRowId = oldRowId;
36  NewRow = newRow;
37  }
38 
39  private IEventSource Source { get; set; }
40 
41  public ObjectName TriggerName { get; private set; }
42 
43  public ObjectName SourceName { get; set; }
44 
45  public TriggerEventType TriggerEventType { get; private set; }
46 
47  public RowId OldRowId { get; set; }
48 
49  public Row NewRow { get; set; }
50 
51  protected override void GetEventData(Dictionary<string, object> data) {
52  data["trigger.name"] = TriggerName.FullName;
53  data["trigger.eventType"] = TriggerEventType.ToString();
54  data["trigger.source"] = SourceName.FullName;
55  data["trigger.old.tableId"] = OldRowId.TableId;
56  data["trigger.old.rowNumber"] = OldRowId.RowNumber;
57  data["trigger.new"] = NewRow;
58  }
59  }
60 }
TriggerEventType
The different types of high layer trigger events.
Describes the name of an object within a database.
Definition: ObjectName.cs:44
A single row in a table of a database.
Definition: Row.cs:44
override void GetEventData(Dictionary< string, object > data)
Definition: TriggerEvent.cs:51
Defines the value of a ROWID object, that is a unique reference within a database system to a single ...
Definition: RowId.cs:24
TriggerEvent(IEventSource source, ObjectName triggerName, ObjectName sourceName, TriggerEventType eventType, RowId oldRowId, Row newRow)
Definition: TriggerEvent.cs:25
Represents the origin of system events, providing a mechanism to fill the metadata before dispatching...
Definition: IEventSource.cs:40