001package org.hl7.fhir.dstu2.terminologies;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024import java.io.FileNotFoundException;
025import java.io.IOException;
026
027import org.hl7.fhir.dstu2.model.ValueSet;
028
029public interface ValueSetExpander {
030  public class ETooCostly extends Exception {
031
032    public ETooCostly(String msg) {
033      super(msg);
034    }
035
036  }
037
038  /**
039   * Some value sets are just too big to expand. Instead of an expanded value set, 
040   * you get back an interface that can test membership - usually on a server somewhere
041   * 
042   * @author Grahame
043   */
044  public class ValueSetExpansionOutcome {
045    private ValueSet valueset;
046    private ValueSetChecker service;
047    private String error;
048    public ValueSetExpansionOutcome(ValueSet valueset) {
049      super();
050      this.valueset = valueset;
051      this.service = null;
052      this.error = null;
053    }
054    public ValueSetExpansionOutcome(ValueSet valueset, String error) {
055      super();
056      this.valueset = valueset;
057      this.service = null;
058      this.error = error;
059    }
060    public ValueSetExpansionOutcome(ValueSetChecker service, String error) {
061      super();
062      this.valueset = null;
063      this.service = service;
064      this.error = error;
065    }
066    public ValueSetExpansionOutcome(String error) {
067      this.valueset = null;
068      this.service = null;
069      this.error = error;
070    }
071    public ValueSet getValueset() {
072      return valueset;
073    }
074    public ValueSetChecker getService() {
075      return service;
076    }
077    public String getError() {
078      return error;
079    }
080
081
082  }
083
084  public ValueSetExpansionOutcome expand(ValueSet source) throws ETooCostly, FileNotFoundException, IOException;
085}