private static void ValidateNode(SequencingRollupRuleNodeReader nodeReader) { if (nodeReader == null) { return; } ValidateCollection(nodeReader.Conditions); // caught BadProperties2 ValidateProperty(nodeReader.Action); // caught BadProperties2 ValidateProperty(nodeReader.ChildActivitySet); // caught BadProperties2 ValidateProperty(nodeReader.ConditionCombination); // caught BadProperties2 ValidateProperty(nodeReader.MinimumCount); // caught BadProperties2 ValidateProperty(nodeReader.MinimumPercent); // caught BadProperties2 }
private bool? EvaluateRollupConditions(Activity activity, SequencingRollupRuleNodeReader rule) { bool? bRet = null; bool firstRule = true; foreach(SequencingRollupConditionNodeReader condition in rule.Conditions) { bool? b = null; // Evaluate each condition against the activity's tracking information. This evaluation may result in 'unknown' switch(condition.Condition) { case RollupCondition.ActivityProgressKnown: b = activity.DataModel.AttemptProgressStatus; break; case RollupCondition.Attempted: //if(activity.DataModel.ActivityProgressStatus) //{ b = (activity.DataModel.ActivityAttemptCount > 0); //} break; case RollupCondition.AttemptLimitExceeded: //if(activity.DataModel.ActivityProgressStatus) //{ b = (activity.DataModel.ActivityAttemptCount >= activity.Sequencing.AttemptLimit); //} break; case RollupCondition.Completed: if(activity.DataModel.AttemptProgressStatus) { b = (activity.DataModel.AttemptCompletionStatus); } break; case RollupCondition.ObjectiveMeasureKnown: b = activity.PrimaryObjective.ObjectiveMeasureStatus; break; case RollupCondition.ObjectiveStatusKnown: b = activity.PrimaryObjective.ObjectiveProgressStatus; break; case RollupCondition.OutsideAvailableTimeRange: // not supported b = false; break; case RollupCondition.Satisfied: bool progressStatus; bool satisfiedStatus; GetObjectiveSatisfiedStatus(activity, null, out progressStatus, out satisfiedStatus); if(progressStatus) { b = satisfiedStatus; } break; case RollupCondition.TimeLimitExceeded: // not supported b = false; break; default: Utilities.Assert(false); b = false; break; } if(condition.Operator == SequencingConditionOperator.Not && b.HasValue) { b = !b; } if(rule.ConditionCombination == SequencingConditionCombination.All) { if(firstRule) { firstRule = false; bRet = b; } else { // perform AND as per truth table on page SN-4-36 switch(b) { case true: // any value AND with true results in that same value break; case false: // any value AND with false results in false bRet = false; break; case null: // true or unknown AND with unknown results in unknown // false AND with unknown results in false if(bRet != false) { bRet = null; } break; } } } else { if(firstRule) { firstRule = false; bRet = b; } else { // perform OR as per truth table on page SN-4-36 switch(b) { case true: // any value OR with true results in true bRet = true; break; case false: // any value OR with false results that same value break; case null: // false or unknown OR with unknown results in unknown // true OR with unknown results in true if(bRet != true) { bRet = null; } break; } } } } return bRet; }