private boolean isPrimitiveType(String code) { StructureDefinition sd = context.fetchTypeDefinition(code); return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; }
public void checkAllInvariants(){ for (StructureDefinition sd : context.allStructures()) { if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { for (ElementDefinition ed : sd.getSnapshot().getElement()) { for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { if (inv.hasExpression()) { try { ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); if (n == null) { n = fpe.parse(inv.getExpression()); inv.setUserData("validator.expression.cache", n); } fpe.check(null, sd.getKind() == StructureDefinitionKind.RESOURCE ? sd.getType() : "DomainResource", ed.getPath(), n); } catch (Exception e) { System.out.println("Error processing structure ["+sd.getId()+"] path "+ed.getPath()+":"+inv.getKey()+" (\""+inv.getExpression()+"\"): "+e.getMessage()); } } } } } } }
String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType();
private boolean isDataType(String value) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+value); return sd != null && sd.getKind() == StructureDefinitionKind.COMPLEXTYPE; }
public boolean isPrimitive(String value) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+value); return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; }
/** * Is the given type a primitive * * @param E.g. "integer" */ public boolean isPrimitive(String code) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code); return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; }
private boolean isPrimitiveType(String code) { StructureDefinition sd = context.fetchTypeDefinition(code); return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; }
if (tgt.hasDifferential()) tgt.getDifferential().getElementFirstRep().getType().clear(); if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType());
public boolean isResource() { if (definition.getType().size() > 0) return definition.getType().size() == 1 && ("Resource".equals(definition.getType().get(0).getCode()) || "DomainResource".equals(definition.getType().get(0).getCode())); else return !definition.getPath().contains(".") && structure.getKind() == StructureDefinitionKind.RESOURCE; }
/** * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined) */ public FHIRPathEngine(IWorkerContext worker) { super(); this.worker = worker; for (StructureDefinition sd : worker.allStructures()) { if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) allTypes.put(sd.getName(), sd); if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { primitiveTypes.add(sd.getName()); } } }
public boolean IsLogicalAndHasPrimitiveValue(String name) { // if (canBePrimitive!= null) // return canBePrimitive; canBePrimitive = false; if (structure.getKind() != StructureDefinitionKind.LOGICAL) return false; if (!hasType(name)) return false; StructureDefinition sd = context.fetchResource(StructureDefinition.class, structure.getUrl().substring(0, structure.getUrl().lastIndexOf("/")+1)+getType(name)); if (sd == null) sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+getType(name)); if (sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) return true; if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL) return false; for (ElementDefinition ed : sd.getSnapshot().getElement()) { if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && isPrimitive(ed.getType().get(0).getCode())) { canBePrimitive = true; return true; } } return false; }
for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); tgt.setKind(convertStructureDefinitionKind(src.getKind())); tgt.setAbstract(src.getAbstract()); tgt.setContextType(convertExtensionContext(src.getContextType()));
private Element convertElement(Property property, Base base) throws FHIRException { if (base == null) return null; String tn = base.fhirType(); StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+tn); if (sd == null) throw new FHIRException("Unable to find definition for type "+tn); Element res = new Element(property.getName(), property); if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) res.setValue(((PrimitiveType) base).asStringValue()); List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElementFirstRep()); for (ElementDefinition child : children) { String n = tail(child.getPath()); if (sd.getKind() != StructureDefinitionKind.PRIMITIVETYPE || !"value".equals(n)) { Base[] values = base.getProperty(n.hashCode(), n, false); if (values != null) for (Base value : values) { res.getChildren().add(convertElement(new Property(context, child, sd), value)); } } } return res; }
String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType();
public void checkAllInvariants(){ for (StructureDefinition sd : context.allStructures()) { if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { for (ElementDefinition ed : sd.getSnapshot().getElement()) { for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { if (inv.hasExpression()) { try { ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); if (n == null) { n = fpe.parse(inv.getExpression()); inv.setUserData("validator.expression.cache", n); } fpe.check(null, sd.getKind() == StructureDefinitionKind.RESOURCE ? sd.getType() : "DomainResource", ed.getPath(), n); } catch (Exception e) { System.out.println("Error processing structure ["+sd.getId()+"] path "+ed.getPath()+":"+inv.getKey()+" (\""+inv.getExpression()+"\"): "+e.getMessage()); } } } } } } }
for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); tgt.setKind(convertStructureDefinitionKind(src.getKind())); tgt.setAbstract(src.getAbstract()); tgt.setContextType(convertExtensionContext(src.getContextType()));
profile.setCopyright(map.getCopyright()); profile.setFhirVersion(Constants.VERSION); profile.setKind(prop.getBaseProperty().getStructure().getKind()); profile.setAbstract(false); ElementDefinition ed = profile.getDifferential().addElement();
if (tgt.hasDifferential()) tgt.getDifferential().getElementFirstRep().getType().clear(); if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType());
for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); tgt.setKind(convertStructureDefinitionKind(src.getKind())); tgt.setAbstract(src.getAbstract()); tgt.setContextType(convertExtensionContext(src.getContextType()));
for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) tgt.addMapping(convertStructureDefinitionMappingComponent(t)); tgt.setKind(convertStructureDefinitionKind(src.getKind())); tgt.setAbstract(src.getAbstract()); tgt.setContextType(convertExtensionContext(src.getContextType()));