private String getParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) { Type p = parameter.getValue(); if (p == null || !(p instanceof IdType)) return null; return p.primitiveValue(); }
private String getParamString(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) { Type p = parameter.getValue(); if (p == null || p instanceof IdType) return null; if (!p.hasPrimitiveValue()) return null; return p.primitiveValue(); }
public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) { List<String> res = new ArrayList<String>(); for (ConceptPropertyComponent p : c.getProperty()) { if ("parent".equals(p.getCode())) { res.add(p.getValue().primitiveValue()); } } return res; }
private boolean isParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) { Type p = parameter.getValue(); if (p == null || !(p instanceof IdType)) return false; return vars.get(null, p.primitiveValue()) != null; }
public String getExtensionString(String theUrl) throws FHIRException { List<Extension> ext = getExtensionsByUrl(theUrl); if (ext.isEmpty()) return null; if (ext.size() > 1) throw new FHIRException("Multiple matching extensions found"); if (!ext.get(0).getValue().isPrimitive()) throw new FHIRException("Extension could not be converted to a string"); return ext.get(0).getValue().primitiveValue(); }
public boolean getParameterBool(String name) { for (ParametersParameterComponent p : getParameter()) { if (p.getName().equals(name)) { if (p.getValue() instanceof BooleanType) return ((BooleanType) p.getValue()).booleanValue(); boolean ok = Boolean.getBoolean(p.getValue().primitiveValue()); return ok; } } return false; }
private String getFixedUrl(StructureDefinition sd) { for (ElementDefinition ed : sd.getSnapshot().getElement()) { if (ed.getPath().equals("Extension.url")) { if (ed.hasFixed() && ed.getFixed() instanceof UriType) return ed.getFixed().primitiveValue(); } } return null; }
private void produceAttribute(StructureDefinition sd, ElementDefinition ed, ElementDefinition edc, String lang) throws IOException, FHIRException { TypeRefComponent t = edc.getTypeFirstRep(); String name = tailDot(edc.getPath()); String min = String.valueOf(edc.getMin()); String max = edc.getMax(); // todo: check it's a code... // if (!max.equals("1")) // throw new FHIRException("Illegal cardinality \""+max+"\" for attribute "+edc.getPath()); if (Utilities.isAbsoluteUrl(t.getCode())) throw new FHIRException("Only FHIR primitive types are supported for attributes ("+t.getCode()+")"); String typeNs = namespaces.get("http://hl7.org/fhir"); String type = t.getCode(); w(" <xs:attribute name=\""+name+"\" use=\""+(min.equals("0") || edc.hasFixed() || edc.hasDefaultValue() ? "optional" : "required")+"\" type=\""+typeNs+":"+type+(typeNs.equals("fhir") ? "-primitive" : "")+"\""+ (edc.hasFixed() ? " fixed=\""+edc.getFixed().primitiveValue()+"\"" : "")+(edc.hasDefaultValue() && !edc.hasFixed() ? " default=\""+edc.getDefaultValue().primitiveValue()+"\"" : "")+""); if (annotations && edc.hasDefinition()) { ln(">"); ln(" <xs:annotation>"); ln(" <xs:documentation xml:lang=\""+lang+"\">"+Utilities.escapeXml(edc.getDefinition())+"</xs:documentation>"); ln(" </xs:annotation>"); ln(" </xs:attribute>"); } else ln("/>"); }
if(ed.hasMinValue()) { Type mv = ed.getMinValue(); facets.append(tmplt(MINVALUE_TEMPLATE).add("val", mv.primitiveValue()).render()); facets.append(tmplt(MAXVALUE_TEMPLATE).add("val", mv.primitiveValue()).render()); facets.append(tmplt(PATTERN_TEMPLATE).add("val",pat.primitiveValue()).render());
/** * Generate a type reference and optional value set definition * @param sd Containing StructureDefinition * @param ed Element being defined * @param typ Element type * @return Type definition */ private String simpleElement(StructureDefinition sd, ElementDefinition ed, String typ) { String addldef = ""; ElementDefinition.ElementDefinitionBindingComponent binding = ed.getBinding(); if(binding.hasStrength() && binding.getStrength() == Enumerations.BindingStrength.REQUIRED && "code".equals(typ)) { ValueSet vs = resolveBindingReference(sd, binding.getValueSet()); if (vs != null) { addldef = tmplt(VALUESET_DEFN_TEMPLATE).add("vsn", vsprefix(vs.getUrl())).render(); required_value_sets.add(vs); } } // TODO: check whether value sets and fixed are mutually exclusive if(ed.hasFixed()) { addldef = tmplt(FIXED_VALUE_TEMPLATE).add("val", ed.getFixed().primitiveValue()).render(); } return tmplt(SIMPLE_ELEMENT_DEFN_TEMPLATE).add("typ", typ).add("vsdef", addldef).render(); }
public static org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); copyElement(src, tgt); tgt.setStrength(convertBindingStrength(src.getStrength())); Type t = convertType(src.getValueSet()); if (t != null) { if (t instanceof org.hl7.fhir.r4.model.Reference) tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); else tgt.setValueSet(t.primitiveValue()); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); } return tgt; }
public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); copyElement(src, tgt); tgt.setStrength(convertBindingStrength(src.getStrength())); Type t = convertType(src.getValueSet()); if (t != null) { if (t instanceof org.hl7.fhir.r4.model.Reference) tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); else tgt.setValueSet(t.primitiveValue()); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); } return tgt; }
public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); copyElement(src, tgt); tgt.setStrength(convertBindingStrength(src.getStrength())); tgt.setDescription(src.getDescription()); org.hl7.fhir.r4.model.Type vs = convertType(src.getValueSet()); if (vs != null) { tgt.setValueSet(vs instanceof org.hl7.fhir.r4.model.Reference ? ((org.hl7.fhir.r4.model.Reference) vs).getReference() : vs.primitiveValue()); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); } return tgt; }
private String getParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) { Type p = parameter.getValue(); if (p == null || !(p instanceof IdType)) return null; return p.primitiveValue(); }
public static org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); copyElement(src, tgt); tgt.setStrength(convertBindingStrength(src.getStrength())); if (src.hasDescription()) tgt.setDescription(src.getDescription()); if (src.hasValueSet()) { org.hl7.fhir.r4.model.Type t = convertType(src.getValueSet()); if (t instanceof org.hl7.fhir.r4.model.Reference) tgt.setValueSet(((org.hl7.fhir.r4.model.Reference) t).getReference()); else tgt.setValueSet(t.primitiveValue()); tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet())); } return tgt; }
public static List<String> getOtherChildren(CodeSystem cs, ConceptDefinitionComponent c) { List<String> res = new ArrayList<String>(); for (ConceptPropertyComponent p : c.getProperty()) { if ("parent".equals(p.getCode())) { res.add(p.getValue().primitiveValue()); } } return res; }
private String getParamString(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) { Type p = parameter.getValue(); if (p == null || p instanceof IdType) return null; if (!p.hasPrimitiveValue()) return null; return p.primitiveValue(); }
public String getExtensionString(String theUrl) throws FHIRException { List<Extension> ext = getExtensionsByUrl(theUrl); if (ext.isEmpty()) return null; if (ext.size() > 1) throw new FHIRException("Multiple matching extensions found"); if (!ext.get(0).getValue().isPrimitive()) throw new FHIRException("Extension could not be converted to a string"); return ext.get(0).getValue().primitiveValue(); }
public boolean getParameterBool(String name) { for (ParametersParameterComponent p : getParameter()) { if (p.getName().equals(name)) { if (p.getValue() instanceof BooleanType) return ((BooleanType) p.getValue()).booleanValue(); boolean ok = Boolean.getBoolean(p.getValue().primitiveValue()); return ok; } } return false; }
private String getFixedUrl(StructureDefinition sd) { for (ElementDefinition ed : sd.getSnapshot().getElement()) { if (ed.getPath().equals("Extension.url")) { if (ed.hasFixed() && ed.getFixed() instanceof UriType) return ed.getFixed().primitiveValue(); } } return null; }