private void addCompose(ValueSet retVal, String theSystem, String theCode, String theDisplay) {
   if (isBlank(theCode)) {
     return;
   }
   ExpansionContains contains = retVal.getExpansion().addContains();
   contains.setSystem(theSystem);
   contains.setCode(theCode);
   contains.setDisplay(theDisplay);
 }
  private ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult validateCodeIsInContains(
      List<ExpansionContains> contains,
      String theSystem,
      String theCode,
      CodingDt theCoding,
      CodeableConceptDt theCodeableConcept) {
    for (ExpansionContains 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 (CodingDt next : theCodeableConcept.getCoding()) {
          if (StringUtils.equals(system, next.getSystem())
              && StringUtils.equals(code, next.getCode())) {
            return new ValidateCodeResult(true, "Validation succeeded", nextCode.getDisplay());
          }
        }
      }
    }

    return null;
  }