001package ca.uhn.fhir.context.support; 002 003/*- 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2020 University Health Network 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 023import org.apache.commons.lang3.Validate; 024 025/** 026 * Options for ValueSet expansion 027 * 028 * @see IValidationSupport 029 */ 030public class ValueSetExpansionOptions { 031 032 private boolean myFailOnMissingCodeSystem = true; 033 private int myCount = 1000; 034 private int myOffset = 0; 035 036 /** 037 * The number of codes to return. 038 * <p> 039 * Default is 1000 040 * </p> 041 */ 042 public int getCount() { 043 return myCount; 044 } 045 046 /** 047 * The number of codes to return. 048 * <p> 049 * Default is 1000 050 * </p> 051 */ 052 public ValueSetExpansionOptions setCount(int theCount) { 053 Validate.isTrue(theCount >= 0, "theCount must be >= 0"); 054 myCount = theCount; 055 return this; 056 } 057 058 /** 059 * The code index to start at (i.e the individual code index, not the page number) 060 */ 061 public int getOffset() { 062 return myOffset; 063 } 064 065 /** 066 * The code index to start at (i.e the individual code index, not the page number) 067 */ 068 public ValueSetExpansionOptions setOffset(int theOffset) { 069 Validate.isTrue(theOffset >= 0, "theOffset must be >= 0"); 070 myOffset = theOffset; 071 return this; 072 } 073 074 /** 075 * Should the expansion fail if a codesystem is referenced by the valueset, but 076 * it can not be found? 077 * <p> 078 * Default is <code>true</code> 079 * </p> 080 */ 081 public boolean isFailOnMissingCodeSystem() { 082 return myFailOnMissingCodeSystem; 083 } 084 085 /** 086 * Should the expansion fail if a codesystem is referenced by the valueset, but 087 * it can not be found? 088 * <p> 089 * Default is <code>true</code> 090 * </p> 091 */ 092 public ValueSetExpansionOptions setFailOnMissingCodeSystem(boolean theFailOnMissingCodeSystem) { 093 myFailOnMissingCodeSystem = theFailOnMissingCodeSystem; 094 return this; 095 } 096}