public object Translate(Artifact source)
		{
			var result = new CREFModel.DynamicRule();

			var context = new TranslationContext(this);

			// Metadata
			var identifier = source.MetaData.Children.First(c => c.Name == "identifiers").Children.First(c => c.Name == "identifier");
			result.Name = identifier.GetAttribute<string>("root");
			result.Description = source.MetaData.Children.First(c => c.Name == "title").GetAttribute<string>("value");
			result.SeverityID = "MED"; // TODO: HeD does not have an artifact level severity indicator.

			// Named Expressions
			result.DynamicRuleNamedExpressions = 
				(
					from expression in source.Expressions
						select TranslateNamedExpression(context, expression)
				).ToList();

			// Criteria
			result.DynamicRuleCriteria = TranslateCriteria(context, source.Conditions.First());

			// TODO: Assertion
			result.DynamicRuleAssertion = TranslateAssertion(context, source.ActionGroup);

			return result;
		}
Exemple #2
0
        public object Translate(Artifact source)
        {
            var result = new CREFModel.DynamicRule();

            var context = new TranslationContext(this);

            // Metadata
            var identifier = source.MetaData.Children.First(c => c.Name == "identifiers").Children.First(c => c.Name == "identifier");

            result.Name        = identifier.GetAttribute <string>("root");
            result.Description = source.MetaData.Children.First(c => c.Name == "title").GetAttribute <string>("value");
            result.SeverityID  = "MED";            // TODO: HeD does not have an artifact level severity indicator.

            // Named Expressions
            result.DynamicRuleNamedExpressions =
                (
                    from expression in source.Expressions
                    select TranslateNamedExpression(context, expression)
                ).ToList();

            // Criteria
            result.DynamicRuleCriteria = TranslateCriteria(context, source.Conditions.First());

            // TODO: Assertion
            result.DynamicRuleAssertion = TranslateAssertion(context, source.ActionGroup);

            return(result);
        }