public void Consolidate( [Parameter("The scenario(s) in which to perform the consolidation", Alias = "Scenario")] IEnumerable <string> scenarios, [Parameter("The year(s) for which to perform the consolidation", Alias = "Year")] IEnumerable <string> years, [Parameter("The period(s) over which the consolidation should be performed", Alias = "Period")] IEnumerable <string> periods, [Parameter("The entities for which the consolidation should be performed", Alias = "Entity")] IEnumerable <string> entities, [Parameter("The type of consolidation to perform", DefaultValue = EConsolidationType.Impacted)] EConsolidationType consolidationType, IOutput output) { int consols = 0, skipped = 0; var slice = new Slice(_metadata); slice[EDimension.Scenario] = scenarios; slice[EDimension.Year] = years; slice[EDimension.Period] = periods; slice[EDimension.Entity] = entities; // Calculate number of iterations, and measure progress var POVs = slice.Combos; output.InitProgress("Consolidating", POVs.Length); foreach (var pov in POVs) { if (CommandLine.UI.Interrupted) { break; } if (ConsolidatePOV(pov, consolidationType, output)) { consols++; } else { skipped++; } } output.EndProgress(); if (consolidationType == EConsolidationType.Impacted) { _log.InfoFormat("Consolidation completed: {0} performed, {1} not needed", consols, skipped); } else { _log.InfoFormat("Consolidation completed: {0} performed", consols); } }
/// Consolidates a Scenario/Year/Period/Entity combination specified in /// the POV internal bool ConsolidatePOV(POV pov, EConsolidationType consolidationType, IOutput output) { var si = _session.SystemInfo; if (consolidationType != EConsolidationType.Impacted || ECalcStatus.NeedsConsolidation.IsSet(_session.Data.GetCalcStatus(pov))) { _log.FineFormat("Consolidating {0}", pov); si.MonitorBlockingTask(output); HFM.Try(() => _hsvCalculate.Consolidate(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, (short)consolidationType)); si.BlockingTaskComplete(); return(true); } else { _log.FineFormat("Consolidation not needed for {0}", pov); return(false); } }