Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Information.cs
1using System;
6
8{
12 [CollectionName("OpenIntelligence")]
13 [TypeName(TypeNameSerialization.FullName)]
14 [Index("RemoteEndpoint", "Timestamp")]
15 [Index("Timestamp", "RemoteEndpoint")]
16 [Index("Vector", "RemoteEndpoint", "Timestamp")]
17 [Index("Protocol", "RemoteEndpoint", "Timestamp")]
18 [Index("Classification", "RemoteEndpoint", "Timestamp")]
19 [Index("Code", "RemoteEndpoint", "Timestamp")]
20 [ArchivingTime(nameof(ArchiveDays))]
21 public class Information
22 {
26 public Information()
27 {
28 }
29
33 [ObjectId]
34 public string ObjectId { get; set; } = null;
35
40
45
49 public DateTime Timestamp { get; set; } = DateTime.MinValue;
50
54 public DateTime Expires { get; set; } = DateTime.MinValue;
55
60
65
70
75
79 public string Message { get; set; } = string.Empty;
80
84 public PersistedTag[] Tags { get; set; } = null;
85
90
94 public Property[] AgentInformation { get; set; } = null;
95
99 public int ArchiveDays
100 {
101 get
102 {
103 if (this.Expires == DateTime.MaxValue)
104 return int.MaxValue;
105
106 TimeSpan Span = this.Expires - DateTime.Now;
107 double Days = Math.Ceiling(Span.TotalDays);
108
109 if (Days < 0)
110 return 0;
111 else if (Days > int.MaxValue)
112 return int.MaxValue;
113 else
114 return (int)Days;
115 }
116 }
117 }
118}
Class representing a persisted tag.
Definition: PersistedTag.cs:10
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
Represents one piece of infomration shared in a distributed network for Open Intelligence purposes.
Definition: Information.cs:22
Property[] AgentInformation
Information about Agent adding the information.
Definition: Information.cs:94
CaseInsensitiveString Domain
Originating domain where information was created.
Definition: Information.cs:39
Information()
Represents one piece of infomration shared in a distributed network for Open Intelligence purposes.
Definition: Information.cs:26
PersistedTag[] Tags
Annotated tags with further information.
Definition: Information.cs:84
CaseInsensitiveString AgentJid
JID of Agent adding the information.
Definition: Information.cs:89
TypeNameSerialization
How the type name should be serialized.