if (!slicer.getSlicing().hasDiscriminator()) return false; // cannot validate in this case for (ElementDefinitionSlicingDiscriminatorComponent s : slicer.getSlicing().getDiscriminator()) { String discriminator = s.getPath(); if (s.getType() == DiscriminatorType.PROFILE)
boolean childUnsupportedSlicing = false; boolean process = true; if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) slicingPath = ed.getPath(); else if (slicingPath!=null && ed.getPath().equals(slicingPath)) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); else if (!unsupportedSlicing) if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND))) hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); else if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND))) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order in ordered slice"); if (ei.definition == null || !isXmlAttr)
private boolean standardExtensionSlicing(ElementDefinition element) { String t = tail(element.getPath()); return (t.equals("extension") || t.equals("modifierExtension")) && element.getSlicing().getRules() != SlicingRules.CLOSED && element.getSlicing().getDiscriminator().size() == 1 && element.getSlicing().getDiscriminator().get(0).getPath().equals("url") && element.getSlicing().getDiscriminator().get(0).getType().equals(DiscriminatorType.VALUE); }
private String sliceSummary(ElementDefinition ed) { if (!ed.hasSlicing() && !ed.hasSliceName()) return ""; if (ed.hasSliceName()) return " (slicename = "+ed.getSliceName()+")"; StringBuilder b = new StringBuilder(); boolean first = true; for (ElementDefinitionSlicingDiscriminatorComponent d : ed.getSlicing().getDiscriminator()) { if (first) first = false; else b.append("|"); b.append(d.getPath()); } return " (slicing by "+b.toString()+")"; }
private void determineSlicing(ElementDefinition slicer, List<ElementDefinition> slices) { // first, name them int i = 0; for (ElementDefinition ed : slices) { if (ed.hasUserData("slice-name")) { ed.setSliceName(ed.getUserString("slice-name")); } else { i++; ed.setSliceName("slice-"+Integer.toString(i)); } } // now, the hard bit, how are they differentiated? // right now, we hard code this... if (slicer.getPath().endsWith(".extension") || slicer.getPath().endsWith(".modifierExtension")) slicer.getSlicing().addDiscriminator().setType(DiscriminatorType.VALUE).setPath("url"); else if (slicer.getPath().equals("DiagnosticReport.result")) slicer.getSlicing().addDiscriminator().setType(DiscriminatorType.VALUE).setPath("reference.code"); else if (slicer.getPath().equals("Observation.related")) slicer.getSlicing().addDiscriminator().setType(DiscriminatorType.VALUE).setPath("target.reference.code"); else if (slicer.getPath().equals("Bundle.entry")) slicer.getSlicing().addDiscriminator().setType(DiscriminatorType.VALUE).setPath("resource.@profile"); else throw new Error("No slicing for "+slicer.getPath()); }
tgt.addCode(convertCoding(t)); if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); tgt.setShort(src.getShort()); tgt.setDefinition(src.getDefinition());
if (!slicer.getSlicing().hasDiscriminator()) return false; // cannot validate in this case for (ElementDefinitionSlicingDiscriminatorComponent s : slicer.getSlicing().getDiscriminator()) { String discriminator = s.getPath(); if (s.getType() == DiscriminatorType.PROFILE)
slicer = new ElementDefinition(); slicer.setPath(edi.getPath()); slicer.getSlicing().setRules(SlicingRules.OPEN); sd.getDifferential().getElement().add(c, slicer); c++;
tgt.addCode(convertCoding(t)); if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); if (src.hasShort()) tgt.setShort(src.getShort());
int ndc = differential.getElement().indexOf(diffMatches.get(0)); int ndl = findEndOfElement(differential, ndc); processPaths(indent+" ", result, base, differential, baseCursor, ndc, nbl, ndl, url, profileName+pathTail(diffMatches, 0), contextPathSrc, contextPathDst, trimDifferential, contextName, resultPathBase, true).setSlicing(diffMatches.get(0).getSlicing()); start++; } else { outcome.setSlicing(makeExtensionSlicing()); else outcome.setSlicing(diffMatches.get(0).getSlicing().copy()); if (!outcome.getPath().startsWith(resultPathBase)) throw new DefinitionException("Adding wrong path"); boolean closed = currentBase.getSlicing().getRules() == SlicingRules.CLOSED; int diffpos = 0; boolean isExtension = cpath.endsWith(".extension") || cpath.endsWith(".modifierExtension"); if (!isExtension) ElementDefinitionSlicingComponent dSlice = diffMatches.get(0).getSlicing(); ElementDefinitionSlicingComponent bSlice = currentBase.getSlicing(); if (dSlice.hasOrderedElement() && bSlice.hasOrderedElement() && !orderMatches(dSlice.getOrderedElement(), bSlice.getOrderedElement())) throw new DefinitionException("Slicing rules on differential ("+summariseSlicing(dSlice)+") do not match those on base ("+summariseSlicing(bSlice)+") - order @ "+path+" ("+contextName+")"); updateFromBase(outcome, currentBase); if (diffMatches.get(0).hasSlicing() /*&& !isExtension*/) { updateFromSlicing(outcome.getSlicing(), diffMatches.get(0).getSlicing()); updateFromDefinition(outcome, diffMatches.get(0), profileName, closed, url); // if there's no slice, we don't want to update the unsliced description } else if (!diffMatches.get(0).hasSliceName())
boolean childUnsupportedSlicing = false; boolean process = true; if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) slicingPath = ed.getPath(); else if (slicingPath!=null && ed.getPath().equals(slicingPath)) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); else if (!unsupportedSlicing) if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND))) hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); else if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPENATEND))) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order in ordered slice"); if (ei.definition == null || !isXmlAttr)
if (child.hasSlicing()) { sliceName = name; slicing = child.getSlicing(); } else if (!name.equals(sliceName)) slicing = null;
if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Slice: ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null));
if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, translate("sd.table", "Slice")+": ", null).addStyle("font-weight:bold")); c.getPieces().add(gen.new Piece(null, describeSlice(definition.getSlicing()), null));
line.addString(itemList(ed.getSlicing().getDiscriminator())); line.addString(ed.getSlicing().getDescription()); line.addBoolean(ed.getSlicing().getOrdered()); line.addString(ed.getSlicing().getRules()!=null ? ed.getSlicing().getRules().toCode() : ""); } else { line.addValue("");
case 102727412: return getLabelElement(); case 3059181: return addCode(); case -2119287345: return getSlicing(); case 109413500: return getShortElement(); case -1014418093: return getDefinitionElement();
tgt.addCode(convertCoding(t)); if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); tgt.setShort(src.getShort()); tgt.setDefinition(src.getDefinition());
tgt.addCode(convertCoding(t)); if (src.hasSlicing()) tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); if (src.hasShort()) tgt.setShort(src.getShort());