1
/****************************************************************************
3
| Copyright (c) 2007 Novell, Inc.
6
| This program is free software; you can redistribute it and/or
7
| modify it under the terms of version 2 of the GNU General Public License as
8
| published by the Free Software Foundation.
10
| This program is distributed in the hope that it will be useful,
11
| but WITHOUT ANY WARRANTY; without even the implied warranty of
12
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
| GNU General Public License for more details.
15
| You should have received a copy of the GNU General Public License
16
| along with this program; if not, contact Novell, Inc.
18
| To contact Novell about this file by physical or electronic mail,
19
| you may find current contact information at www.novell.com
22
|***************************************************************************/
27
namespace Simias.Client.Event
30
/// The Event types supported.
33
public enum EventType : short
36
/// The event is for a node create.
40
/// The event is for a node delete.
44
/// The event is for a node change.
48
/// The event is for no access.
54
/// The event arguments for a Collection event.
57
public class NodeEventArgs : SimiasEventArgs
72
/// Flags for the node event.
75
public enum EventFlags : ushort
78
/// The event was caused by local only properties.
90
/// Constructs a SimiasEventArgs that will be used by CollectionHandler delegates.
91
/// Describes the node affected by the event.
93
/// <param name="source">The source of the event.</param>
94
/// <param name="node">The object of the event.</param>
95
/// <param name="collection">The Collection that the node belongs to.</param>\
96
/// <param name="type">The Type of the Node.</param>
97
/// <param name="changeType">The type of change that occured.</param>
98
/// <param name="eventId">A user defined event ID. Only has meaning to a publisher.</param>
99
/// <param name="time">The time of the event.</param>
100
/// <param name="masterRev">The master revision for the node.</param>
101
/// <param name="slaveRev">The local revision for the node.</param>
102
/// <param name="fileSize">The length of the file if the node is a BaseFileNode. Otherwise
103
/// the value of this parameter will be zero.</param>
104
public NodeEventArgs(string source, string node, string collection, string type, EventType changeType, int eventId, DateTime time, ulong masterRev, ulong slaveRev, long fileSize) :
105
this(source, node, collection, string.Empty, type, changeType, eventId, time, masterRev, slaveRev, fileSize)
110
/// Constructs a SimiasEventArgs that will be used by CollectionHandler delegates.
111
/// Describes the node affected by the event.
113
/// <param name="source">The source of the event.</param>
114
/// <param name="node">The object of the event.</param>
115
/// <param name="collection">The Collection that the node belongs to.</param>
116
/// <param name="modifier">The user that modified the node.</param>
117
/// <param name="type">The Type of the Node.</param>
118
/// <param name="changeType">The type of change that occured.</param>
119
/// <param name="eventId">A user defined event ID. Only has meaning to a publisher.</param>
120
/// <param name="time">The time of the event.</param>
121
/// <param name="masterRev">The master revision for the node.</param>
122
/// <param name="slaveRev">The local revision for the node.</param>
123
/// <param name="fileSize">The length of the file if the node is a BaseFileNode. Otherwise
124
/// the value of this parameter will be zero.</param>
125
public NodeEventArgs(string source, string node, string collection, string modifier, string type, EventType changeType, int eventId, DateTime time, ulong masterRev, ulong slaveRev, long fileSize) :
126
base(changeType.ToString(), time)
128
this.source = source;
130
this.collection = collection;
131
this.modifier = modifier;
133
this.eventId = eventId;
134
this.masterRev = masterRev;
135
this.slaveRev = slaveRev;
136
this.fileSize = fileSize;
144
/// Gets the string that represents the source of the event.
152
/// Gets the ID of the affected Node/Collection.
160
/// Gets the containing collection ID.
162
public string Collection
164
get {return collection;}
168
/// Gets the ID of the user that modified the node.
170
public string Modifier
172
get {return modifier;}
176
/// Gets the Type of the affected Node.
184
/// Gets a Sets an event ID. Usually 0.
185
/// Used by a publisher. Can be used to detect circular events.
189
get {return eventId;}
193
/// Gets the Node ID.
201
/// Gets or sets the flags.
205
get {return (ushort)flags;}
206
set {flags = (EventFlags)value; }
210
/// Gets or sets if the event refers to local only changes.
212
public bool LocalOnly
216
return ((flags & EventFlags.LocalOnly) > 0);
221
flags |= EventFlags.LocalOnly;
223
flags &= ~EventFlags.LocalOnly;
228
/// Gets the master revision for the node.
230
public ulong MasterRev
232
get { return masterRev; }
236
/// Gets the slave revision for the node.
238
public ulong SlaveRev
240
get { return slaveRev; }
244
/// Gets the file size for the node. If the node is
245
/// not a file type, zero is returned.
249
get { return fileSize; }
254
/// Gets the type of event that occurred
256
public EventType EventType
260
return (EventType)Enum.Parse(typeof(EventType), EventData);