private static void ExportMvdRule(AttributeRule mvdRule, DocModelRule docRule) { if (!String.IsNullOrEmpty(docRule.Identification)) { mvdRule.RuleID = docRule.Identification; } mvdRule.Description = docRule.Description; mvdRule.AttributeName = docRule.Name; //mvdRule.Cardinality = ExportCardinalityType(docRule); foreach (DocModelRule docRuleEntity in docRule.Rules) { if (docRuleEntity is DocModelRuleEntity) { if(mvdRule.EntityRules == null) { mvdRule.EntityRules = new List<EntityRule>(); } EntityRule mvdRuleEntity = new EntityRule(); mvdRule.EntityRules.Add(mvdRuleEntity); mvdRuleEntity.RuleID = docRuleEntity.Identification; mvdRuleEntity.Description = docRuleEntity.Description; mvdRuleEntity.EntityName = docRuleEntity.Name; //mvdRuleEntity.Cardinality = ExportCardinalityType(docRuleEntity); foreach (DocModelRule docRuleAttribute in docRuleEntity.Rules) { if (docRuleAttribute is DocModelRuleAttribute) { if(mvdRuleEntity.AttributeRules == null) { mvdRuleEntity.AttributeRules = new List<AttributeRule>(); } AttributeRule mvdRuleAttribute = new AttributeRule(); mvdRuleEntity.AttributeRules.Add(mvdRuleAttribute); ExportMvdRule(mvdRuleAttribute, docRuleAttribute); } else if (docRuleAttribute is DocModelRuleConstraint && !String.IsNullOrEmpty(docRuleAttribute.Description)) { if(mvdRuleEntity.Constraints == null) { mvdRuleEntity.Constraints = new List<Constraint>(); } Constraint mvdConstraint = new Constraint(); mvdRuleEntity.Constraints.Add(mvdConstraint); mvdConstraint.Expression = docRuleAttribute.Description; } } DocModelRuleEntity dme = (DocModelRuleEntity)docRuleEntity; if(dme.References.Count > 0) { mvdRuleEntity.References = new List<TemplateRef>(); foreach (DocTemplateDefinition dtd in dme.References) { TemplateRef tr = new TemplateRef(); tr.Ref = dtd.Uuid; mvdRuleEntity.References.Add(tr); } } } else if (docRuleEntity is DocModelRuleConstraint) { if(mvdRule.Constraints == null) { mvdRule.Constraints = new List<Constraint>(); } Constraint mvdConstraint = new Constraint(); mvdRule.Constraints.Add(mvdConstraint); mvdConstraint.Expression = docRuleEntity.Description; } } }