Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ExecuteReportFileCommand.cs
1using System;
2using System.Threading.Tasks;
3using Waher.Events;
8using Waher.Script;
9using Waher.Things;
11
13{
18 {
19 private readonly ReportFile parsedReport;
20 private readonly Variables variables;
21
29 : base(ReportNode)
30 {
31 this.parsedReport = Report;
32 this.variables = Variables;
33 }
34
39 public override ICommand Copy()
40 {
41 return new ExecuteReportFileCommand(this.parsedReport, this.Report, this.variables);
42 }
43
51 {
52 return this.parsedReport.PopulateForm(Parameters, Language, this.variables, Origin);
53 }
54
63 public Task<SetEditableFormResult> SetParameters(DataForm Parameters, Language Language,
64 bool OnlySetChanged, IRequestOrigin Origin)
65 {
66 return this.parsedReport.SetParameters(Parameters, Language, OnlySetChanged, this.variables, Origin);
67 }
68
75 {
76 ReportState State = new ReportState(Query, Language, this.variables,
79
80 try
81 {
82 if (!State.Query.IsStarted)
83 await State.Query.Start();
84
85 await Query.SetStatus(await State.ReportFilesNamespace.GetStringAsync(9, "Executing Query..."));
86
87 await this.parsedReport.Execute(State);
88
89 await State.Query.SetStatus(string.Empty);
90 }
91 catch (Exception ex)
92 {
93 await Query.LogMessage(ex);
94 Log.Exception(ex);
95 }
96 finally
97 {
98 if (!Query.IsDone && !Query.IsAborted)
99 await Query.Done();
100 }
101 }
102 }
103}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1657
Static class managing editable parameters in objects. Editable parameters are defined by using the at...
Definition: Parameters.cs:26
Implements support for data forms. Data Forms are defined in the following XEPs:
Definition: DataForm.cs:42
Abstract base class for commands executing a report.
ReportNode Report
Report node.
override ICommand Copy()
Creates a copy of the command object.
override async Task StartQueryExecutionAsync(Query Query, Language Language)
Starts the execution of a query.
Task< SetEditableFormResult > SetParameters(DataForm Parameters, Language Language, bool OnlySetChanged, IRequestOrigin Origin)
Sets the parameters of the object, based on contents in the data form.
Task PopulateForm(DataForm Parameters, Language Language, IRequestOrigin Origin)
Populates a data form with parameters for the object.
ExecuteReportFileCommand(ReportFile Report, ReportNode ReportNode, Variables Variables)
Command to execute a report file.
Contains a parsed report, as defined in a report file.
Definition: ReportFile.cs:23
Class containing the state of a report.
Definition: ReportState.cs:12
Query Query
Current query object reference.
Definition: ReportState.cs:35
Namespace ReportFilesNamespace
Language namespace reference for report files.
Definition: ReportState.cs:50
Report node based on the contents of a report file.
Abstract base class for report nodes.
Definition: ReportNode.cs:15
Contains information about a language.
Definition: Language.cs:17
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
Collection of variables.
Definition: Variables.cs:25
Class handling the reception of data from a query.
Definition: Query.cs:12
bool IsDone
If the query is done.
Definition: Query.cs:95
bool IsStarted
If the query has been started.
Definition: Query.cs:85
Task Start()
Starts query execution.
Definition: Query.cs:213
RequestOrigin Origin
Origin of request to execute the query.
Definition: Query.cs:80
bool IsAborted
If the query is aborted.
Definition: Query.cs:90
Task LogMessage(Exception Exception)
Logs an Exception as a query message.
Definition: Query.cs:381
async Task Done()
Query execution completed.
Definition: Query.cs:241
Task SetStatus(string Status)
Sets the current status of the query execution.
Definition: Query.cs:457
Interface for commands.
Definition: ICommand.cs:32
Interface for requestors that can act as an origin for distributed requests.