private Dictionary <string, List <StreamPayloadBaseType> > m_reportIntervalPayloads = new Dictionary <string, List <StreamPayloadBaseType> >(); // payloads for an interval for a date public ReportWrapper(string reportSpecifierID, ReportName reportName, int duration, DurationModifier durationModifier) { ReportSpecifierID = reportSpecifierID; m_reportName = reportName; m_reportDuration = new DurationPropType(); m_reportDuration.duration = "PT" + duration.ToString() + durationModifier.Value; }
public void addReport(string reportSpecifierID, ReportName reportName, int duration, DurationModifier durationModifier) { oadrReportType report = new oadrReportType(); report.reportRequestID = "0"; report.reportSpecifierID = reportSpecifierID; report.reportName = reportName.Name; report.duration = new DurationPropType(); report.duration.duration = "PT" + duration.ToString() + durationModifier.Value; _reports.Add(report.reportSpecifierID, report); _reportNames.Add(report.reportSpecifierID, reportName); }
/**********************************************************/ public oadrReportType generateReportDescription(string reportSpeciferID) { oadrReportType report = _reports[reportSpeciferID]; ReportName reportName = _reportNames[reportSpeciferID]; Dictionary <string, oadrReportDescriptionType> reportDescriptionsDictionary; report.dtstart = null; // report.duration = null; report.createdDateTime = DateTime.UtcNow; report.reportName = reportName.MetaDataName; try { reportDescriptionsDictionary = _reportDescriptions[reportSpeciferID]; } catch (System.Collections.Generic.KeyNotFoundException) { // thre report does not have any descriptors return(report); } oadrReportDescriptionType[] reportDescriptionsArray = new oadrReportDescriptionType[reportDescriptionsDictionary.Count]; int index = 0; foreach (oadrReportDescriptionType reportDescription in reportDescriptionsDictionary.Values) { reportDescriptionsArray[index] = reportDescription; index++; } report.oadrReportDescription = reportDescriptionsArray; report.intervals = null; return(report); }
/**********************************************************/ public oadrReportType generateReport(string reportSpecifierID, DateTime dtstartUTC) { oadrReportType report = _reports[reportSpecifierID]; ReportName reportName = _reportNames[reportSpecifierID]; report.reportName = reportName.Name; // save the duration and restore after generating the report // the duration is only required when registering the report; it indicates // the max history that is recorded, and the max time frame the can be included in a report DurationPropType duraton = report.duration; report.duration = null; report.createdDateTime = DateTime.UtcNow; List <IntervalType> reportIntervals; try { reportIntervals = _reportIntervals[reportSpecifierID]; } catch (System.Collections.Generic.KeyNotFoundException) { // the report does not have any descriptors return(report); } // the dtstart of the report must match the dtstart of the first interval report.dtstart = new dtstart(); report.dtstart.datetime = reportIntervals[0].dtstart.datetime; IntervalType[] intervalsArray = new IntervalType[reportIntervals.Count]; int intervalIndex = 0; foreach (IntervalType interval in reportIntervals) { intervalsArray[intervalIndex] = interval; List <oadrReportPayloadType> reportIntervalPayloads = _reportIntervalPayloads[reportSpecifierID][intervalIndex]; interval.streamPayloadBase = new StreamPayloadBaseType[reportIntervalPayloads.Count]; int payloadIndex = 0; foreach (oadrReportPayloadType reportPayload in reportIntervalPayloads) { interval.streamPayloadBase[payloadIndex] = reportPayload; payloadIndex++; } reportIntervalPayloads.Clear(); intervalIndex++; } _reportIntervals.Remove(reportSpecifierID); _reportIntervalPayloads.Remove(reportSpecifierID); report.oadrReportDescription = null; report.intervals = intervalsArray; return(report); }