/// <summary> /// Creates and populates the importAggregate from the Name /// </summary> /// <param name="name">The name of the aggregate (AggregateIdentifier)</param> /// <param name="data">The data as a JSON object</param> /// <returns>Returns the new ImportAggregate</returns> private ImportAggregate CreateAggregate(string name, string data) { var importData = new ImportData() { DataType = Core.Model.DataTypeEnum.Statistics, Data = data }; var importAggregate = new ImportAggregate() { Identifier = name, ImportDate = DateTime.Now, SourceId = 2, Data = new Collection<ImportData>() }; importAggregate.Data.Add(importData); return importAggregate; }
/// <summary> /// Create the Import model for the source, which contains all the /// data extracted from the source. /// </summary> /// <param name="name">Name of the aggregate</param> /// <param name="placemark">The placemark (data) for the aggregate</param> /// <param name="styles">The style, representing the status of the aggregat</param> /// <returns>Fully constructed instance of the aggregate containing all data extracted from the source</returns> private ImportAggregate CreateAggregate(string name, XElement placemark, IDictionary<string, XElement> styles) { var statusid = _helper.GetPlacemarkStatus(placemark); // Get the style (Status) XElement styleKml = null; styles.TryGetValue(statusid, out styleKml); // TODO: get the LOCATION information (from the NAMES folder) by name // TODO: Refactor creation of ImportData and ImportAggregate classes using factory // Format output object and add to results. //var strFootprintData = placemark.ToJson(); var footprintData = new ImportData() { DataType = DataTypeEnum.FootPrint, Data = placemark.ToJson() }; var statusData = new ImportData() { DataType = DataTypeEnum.Status, Data = (styleKml != null) ? styleKml.ToJson() : string.Empty }; var aggregate = new ImportAggregate() { Identifier = name, SourceId = 1, Data = new Collection<ImportData>() { statusData, footprintData } }; return aggregate; }