public static string GetParentNameFromPath(this Profile.ElementComponent element)
 {
     return(ElementNavigator.GetParentPath(element.Path));
 }
 public static bool IsExtension(this Profile.ElementComponent elem)
 {
     return(elem.Path.EndsWith(".extension") || elem.Path.EndsWith(".modifierExtension"));
 }
        public static string GetNameFromPath(this Profile.ElementComponent element)
        {
            var pos = element.Path.LastIndexOf(".");

            return(pos != -1 ? element.Path.Substring(pos + 1) : element.Path);
        }
Exemplo n.º 4
0
 private bool onlyInformationIsMapping(List <Profile.ElementComponent> all, Profile.ElementComponent element)
 {
     return(false);
     //TODO: Port
 }
Exemplo n.º 5
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);
        }
 public abstract bool InsertAfter(Profile.ElementComponent sibling);
//----------------------------------
//
// Methods that alter the list of elements
//
//----------------------------------

        public abstract bool InsertBefore(Profile.ElementComponent sibling);
 public abstract bool InsertFirstChild(Profile.ElementComponent child);
        private Profile.ElementComponent createSliceEntry(Profile.ElementComponent baseDefn, Profile.ElementComponent diff)
        {
            var slicingEntry = new Profile.ElementComponent();

            slicingEntry.PathElement = (FhirString)baseDefn.PathElement.DeepCopy();
            if (diff.Name != null)
            {
                slicingEntry.NameElement = (FhirString)diff.NameElement.DeepCopy();
            }

            if (diff.Slicing != null)
            {
                slicingEntry.Slicing = (Profile.ElementSlicingComponent)diff.Slicing.DeepCopy();
            }

            slicingEntry.Definition = (Profile.ElementDefinitionComponent)baseDefn.Definition.DeepCopy();

            // If the differential overrides the elementdefn, only some of the fields go into the slicing entry
            if (diff.Definition != null)
            {
                if (diff.Definition.CommentsElement != null)
                {
                    slicingEntry.Definition.CommentsElement = (FhirString)diff.Definition.CommentsElement.DeepCopy();
                }
                if (diff.Definition.ShortElement != null)
                {
                    slicingEntry.Definition.ShortElement = (FhirString)diff.Definition.ShortElement.DeepCopy();
                }
                if (diff.Definition.FormalElement != null)
                {
                    slicingEntry.Definition.FormalElement = (FhirString)diff.Definition.FormalElement.DeepCopy();
                }
                if (diff.Definition.MinElement != null)
                {
                    slicingEntry.Definition.MinElement = (Integer)diff.Definition.MinElement.DeepCopy();
                }
                if (diff.Definition.MaxElement != null)
                {
                    slicingEntry.Definition.MaxElement = (FhirString)diff.Definition.MaxElement.DeepCopy();
                }
            }

            return(slicingEntry);
        }
 private bool isProfiledExtension(Profile.ElementComponent ec)
 {
     return(ec.Definition.Type != null && ec.Definition.Type.Count == 1 &&
            ec.Definition.Type[0].Code == "Extension" &&
            ec.Definition.Type[0].Profile != null);
 }