001package org.hl7.fhir.instance.terminologies; 002 003/* 004Copyright (c) 2011+, HL7, Inc 005All rights reserved. 006 007Redistribution and use in source and binary forms, with or without modification, 008are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028POSSIBILITY OF SUCH DAMAGE. 029 030 */ 031 032import org.hl7.fhir.instance.model.ValueSet; 033 034public interface ValueSetExpander { 035 public class ETooCostly extends Exception { 036 037 public ETooCostly(String msg) { 038 super(msg); 039 } 040 041 } 042 043 /** 044 * Some value sets are just too big to expand. Instead of an expanded value set, 045 * you get back an interface that can test membership - usually on a server somewhere 046 * 047 * @author Grahame 048 */ 049 public class ValueSetExpansionOutcome { 050 private ValueSet valueset; 051 private ValueSetChecker service; 052 private String error; 053 public ValueSetExpansionOutcome(ValueSet valueset) { 054 super(); 055 this.valueset = valueset; 056 this.service = null; 057 this.error = null; 058 } 059 public ValueSetExpansionOutcome(ValueSet valueset, String error) { 060 super(); 061 this.valueset = valueset; 062 this.service = null; 063 this.error = error; 064 } 065 public ValueSetExpansionOutcome(ValueSetChecker service, String error) { 066 super(); 067 this.valueset = null; 068 this.service = service; 069 this.error = error; 070 } 071 public ValueSetExpansionOutcome(String error) { 072 this.valueset = null; 073 this.service = null; 074 this.error = error; 075 } 076 public ValueSet getValueset() { 077 return valueset; 078 } 079 public ValueSetChecker getService() { 080 return service; 081 } 082 public String getError() { 083 return error; 084 } 085 086 087 } 088 089 public ValueSetExpansionOutcome expand(ValueSet source) throws Exception; 090}