示例#1
0
        private Cell generateDescription(HierarchicalTableGenerator gen, Row row, Profile.ElementComponent element, Profile.ElementDefinitionComponent fallback, bool used, String baseURL, String profileUrl, Profile profile)
        {
            Cell c = new Cell();

            row.getCells().Add(c);

            if (used)
            {
                if (element.Definition != null && element.Definition.Short != null)
                {
                    if (c.getPieces().Any())
                    {
                        c.addPiece(new Piece("br"));
                    }
                    c.addPiece(new Piece(null, element.Definition.Short, null));
                }
                else if (fallback != null && fallback.Short != null)
                {
                    if (c.getPieces().Any())
                    {
                        c.addPiece(new Piece("br"));
                    }
                    c.addPiece(new Piece(null, fallback.Short, null));
                }

                if (profileUrl != null)
                {
                    if (c.getPieces().Any())
                    {
                        c.addPiece(new Piece("br"));
                    }
                    String fullUrl   = profileUrl.StartsWith("#") ? baseURL + profileUrl : profileUrl;
                    String reference = _pkp.getLinkForExtension(profile, profileUrl);
                    c.getPieces().Add(new Piece(null, "URL: ", null).addStyle("font-weight:bold"));
                    c.getPieces().Add(new Piece(reference, fullUrl, null));
                }

                if (element.Slicing != null)
                {
                    if (c.getPieces().Any())
                    {
                        c.addPiece(new Piece("br"));
                    }
                    c.getPieces().Add(new Piece(null, "Slice: ", null).addStyle("font-weight:bold"));
                    c.getPieces().Add(new Piece(null, describeSlice(element.Slicing), null));
                }

                if (element.Definition != null)
                {
                    if (element.Definition.Binding != null)
                    {
                        if (c.getPieces().Any())
                        {
                            c.addPiece(new Piece("br"));
                        }
                        String reference = _pkp.resolveBinding(element.Definition.Binding);
                        c.getPieces().Add(new Piece(null, "Binding: ", null).addStyle("font-weight:bold"));
                        c.getPieces().Add(new Piece(reference, element.Definition.Binding.Name, null));
                    }

                    if (element.Definition.Constraint != null)
                    {
                        foreach (Profile.ElementDefinitionConstraintComponent inv in element.Definition.Constraint)
                        {
                            if (c.getPieces().Any())
                            {
                                c.addPiece(new Piece("br"));
                            }
                            c.getPieces().Add(new Piece(null, "Inv-" + inv.Key + ": ", null).addStyle("font-weight:bold"));
                            c.getPieces().Add(new Piece(null, inv.Human, null));
                        }
                    }

                    if (element.Definition.Value != null)
                    {
                        if (c.getPieces().Any())
                        {
                            c.addPiece(new Piece("br"));
                        }
                        c.getPieces().Add(new Piece(null, "Fixed Value: ", null).addStyle("font-weight:bold"));
                        c.getPieces().Add(new Piece(null, element.Definition.Value.RenderValue(), null));
                    }

                    // ?? example from definition
                }
            }

            return(c);
        }
示例#2
0
        private void genTypes(HierarchicalTableGenerator gen, Row r, Profile.ElementDefinitionComponent elementDefn, String profileBaseFileName, Profile profile)
        {
            Cell c = new Cell();

            r.getCells().Add(c);

            if (elementDefn.Type == null)
            {
                return;
            }

            bool first = true;

            foreach (Profile.TypeRefComponent t in elementDefn.Type)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    c.addPiece(new Piece(null, ", ", null));
                }

                if (t.Code == "ResourceReference" || (t.Code == "Resource" && t.Profile != null))
                {
                    if (t.Profile.StartsWith("http://hl7.org/fhir/Profile/"))
                    {
                        String rn = t.Profile.Substring(28);
                        c.addPiece(new Piece(_pkp.getLinkFor(rn), rn, null));
                    }
                    else if (t.Profile.StartsWith("#"))
                    {
                        c.addPiece(new Piece(profileBaseFileName + "." + t.Profile.Substring(1).ToLower() + ".html", t.Profile, null));
                    }
                    else
                    {
                        c.addPiece(new Piece(t.Profile, t.Profile, null));
                    }
                }
                else if (t.Profile != null)
                { // a profiled type
                    String reference = _pkp.getLinkForProfile(profile, t.Profile);
                    if (reference != null)
                    {
                        String[] parts = reference.Split('|');      //TODO: Not too sure, was: String[] parts = ref.split("\\|"); in Java
                        c.addPiece(new Piece(parts[0], parts[1], t.Code));
                    }
                    else
                    {
                        c.addPiece(new Piece(reference, t.Code, null));
                    }
                }
                else if (_pkp.hasLinkFor(t.Code))
                {
                    c.addPiece(new Piece(_pkp.getLinkFor(t.Code), t.Code, null));
                }
                else
                {
                    c.addPiece(new Piece(null, t.Code, null));
                }
            }
        }
        private Cell generateDescription(HierarchicalTableGenerator gen, Row row, Profile.ElementComponent element, Profile.ElementDefinitionComponent fallback, 
            bool used, String extensionUrl, Profile profile)
        {
            Cell c = new Cell();
            row.getCells().Add(c);

            if (used)
            {
                if (element.Definition != null && element.Definition.Short != null)
                {
                    if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                    c.addPiece(new Piece(null, element.Definition.Short, null));
                }
                else if (fallback != null && fallback.Short != null)
                {
                    if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                    c.addPiece(new Piece(null, fallback.Short, null));
                }

                if (extensionUrl != null)
                {
                    if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                    String fullUrl = extensionUrl;      
                    String reference = _pkp.GetLinkForExtensionDefinition(profile, extensionUrl);
                    c.getPieces().Add(new Piece(null, "URL: ", null).addStyle("font-weight:bold"));
                    c.getPieces().Add(new Piece(reference, fullUrl, null));
                }

                if (element.Slicing != null)
                {
                    if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                    c.getPieces().Add(new Piece(null, "Slice: ", null).addStyle("font-weight:bold"));
                    c.getPieces().Add(new Piece(null, describeSlice(element.Slicing), null));
                }

                if (element.Definition != null)
                {
                    if (element.Definition.Binding != null)
                    {
                        if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                        String reference = _pkp.GetLinkForBinding(element.Definition.Binding);
                        c.getPieces().Add(new Piece(null, "Binding: ", null).addStyle("font-weight:bold"));
                        c.getPieces().Add(new Piece(reference, element.Definition.Binding.Name, null));
                    }

                    if (element.Definition.Constraint != null)
                    {
                        foreach (Profile.ElementDefinitionConstraintComponent inv in element.Definition.Constraint)
                        {
                            if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                            c.getPieces().Add(new Piece(null, "Inv-" + inv.Key + ": ", null).addStyle("font-weight:bold"));
                            c.getPieces().Add(new Piece(null, inv.Human, null));
                        }
                    }

                    if (element.Definition.Value != null)
                    {
                        if (c.getPieces().Any()) c.addPiece(new Piece("br"));
                        c.getPieces().Add(new Piece(null, "Fixed Value: ", null).addStyle("font-weight:bold"));
                        c.getPieces().Add(new Piece(null, element.Definition.Value.ForDisplay(), null));
                    }

                    // ?? example from definition    
                }
            }

            return c;
        }
        private void genTypes(HierarchicalTableGenerator gen, Row r, Profile.ElementDefinitionComponent elementDefn, Profile profile)
        {
            Cell c = new Cell();
            r.getCells().Add(c);

            if (elementDefn.Type == null) return;

            bool first = true;
            foreach (Profile.TypeRefComponent t in elementDefn.Type)
            {
                if (first)
                    first = false;
                else
                    c.addPiece(new Piece(null, ", ", null));

                if (t.Code == "ResourceReference" || (t.Code == "Resource" && t.Profile != null))
                {
                    var reference = _pkp.GetLinkForProfileReference(profile, t.Profile);
                    var label = _pkp.GetLabelForProfileReference(profile, t.Profile);

                    if (t.Profile.StartsWith("http://hl7.org/fhir/Profile/"))
                    {
                        String rn = t.Profile.Substring(28);
                        c.addPiece(new Piece(_pkp.GetLinkForTypeDocu(rn), rn, null));
                    }
                    else if (t.Profile.StartsWith("#"))
                        c.addPiece(new Piece(_pkp.GetLinkForLocalStructure(profile, t.Profile.Substring(1)), t.Profile, null));
                    else
                        c.addPiece(new Piece(t.Profile, t.Profile, null));
                }
                else if (t.Profile != null)
                { // a profiled type
                    var reference = _pkp.GetLinkForProfileReference(profile, t.Profile);
                    var label = _pkp.GetLabelForProfileReference(profile, t.Profile);

                    if (reference != null)
                    {
                        String[] parts = reference.Split('|');      //TODO: Not too sure, was: String[] parts = ref.split("\\|"); in Java
                        c.addPiece(new Piece(reference,label,t.Code));
                    }
                    else
                        c.addPiece(new Piece(reference, t.Code, null));
                }
                else if (_pkp.HasLinkForTypeDocu(t.Code))
                {
                    c.addPiece(new Piece(_pkp.GetLinkForTypeDocu(t.Code), t.Code, null));
                }
                else
                    c.addPiece(new Piece(null, t.Code, null));
            }
        }
        private void genTypes(HierarchicalTableGenerator gen, Row r, Profile.ElementDefinitionComponent elementDefn, Profile profile)
        {
            Cell c = new Cell();

            r.getCells().Add(c);

            if (elementDefn.Type == null)
            {
                return;
            }

            bool first = true;

            foreach (Profile.TypeRefComponent t in elementDefn.Type)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    c.addPiece(new Piece(null, ", ", null));
                }

                if (t.Code == "ResourceReference" || (t.Code == "Resource" && t.Profile != null))
                {
                    var reference = _pkp.GetLinkForProfileReference(profile, t.Profile);
                    var label     = _pkp.GetLabelForProfileReference(profile, t.Profile);

                    if (t.Profile.StartsWith("http://hl7.org/fhir/Profile/"))
                    {
                        String rn = t.Profile.Substring(28);
                        c.addPiece(new Piece(_pkp.GetLinkForTypeDocu(rn), rn, null));
                    }
                    else if (t.Profile.StartsWith("#"))
                    {
                        c.addPiece(new Piece(_pkp.GetLinkForLocalStructure(profile, t.Profile.Substring(1)), t.Profile, null));
                    }
                    else
                    {
                        c.addPiece(new Piece(t.Profile, t.Profile, null));
                    }
                }
                else if (t.Profile != null)
                { // a profiled type
                    var reference = _pkp.GetLinkForProfileReference(profile, t.Profile);
                    var label     = _pkp.GetLabelForProfileReference(profile, t.Profile);

                    if (reference != null)
                    {
                        String[] parts = reference.Split('|');      //TODO: Not too sure, was: String[] parts = ref.split("\\|"); in Java
                        c.addPiece(new Piece(reference, label, t.Code));
                    }
                    else
                    {
                        c.addPiece(new Piece(reference, t.Code, null));
                    }
                }
                else if (_pkp.HasLinkForTypeDocu(t.Code))
                {
                    c.addPiece(new Piece(_pkp.GetLinkForTypeDocu(t.Code), t.Code, null));
                }
                else
                {
                    c.addPiece(new Piece(null, t.Code, null));
                }
            }
        }
        private void genTypes(HierarchicalTableGenerator gen, Row r, Profile.ElementDefinitionComponent elementDefn, String profileBaseFileName, Profile profile)
        {
            Cell c = new Cell();
            r.getCells().Add(c);

            if (elementDefn.Type == null) return;

            bool first = true;
            foreach (Profile.TypeRefComponent t in elementDefn.Type)
            {
                if (first)
                    first = false;
                else
                    c.addPiece(new Piece(null, ", ", null));

                if (t.Code == "ResourceReference" || (t.Code == "Resource" && t.Profile != null))
                {
                    if (t.Profile.StartsWith("http://hl7.org/fhir/Profile/"))
                    {
                        String rn = t.Profile.Substring(28);
                        c.addPiece(new Piece(_pkp.getLinkFor(rn), rn, null));
                    }
                    else if (t.Profile.StartsWith("#"))
                        c.addPiece(new Piece(profileBaseFileName + "." + t.Profile.Substring(1).ToLower() + ".html", t.Profile, null));
                    else
                        c.addPiece(new Piece(t.Profile, t.Profile, null));
                }
                else if (t.Profile != null)
                { // a profiled type
                    String reference = _pkp.getLinkForProfile(profile, t.Profile);
                    if (reference != null)
                    {
                        String[] parts = reference.Split('|');      //TODO: Not too sure, was: String[] parts = ref.split("\\|"); in Java
                        c.addPiece(new Piece(parts[0], parts[1], t.Code));
                    }
                    else
                        c.addPiece(new Piece(reference, t.Code, null));
                }
                else if (_pkp.hasLinkFor(t.Code))
                {
                    c.addPiece(new Piece(_pkp.getLinkFor(t.Code), t.Code, null));
                }
                else
                    c.addPiece(new Piece(null, t.Code, null));
            }
        }