private ValueSet doExpand(ValueSet theSource) {

    validateIncludes("include", theSource.getCompose().getInclude());
    validateIncludes("exclude", theSource.getCompose().getExclude());

    HapiWorkerContext workerContext = new HapiWorkerContext(getContext(), myValidationSupport);

    ValueSetExpansionOutcome outcome = workerContext.expand(theSource);
    ValueSetExpansionComponent expansion = outcome.getValueset().getExpansion();

    ValueSet retVal = new ValueSet();
    retVal.getMeta().setLastUpdated(new Date());
    retVal.setExpansion(expansion);
    return retVal;
  }
Example #2
0
 private ValueSetExpansionOutcome loadFromCache(ValueSet vs, String cacheFn)
     throws FileNotFoundException, Exception {
   JsonParser parser = new JsonParser();
   Resource r = parser.parse(new FileInputStream(cacheFn));
   if (r instanceof OperationOutcome)
     return new ValueSetExpansionOutcome(
         ((OperationOutcome) r).getIssue().get(0).getDetails().getText(),
         TerminologyServiceErrorClass.UNKNOWN);
   else {
     vs.setExpansion(
         ((ValueSet) r)
             .getExpansion()); // because what is cached might be from a different value set
     return new ValueSetExpansionOutcome(vs);
   }
 }