private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(List<ValueSetExpansionContainsComponent> contains, String theSystem, String theCode, Coding theCoding, CodeableConcept theCodeableConcept) { for (ValueSetExpansionContainsComponent nextCode : contains) { ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult result = validateCodeIsInContains(nextCode.getContains(), theSystem, theCode, theCoding, theCodeableConcept); if (result != null) { return result; } String system = nextCode.getSystem(); String code = nextCode.getCode(); if (isNotBlank(theCode)) { if (theCode.equals(code) && (isBlank(theSystem) || theSystem.equals(system))) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else if (theCoding != null) { if (StringUtils.equals(system, theCoding.getSystem()) && StringUtils.equals(code, theCoding.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else { for (Coding next : theCodeableConcept.getCoding()) { if (StringUtils.equals(system, next.getSystem()) && StringUtils.equals(code, next.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } } } return null; }
private void addConcepts(ConceptSetComponent theInclude, ValueSetExpansionComponent theRetVal, Set<String> theWantCodes, List<ConceptDefinitionComponent> theConcepts) { for (ConceptDefinitionComponent next : theConcepts) { if (theWantCodes.isEmpty() || theWantCodes.contains(next.getCode())) { theRetVal .addContains() .setSystem(theInclude.getSystem()) .setCode(next.getCode()) .setDisplay(next.getDisplay()); } addConcepts(theInclude, theRetVal, theWantCodes, next.getConcept()); } }
for (ConceptSetComponent nextInclude : theVs.getCompose().getInclude()) { for (ConceptReferenceComponent nextConcept : nextInclude.getConcept()) { expansion.getExpansion().addContains().setCode(nextConcept.getCode()).setDisplay(nextConcept.getDisplay()); String nextCode = next.getCode(); if (!caseSensitive) { nextCode = nextCode.toUpperCase(); if (theSystem == null || next.getSystem().equals(theSystem)) { ConceptDefinitionComponent definition = new ConceptDefinitionComponent(); definition.setCode(next.getCode()); definition.setDisplay(next.getDisplay()); ValidationResult retVal = new ValidationResult(definition); return retVal;
if (map.containsKey(key(c)) && !c.getAbstract()) { // we may have added abstract codes earlier while we still thought it might be heirarchical, but later we gave up, so now ignore them focus.getExpansion().getContains().add(c); c.getContains().clear(); // make sure any heirarchy is wiped
if (filters != null && !filters.isEmpty() && !filterContainsCode(filters, system, code)) return null; ValueSetExpansionContainsComponent n = new ValueSet.ValueSetExpansionContainsComponent(); n.setSystem(system); n.setCode(code); if (isAbstract) n.setAbstract(true); if (inactive) n.setInactive(true); n.setDisplay(display); else n.setDisplay(t.getValue()); parent.getContains().add(n); } else { roots.add(n);
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); for (ValueSetExpansionContainsComponent t : vse.getValueset().getExpansion().getContains()) { if (t.hasCode()) b.append(t.getCode()); if (code.equals(t.getCode()) && t.hasSystem()) { system = t.getSystem(); display = t.getDisplay(); break; if (code.equalsIgnoreCase(t.getDisplay()) && t.hasSystem()) { system = t.getSystem(); display = t.getDisplay(); break;
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -887328209: // system this.system = castToUri(value); // UriType return value; case 1732898850: // abstract this.abstract_ = castToBoolean(value); // BooleanType return value; case 24665195: // inactive this.inactive = castToBoolean(value); // BooleanType return value; case 351608024: // version this.version = castToString(value); // StringType return value; case 3059181: // code this.code = castToCode(value); // CodeType return value; case 1671764162: // display this.display = castToString(value); // StringType return value; case -900931593: // designation this.getDesignation().add((ConceptReferenceDesignationComponent) value); // ConceptReferenceDesignationComponent return value; case -567445985: // contains this.getContains().add((ValueSetExpansionContainsComponent) value); // ValueSetExpansionContainsComponent return value; default: return super.setProperty(hash, name, value); } }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("system")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.system"); } else if (name.equals("abstract")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.abstract"); } else if (name.equals("inactive")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.inactive"); } else if (name.equals("version")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.version"); } else if (name.equals("code")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.code"); } else if (name.equals("display")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.display"); } else if (name.equals("designation")) { return addDesignation(); } else if (name.equals("contains")) { return addContains(); } else return super.addChild(name); }
private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(List<ValueSetExpansionContainsComponent> contains, String theSystem, String theCode, Coding theCoding, CodeableConcept theCodeableConcept) { for (ValueSetExpansionContainsComponent nextCode : contains) { ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult result = validateCodeIsInContains(nextCode.getContains(), theSystem, theCode, theCoding, theCodeableConcept); if (result != null) { return result; } String system = nextCode.getSystem(); String code = nextCode.getCode(); if (isNotBlank(theCode)) { if (theCode.equals(code) && (isBlank(theSystem) || theSystem.equals(system))) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else if (theCoding != null) { if (StringUtils.equals(system, theCoding.getSystem()) && StringUtils.equals(code, theCoding.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } else { for (Coding next : theCodeableConcept.getCoding()) { if (StringUtils.equals(system, next.getSystem()) && StringUtils.equals(code, next.getCode())) { return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay()); } } } } return null; }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("system")) { this.system = castToUri(value); // UriType } else if (name.equals("abstract")) { this.abstract_ = castToBoolean(value); // BooleanType } else if (name.equals("inactive")) { this.inactive = castToBoolean(value); // BooleanType } else if (name.equals("version")) { this.version = castToString(value); // StringType } else if (name.equals("code")) { this.code = castToCode(value); // CodeType } else if (name.equals("display")) { this.display = castToString(value); // StringType } else if (name.equals("designation")) { this.getDesignation().add((ConceptReferenceDesignationComponent) value); } else if (name.equals("contains")) { this.getContains().add((ValueSetExpansionContainsComponent) value); } else return super.setProperty(name, value); return value; }
public ValueSetExpansionContainsComponent copy() { ValueSetExpansionContainsComponent dst = new ValueSetExpansionContainsComponent(); copyValues(dst); dst.system = system == null ? null : system.copy(); dst.abstract_ = abstract_ == null ? null : abstract_.copy(); dst.inactive = inactive == null ? null : inactive.copy(); dst.version = version == null ? null : version.copy(); dst.code = code == null ? null : code.copy(); dst.display = display == null ? null : display.copy(); if (designation != null) { dst.designation = new ArrayList<ConceptReferenceDesignationComponent>(); for (ConceptReferenceDesignationComponent i : designation) dst.designation.add(i.copy()); }; if (contains != null) { dst.contains = new ArrayList<ValueSetExpansionContainsComponent>(); for (ValueSetExpansionContainsComponent i : contains) dst.contains.add(i.copy()); }; return dst; }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); copyElement(src, tgt); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasAbstract()) tgt.setAbstract(src.getAbstract()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); if (src.hasCode()) tgt.setCode(src.getCode()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); copyElement(src, tgt); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasAbstract()) tgt.setAbstract(src.getAbstract()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); if (src.hasCode()) tgt.setCode(src.getCode()); if (src.hasDisplay()) tgt.setDisplay(src.getDisplay()); for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -887328209: return getSystemElement(); case 1732898850: return getAbstractElement(); case 24665195: return getInactiveElement(); case 351608024: return getVersionElement(); case 3059181: return getCodeElement(); case 1671764162: return getDisplayElement(); case -900931593: return addDesignation(); case -567445985: return addContains(); default: return super.makeProperty(hash, name); } }
public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setAbstract(src.getAbstract()); tgt.setVersion(src.getVersion()); tgt.setCode(src.getCode()); tgt.setDisplay(src.getDisplay()); for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setAbstract(src.getAbstract()); tgt.setVersion(src.getVersion()); tgt.setCode(src.getCode()); tgt.setDisplay(src.getDisplay()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
private void applyFilter(IntegerType theTotalElement, List<ValueSetExpansionContainsComponent> theContains, String theFilter) { for (int idx = 0; idx < theContains.size(); idx++) { ValueSetExpansionContainsComponent next = theContains.get(idx); if (isBlank(next.getDisplay()) || !org.apache.commons.lang3.StringUtils.containsIgnoreCase(next.getDisplay(), theFilter)) { theContains.remove(idx); idx--; if (theTotalElement.getValue() != null) { theTotalElement.setValue(theTotalElement.getValue() - 1); } } applyFilter(theTotalElement, next.getContains(), theFilter); } }