Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
OnXmlNote.cs
1
using
System.Text;
2
using
System.Threading.Tasks;
3
using
System.Xml;
4
using
Waher.Content.Xml
;
5
using
Waher.Persistence
;
6
using
Waher.Persistence.Attributes
;
7
using
Waher.Service.IoTBroker.StateMachines.EventHandlers
;
8
using
Waher.Service.IoTBroker.StateMachines.Model.Attributes
;
9
using
Waher.Service.IoTBroker.StateMachines.Model.States
;
10
11
namespace
Waher.Service.IoTBroker.StateMachines.Model.Events
12
{
16
public
class
OnXmlNote
:
OnNote
17
{
18
private
ScriptableStringAttribute
localName;
19
private
ScriptableStringAttribute
@
namespace
;
20
24
public
OnXmlNote
()
25
: base()
26
{
27
}
28
32
[DefaultValueNull]
33
public
string
LocalNameDefinition
34
{
35
get
=> this.localName?.
Definition
;
36
set
=> this.localName =
new
ScriptableStringAttribute
(value,
this
);
37
}
38
42
[DefaultValueNull]
43
public
string
NamespaceDefinition
44
{
45
get
=> this.@
namespace
?.Definition;
46
set
=> this.@
namespace
= new
ScriptableStringAttribute
(value, this);
47
}
48
52
public
override
string
LocalName
=> nameof(
OnXmlNote
);
53
58
public
override
IStateMachineNode
Create
()
59
{
60
return
new
OnXmlNote
();
61
}
62
67
public
override
Task
Parse
(XmlElement Xml)
68
{
69
this.localName =
new
ScriptableStringAttribute
(
XML
.
Attribute
(Xml,
"localName"
),
this
);
70
this.@
namespace
= new
ScriptableStringAttribute
(
XML
.Attribute(Xml,
"namespace"
), this);
71
72
return
base.Parse(Xml);
73
}
74
82
public
override
async Task<bool>
Register
(
int
EventIndex,
EvaluationArguments
Arguments,
OnEvent
Event
)
83
{
84
string
NoteVariable = await this.
EvaluateNoteVariable
(Arguments);
85
string
PersonalVariable = await this.
EvaluateNoteVariable
(Arguments);
86
string
LocalName
= await this.localName.
Evaluate
(Arguments.
Variables
);
87
string
Namespace
= await this.@
namespace
.Evaluate(Arguments.
Variables
);
88
89
TokenNoteEventHandler
Handler =
new
TokenNoteEventHandler
(Arguments,
90
EventIndex,
this
, NoteVariable, PersonalVariable,
string
.Empty,
91
string
.Empty,
LocalName
,
Namespace
);
92
93
await
Database
.
Insert
(Handler);
94
await Handler.
AddToCache
();
95
96
return
false
;
97
}
98
102
public
override
string
Label
103
{
104
get
105
{
106
StringBuilder sb =
new
StringBuilder();
107
108
sb.Append(nameof(
OnXmlNote
));
109
sb.Append(
'('
);
110
sb.Append(this.localName.
Definition
);
111
sb.Append(
')'
);
112
113
return
sb.ToString();
114
}
115
}
116
117
}
118
}
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.Attribute
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition:
XML.cs:914
Waher.Persistence.Database
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition:
Database.cs:19
Waher.Persistence.Database.Insert
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
Definition:
Database.cs:95
Waher.Service.IoTBroker.StateMachines.EventHandlers.CachedEventHandler.AddToCache
async Task AddToCache()
Removes the event handler from the cache.
Definition:
CachedEventHandler.cs:46
Waher.Service.IoTBroker.StateMachines.EventHandlers.TokenNoteEventHandler
Event handler for token note events.
Definition:
TokenNoteEventHandler.cs:11
Waher.Service.IoTBroker.StateMachines.Model.Attributes.ScriptableAttribute.Evaluate
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
Definition:
ScriptableAttribute.cs:66
Waher.Service.IoTBroker.StateMachines.Model.Attributes.ScriptableAttribute.Definition
string Definition
Attribute definition
Definition:
ScriptableAttribute.cs:37
Waher.Service.IoTBroker.StateMachines.Model.Attributes.ScriptableStringAttribute
Scriptable string attribute.
Definition:
ScriptableStringAttribute.cs:7
Waher.Service.IoTBroker.StateMachines.Model.EvaluationArguments
Contains information required for evaluating script in a state-machine.
Definition:
EvaluationArguments.cs:15
Waher.Service.IoTBroker.StateMachines.Model.EvaluationArguments.Variables
Variables Variables
Current set of variables.
Definition:
EvaluationArguments.cs:47
Waher.Service.IoTBroker.StateMachines.Model.Events.Event
Represents an event definition.
Definition:
Event.cs:13
Waher.Service.IoTBroker.StateMachines.Model.Events.OnNote
Abstract base class for note events.
Definition:
OnNote.cs:13
Waher.Service.IoTBroker.StateMachines.Model.Events.OnNote.EvaluateNoteVariable
Task< string > EvaluateNoteVariable(EvaluationArguments Arguments)
Evaluates the note variable definition.
Definition:
OnNote.cs:62
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote
Event raised when an XML note has been logged on the token corresponding to the state-machine.
Definition:
OnXmlNote.cs:17
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.Register
override async Task< bool > Register(int EventIndex, EvaluationArguments Arguments, OnEvent Event)
Registers the event
Definition:
OnXmlNote.cs:82
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.NamespaceDefinition
string NamespaceDefinition
Namespace definition.
Definition:
OnXmlNote.cs:44
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.LocalNameDefinition
string LocalNameDefinition
Local Name definition.
Definition:
OnXmlNote.cs:34
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.Label
override string Label
UML Label for event.
Definition:
OnXmlNote.cs:103
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.Parse
override Task Parse(XmlElement Xml)
Parses the State-machine node.
Definition:
OnXmlNote.cs:67
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.OnXmlNote
OnXmlNote()
Event raised when an XML note has been logged on the token corresponding to the state-machine.
Definition:
OnXmlNote.cs:24
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.Create
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Definition:
OnXmlNote.cs:58
Waher.Service.IoTBroker.StateMachines.Model.Events.OnXmlNote.LocalName
override string LocalName
Local name
Definition:
OnXmlNote.cs:52
Waher.Service.IoTBroker.StateMachines.Model.StateMachineNode.Namespace
virtual string Namespace
Namespace
Definition:
StateMachineNode.cs:43
Waher.Service.IoTBroker.StateMachines.Model.States.OnEvent
Action executed when entering a state.
Definition:
OnEvent.cs:17
Waher.Service.IoTBroker.StateMachines.Model.IStateMachineNode
Interface for State-Machine nodes
Definition:
IStateMachineNode.cs:11
Waher.Content.Xml
Definition:
XmlCodec.cs:11
Waher.Persistence.Attributes
Definition:
ArchivingTimeAttribute.cs:4
Waher.Persistence
Definition:
Bookmark.cs:4
Waher.Service.IoTBroker.StateMachines.EventHandlers
Definition:
CachedEventHandler.cs:13
Waher.Service.IoTBroker.StateMachines.Model.Attributes
Definition:
ExpressionAttribute.cs:9
Waher.Service.IoTBroker.StateMachines.Model.Events
Definition:
EntryEventNode.cs:12
Waher.Service.IoTBroker.StateMachines.Model.States
Definition:
OnEnter.cs:4
Waher.Service.IoTBroker
StateMachines
Model
Events
OnXmlNote.cs
Generated by
1.9.5