3using System.Threading.Tasks;
22 private static readonly Dictionary<string, ReportNode> nodes =
new Dictionary<string, ReportNode>();
23 private static readonly List<ReportNode> roots =
new List<ReportNode>();
25 private static DateTime lastChanged = DateTime.UtcNow;
42 string IDataSource.SourceID =>
SourceID;
88 return roots.ToArray();
105 roots.Add(ReportRoot);
124 lastChanged = DateTime.UtcNow;
145 public event EventHandlerAsync<SourceEvent>
OnEvent =
null;
149 await (instance?.
OnEvent?.Raise(instance,
Event) ?? Task.CompletedTask);
160 return Task.FromResult<
INode>(
null);
163 return Task.FromResult<
INode>(Result);
165 return Task.FromResult<
INode>(
null);
Class representing an event.
Abstract base class for report nodes.
bool HasChildren
If the source has any child sources.
Task< IEnumerable< INode > > ChildNodes
Child nodes. If no child nodes are available, null is returned.
Defines the Reports data source. This data source contains a tree structure of reports published by d...
IEnumerable< IDataSource > ChildSources
Child sources. If no child sources are available, null is returned.
static async Task< bool > RegisterReportNode(ReportNode ReportNode)
Registers a new report node.
EventHandlerAsync< SourceEvent > OnEvent
Event raised when a data source event has been raised.
Task< INode > GetNodeAsync(IThingReference NodeRef)
Gets the node, given a reference to it.
Task< bool > CanViewAsync(RequestOrigin Caller)
If the data source is visible to the caller.
static async Task< bool > RegisterRootNode(ReportNode ReportRoot)
Registers a new report root node.
ReportsDataSource()
Defines the Reports data source. This data source contains a tree structure of reports published by d...
bool HasChildren
If the source has any child sources.
Task< string > GetNameAsync(Language Language)
Gets the name of data source.
IEnumerable< INode > RootNodes
Root node references. If no root nodes are available, null is returned.
const string SourceID
Source ID for the reports data source.
DateTime LastChanged
When the source was last updated.
Contains information about a language.
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 ...
Basic access point for runtime language localization.
static async Task< Language > GetDefaultLanguageAsync()
Gets the default language.
Tokens available in request.
static readonly RequestOrigin Empty
Empty request origin.
bool HasPrivilege(string Privilege)
If the origin has a given privilege.
static Task< NodeAdded > FromNode(INode Node, Language Language, RequestOrigin Caller, bool Sniffable)
Creates an event object from a node object.
Abstract base class for all data source events.
Interface for datasources that are published through the concentrator interface.
Interface for nodes that are published through the concentrator interface.
Interface for thing references.
string Partition
Optional partition in which the Node ID is unique.
string SourceId
Optional ID of source containing node.