Java Code Examples for org.hl7.fhir.dstu3.model.ValueSet#setStatus()
The following examples show how to use
org.hl7.fhir.dstu3.model.ValueSet#setStatus() .
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: ProfileComparer.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private ValueSet intersectByExpansion(ValueSet lvs, ValueSet rvs) { // this is pretty straight forward - we intersect the lists, and build a compose out of the intersection ValueSet vs = new ValueSet(); vs.setStatus(PublicationStatus.DRAFT); Map<String, ValueSetExpansionContainsComponent> left = new HashMap<String, ValueSetExpansionContainsComponent>(); scan(lvs.getExpansion().getContains(), left); Map<String, ValueSetExpansionContainsComponent> right = new HashMap<String, ValueSetExpansionContainsComponent>(); scan(rvs.getExpansion().getContains(), right); Map<String, ConceptSetComponent> inc = new HashMap<String, ConceptSetComponent>(); for (String s : left.keySet()) { if (right.containsKey(s)) { ValueSetExpansionContainsComponent cc = left.get(s); ConceptSetComponent c = inc.get(cc.getSystem()); if (c == null) { c = vs.getCompose().addInclude().setSystem(cc.getSystem()); inc.put(cc.getSystem(), c); } c.addConcept().setCode(cc.getCode()).setDisplay(cc.getDisplay()); } } return vs; }
Example 2
Source File: QuestionnaireBuilder.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private ValueSet makeTypeList(StructureDefinition profile, List<TypeRefComponent> types, String path) { ValueSet vs = new ValueSet(); vs.setName("Type options for "+path); vs.setDescription(vs.getName()); vs.setStatus(PublicationStatus.ACTIVE); vs.setExpansion(new ValueSetExpansionComponent()); vs.getExpansion().setIdentifier(Factory.createUUID()); vs.getExpansion().setTimestampElement(DateTimeType.now()); for (TypeRefComponent t : types) { ValueSetExpansionContainsComponent cc = vs.getExpansion().addContains(); if (t.getCode().equals("Reference") && (t.hasTargetProfile() && t.getTargetProfile().startsWith("http://hl7.org/fhir/StructureDefinition/"))) { cc.setCode(t.getTargetProfile().substring(40)); cc.setSystem("http://hl7.org/fhir/resource-types"); cc.setDisplay(cc.getCode()); } else { ProfileUtilities pu = new ProfileUtilities(context, null, null); StructureDefinition ps = null; if (t.hasTargetProfile()) ps = pu.getProfile(profile, t.getTargetProfile()); else if (t.hasProfile()) ps = pu.getProfile(profile, t.getProfile()); if (ps != null) { cc.setCode(t.getTargetProfile()); cc.setDisplay(ps.getType()); cc.setSystem("http://hl7.org/fhir/resource-types"); } else { cc.setCode(t.getCode()); cc.setDisplay(t.getCode()); cc.setSystem("http://hl7.org/fhir/data-types"); } } t.setUserData("text", cc.getCode()); } return vs; }