예제 #1
0
        private static void ImportMvdConcept(Concept mvdNode, DocTemplateUsage docUse, DocProject docProject, Dictionary<Guid, ExchangeRequirement> mapExchange)
        {
            // special case for attributes
            DocTemplateDefinition docTemplateDef = docProject.GetTemplate(mvdNode.Template.Ref);
            if (docTemplateDef != null)
            {
                ImportMvdObject(mvdNode, docUse);

                docUse.Definition = docTemplateDef;
                docUse.Override = mvdNode.Override;

                // exchange requirements
                foreach (ConceptRequirement mvdReq in mvdNode.Requirements)
                {
                    ExchangeRequirement mvdExchange = null;
                    if (mapExchange.TryGetValue(mvdReq.ExchangeRequirement, out mvdExchange))
                    {
                        DocExchangeItem docReq = new DocExchangeItem();
                        docUse.Exchanges.Add(docReq);

                        foreach (DocModelView docModel in docProject.ModelViews)
                        {
                            foreach (DocExchangeDefinition docAnno in docModel.Exchanges)
                            {
                                if (docAnno.Uuid.Equals(mvdReq.ExchangeRequirement))
                                {
                                    docReq.Exchange = docAnno;
                                    break;
                                }
                            }
                        }

                        docReq.Applicability = (DocExchangeApplicabilityEnum)mvdReq.Applicability;

                        switch(mvdReq.Requirement)
                        {
                            case RequirementEnum.Mandatory:
                                docReq.Requirement = DocExchangeRequirementEnum.Mandatory;
                                break;

                            case RequirementEnum.Recommended:
                                docReq.Requirement = DocExchangeRequirementEnum.Optional;
                                break;

                            case RequirementEnum.NotRelevant:
                                docReq.Requirement = DocExchangeRequirementEnum.NotRelevant;
                                break;

                            case RequirementEnum.NotRecommended:
                                docReq.Requirement = DocExchangeRequirementEnum.NotRecommended;
                                break;

                            case RequirementEnum.Excluded:
                                docReq.Requirement = DocExchangeRequirementEnum.Excluded;
                                break;
                        }
                    }
                }

                // rules as template items
                if (mvdNode.TemplateRules != null)
                {
                    docUse.Operator = (DocTemplateOperator)Enum.Parse(typeof(DocTemplateOperator), mvdNode.TemplateRules.Operator.ToString());
                    foreach (TemplateRule rule in mvdNode.TemplateRules.TemplateRule)
                    {
                        DocTemplateItem docItem = ImportMvdItem(rule, docProject, mapExchange);
                        docUse.Items.Add(docItem);
                    }

                    if (mvdNode.TemplateRules.InnerRules != null)
                    {
                        mvdNode.ToString();
                    }
                }

            }
        }
예제 #2
0
        private static void ImportMvdConcept(Concept mvdNode, DocTemplateUsage docUse, DocProject docProject, Dictionary<Guid, ExchangeRequirement> mapExchange)
        {
            // special case for attributes                            
            DocTemplateDefinition docTemplateDef = docProject.GetTemplate(mvdNode.Template.Ref);
            if (docTemplateDef != null)
            {
                // lookup use definition
                docUse.Uuid = mvdNode.Uuid;
                docUse.Name = mvdNode.Name;
                docUse.Definition = docTemplateDef;
                docUse.Override = mvdNode.Override;

                // content
                if (mvdNode.Definitions != null)
                {
                    foreach (Definition mvdDef in mvdNode.Definitions)
                    {
                        if (mvdDef.Body != null)
                        {
                            docUse.Documentation = mvdDef.Body.Content;
                        }
                    }
                }

                // exchange requirements
                foreach (ConceptRequirement mvdReq in mvdNode.Requirements)
                {
                    ExchangeRequirement mvdExchange = null;
                    if (mapExchange.TryGetValue(mvdReq.ExchangeRequirement, out mvdExchange))
                    {
                        DocExchangeItem docReq = new DocExchangeItem();
                        docUse.Exchanges.Add(docReq);

                        foreach (DocModelView docModel in docProject.ModelViews)
                        {
                            foreach (DocExchangeDefinition docAnno in docModel.Exchanges)
                            {
                                if (docAnno.Uuid.Equals(mvdReq.ExchangeRequirement))
                                {
                                    docReq.Exchange = docAnno;
                                    break;
                                }
                            }
                        }

                        docReq.Applicability = (DocExchangeApplicabilityEnum)mvdReq.Applicability;
                        docReq.Requirement = (DocExchangeRequirementEnum)mvdReq.Requirement;
                    }
                }

                // rules as template items
                if (mvdNode.TemplateRules != null)
                {
                    docUse.Operator = (DocTemplateOperator)Enum.Parse(typeof(DocTemplateOperator), mvdNode.TemplateRules.Operator.ToString());
                    foreach (TemplateRule rule in mvdNode.TemplateRules.TemplateRule)
                    {
                        DocTemplateItem docItem = ImportMvdItem(rule, docProject, mapExchange);
                        docUse.Items.Add(docItem);
                    }

                    if (mvdNode.TemplateRules.InnerRules != null)
                    {
                        mvdNode.ToString();
                    }
                }

            }
        }