Java Code Examples for org.hl7.fhir.r4.model.StructureDefinition#getDerivation()
The following examples show how to use
org.hl7.fhir.r4.model.StructureDefinition#getDerivation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected StructureDefinition getDefinition(int line, int col, String ns, String name) throws FHIRFormatError { if (ns == null) { logError(line, col, name, IssueType.STRUCTURE, "This cannot be parsed as a FHIR object (no namespace)", IssueSeverity.FATAL); return null; } if (name == null) { logError(line, col, name, IssueType.STRUCTURE, "This cannot be parsed as a FHIR object (no name)", IssueSeverity.FATAL); return null; } for (StructureDefinition sd : context.allStructures()) { if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && !sd.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition/de-")) { if(name.equals(sd.getType()) && (ns == null || ns.equals(FormatUtilities.FHIR_NS)) && !ToolingExtensions.hasExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace")) return sd; String sns = ToolingExtensions.readStringExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"); if (name.equals(sd.getType()) && ns != null && ns.equals(sns)) return sd; } } logError(line, col, name, IssueType.STRUCTURE, "This does not appear to be a FHIR resource (unknown namespace/name '"+ns+"::"+name+"')", IssueSeverity.FATAL); return null; }
Example 2
Source File: SimpleWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public List<String> getResourceNames() { List<String> result = new ArrayList<String>(); for (StructureDefinition sd : listStructures()) { if (sd.getKind() == StructureDefinitionKind.RESOURCE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) result.add(sd.getName()); } Collections.sort(result); return result; }
Example 3
Source File: SimpleWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public List<String> getTypeNames() { List<String> result = new ArrayList<String>(); for (StructureDefinition sd : listStructures()) { if (sd.getKind() != StructureDefinitionKind.LOGICAL && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) result.add(sd.getName()); } Collections.sort(result); return result; }
Example 4
Source File: SimpleWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
@Override public boolean isResource(String t) { StructureDefinition sd; try { sd = fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t); } catch (Exception e) { return false; } if (sd == null) return false; if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT) return false; return sd.getKind() == StructureDefinitionKind.RESOURCE; }
Example 5
Source File: ExtensionDefinitionGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private List<StructureDefinition> buildExtensions(List<StructureDefinition> definitions) throws DefinitionException, FHIRException { Set<String> types = new HashSet<>(); List<StructureDefinition> list = new ArrayList<>(); for (StructureDefinition type : definitions) if (type.getDerivation() == TypeDerivationRule.SPECIALIZATION && !type.getName().contains(".") && !types.contains(type.getName()) && type.getKind() != StructureDefinitionKind.PRIMITIVETYPE && !Utilities.existsInList(type.getName(), "Extension", "Narrative")) { types.add(type.getName()); buildExtensions(type, list); } return list; }
Example 6
Source File: SnapShotGenerationTests.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
@Override public boolean isDatatype(String name) { StructureDefinition sd = TestingUtilities.context().fetchTypeDefinition(name); return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE || sd.getKind() == StructureDefinitionKind.COMPLEXTYPE); }
Example 7
Source File: SnapShotGenerationTests.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
@Override public boolean isResource(String typeSimple) { StructureDefinition sd = TestingUtilities.context().fetchTypeDefinition(typeSimple); return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.RESOURCE); }