Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
IntervalNode.cs
1using System;
2using System.Collections.Generic;
3using System.Threading.Tasks;
4using Waher.Content;
6using Waher.Things;
9
11{
16 {
17 private readonly string id = Guid.NewGuid().ToString();
18
22 public IntervalNode()
23 : base()
24 {
25 this.NrAttempts = 0;
26 this.Interval = null;
27 }
28
36 : base(Source, null)
37 {
38 this.NrAttempts = NrAttempts;
39 this.Interval = Interval;
40 }
41
45 public override string NodeId => this.id;
46
50 [Page(7, "Configuration")]
51 [Header(102, "Number of attempts:")]
52 [ToolTip(103, "Number of login attempts permitted during the interval duration.")]
53 [Required]
54 public int NrAttempts { get; set; }
55
59 [Page(7, "Configuration")]
60 [Header(104, "Interval Duration:")]
61 [ToolTip(105, "Duration of interval. The last interval can be an eternal interval. This is defined by omitting a value for this parameter.")]
62 public Duration? Interval { get; set; }
63
68 public override Task<string> GetTypeNameAsync(Language Language) => Language.GetStringAsync(typeof(GatewayConfigSource), 101, "Interval");
69
75 public override Task<bool> AcceptsParentAsync(INode Parent)
76 {
77 return Task.FromResult(Parent is LoginAuditorNode);
78 }
79
86 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
87 {
88 LinkedList<Parameter> Parameters = new LinkedList<Parameter>();
90
91 Parameters.AddLast(new Int64Parameter("Attemmpts", await Namespace.GetStringAsync(117, "Attempts"), this.NrAttempts));
92
93 if (this.Interval.HasValue)
94 Parameters.AddLast(new DurationParameter("Interval", await Namespace.GetStringAsync(101, "Interval"), this.Interval.Value));
95
96 return Parameters;
97 }
98 }
99}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
Represents an interval in a LoginAuditor configuration.
Definition: IntervalNode.cs:16
IntervalNode()
Represents an interval in a LoginAuditor configuration.
Definition: IntervalNode.cs:22
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
Definition: IntervalNode.cs:86
int NrAttempts
Number of attempts during interval.
Definition: IntervalNode.cs:54
IntervalNode(GatewayConfigSource Source, int NrAttempts, Duration? Interval)
Represents an interval in a LoginAuditor configuration.
Definition: IntervalNode.cs:35
override Task< bool > AcceptsParentAsync(INode Parent)
If the node accepts a presumptive parent, i.e. can be added to that parent (if that parent accepts th...
Definition: IntervalNode.cs:75
Contains configuration of the Login Auditor.
Tokens available in request.
Definition: RequestOrigin.cs:9
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
Represents a duration value, as defined by the xsd:duration data type: http://www....
Definition: Duration.cs:13