//doesn't run analysis yet; just fills in stateful model for object analysis private async Task <bool> RunBasicAnalysisAndSetUpdates(XElement currentElement) { bool bHasCalculations = false; if (!currentElement.HasAttributes) { return(true); } //1. set parameters needed by updates collection this.GCCalculatorParams.CurrentElementNodeName = currentElement.Name.LocalName; this.GCCalculatorParams.CurrentElementURIPattern = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern, currentElement); //2. don't run calcs on ancestors bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode( this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName); if (bIsSelfOrDescendentNode) { //3. get the calculator to use //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc) XElement linkedViewElement = null; linkedViewElement = CalculatorHelpers.GetCalculator( this.GCCalculatorParams, currentElement); //4. Set bool to update base node attributes in db this.GCCalculatorParams.AttributeNeedsDbUpdate = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams); //5. raise event to carry out analysis (no tasks, just property manipulation) bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement); if (bHasCalculations) { //6. allow analyzers to db update descendent analyzers CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement, ref linkedViewElement); //7. replace the this.GCCalculatorParams.LinkedViewElement when //the originating doctocalcuri node is processed bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams, currentElement, linkedViewElement); //8. SetXmlDocAttributes CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams, linkedViewElement, ref currentElement, this.GCCalculatorParams.Updates); } } else { XElement linkedViewElement = null; bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement); //always return true, so no error msg is generated bHasCalculations = true; } return(bHasCalculations); }
private bool RunBasicAnalysisAndSetUpdates(ref XElement currentElement) { bool bHasCalculations = false; if (!currentElement.HasAttributes) { return(true); } //1. set parameters needed by updates collection this.GCCalculatorParams.CurrentElementNodeName = currentElement.Name.LocalName; this.GCCalculatorParams.CurrentElementURIPattern = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern, currentElement); //2. don't run calcs on ancestors bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode( this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName); if (bIsSelfOrDescendentNode) { //3. get the calculator to use //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc) XElement linkedViewElement = null; linkedViewElement = CalculatorHelpers.GetCalculator( this.GCCalculatorParams, currentElement); //4. Set bool to update base node attributes in db this.GCCalculatorParams.AttributeNeedsDbUpdate = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams); //5. raise event to carry out calculations GCArguments.CurrentElement = currentElement; GCArguments.LinkedViewElement = linkedViewElement; OnRunCalculation(GCArguments); currentElement = GCArguments.CurrentElement; //subscriber sets the lv to update linkedViewElement = GCArguments.LinkedViewElement; bHasCalculations = GCArguments.HasCalculations; if (bHasCalculations) { //6. allow analyzers to db update descendent analyzers CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement, ref linkedViewElement); //7. replace the this.GCCalculatorParams.LinkedViewElement when //the originating doctocalcuri node is processed bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams, currentElement, linkedViewElement); //8. SetXmlDocAttributes CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams, linkedViewElement, ref currentElement, this.GCCalculatorParams.Updates); } } else { //version 1.3.6 added this so that ancestors are always added to collections //to make analyses consistent (i.e. always start with group) GCArguments.CurrentElement = currentElement; //ancestors can never update or use a linkedview element GCArguments.LinkedViewElement = null; //but we want the ancestor current element added to the underlying collections OnRunCalculation(GCArguments); //always return true, so no error msg is generated bHasCalculations = true; } return(bHasCalculations); }