Пример #1
0
 private String getIncSummary(ConceptSetComponent cc) {
   CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
   for (UriType vs : cc.getValueSet()) b.append(vs.asStringValue());
   String vsd =
       b.length() > 0 ? " where the codes are in the value sets (" + b.toString() + ")" : "";
   String system = cc.getSystem();
   if (cc.hasConcept())
     return Integer.toString(cc.getConcept().size()) + " codes from " + system + vsd;
   if (cc.hasFilter()) {
     String s = "";
     for (ConceptSetFilterComponent f : cc.getFilter()) {
       if (!Utilities.noString(s)) s = s + " & ";
       s = s + f.getProperty() + " " + f.getOp().toCode() + " " + f.getValue();
     }
     return "from " + system + " where " + s + vsd;
   }
   return "All codes from " + system + vsd;
 }
  @Override
  public ValueSet expand(ValueSet source, String theFilter) {
    ValueSet toExpand = new ValueSet();
    for (UriType next : source.getCompose().getImport()) {
      ConceptSetComponent include = toExpand.getCompose().addInclude();
      include.setSystem(next.getValue());
      addFilterIfPresent(theFilter, include);
    }

    for (ConceptSetComponent next : source.getCompose().getInclude()) {
      toExpand.getCompose().addInclude(next);
      addFilterIfPresent(theFilter, next);
    }

    if (toExpand.getCompose().isEmpty()) {
      throw new InvalidRequestException(
          "ValueSet does not have any compose.include or compose.import values, can not expand");
    }

    toExpand.getCompose().getExclude().addAll(source.getCompose().getExclude());

    ValueSet retVal = doExpand(toExpand);
    return retVal;
  }