001 002package ca.uhn.fhir.model.dstu2.valueset; 003 004import ca.uhn.fhir.model.api.*; 005import java.util.HashMap; 006import java.util.Map; 007 008public enum BundleTypeEnum { 009 010 /** 011 * Display: <b>Document</b><br> 012 * Code Value: <b>document</b> 013 * 014 * The bundle is a document. The first resource is a Composition. 015 */ 016 DOCUMENT("document", "http://hl7.org/fhir/bundle-type"), 017 018 /** 019 * Display: <b>Message</b><br> 020 * Code Value: <b>message</b> 021 * 022 * The bundle is a message. The first resource is a MessageHeader. 023 */ 024 MESSAGE("message", "http://hl7.org/fhir/bundle-type"), 025 026 /** 027 * Display: <b>Transaction</b><br> 028 * Code Value: <b>transaction</b> 029 * 030 * The bundle is a transaction - intended to be processed by a server as an atomic commit. 031 */ 032 TRANSACTION("transaction", "http://hl7.org/fhir/bundle-type"), 033 034 /** 035 * Display: <b>Transaction Response</b><br> 036 * Code Value: <b>transaction-response</b> 037 * 038 * The bundle is a transaction response. Because the response is a transaction response, the transactionhas succeeded, and all responses are error free. 039 */ 040 TRANSACTION_RESPONSE("transaction-response", "http://hl7.org/fhir/bundle-type"), 041 042 /** 043 * Display: <b>Batch</b><br> 044 * Code Value: <b>batch</b> 045 * 046 * The bundle is a transaction - intended to be processed by a server as a group of actions. 047 */ 048 BATCH("batch", "http://hl7.org/fhir/bundle-type"), 049 050 /** 051 * Display: <b>Batch Response</b><br> 052 * Code Value: <b>batch-response</b> 053 * 054 * The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success. 055 */ 056 BATCH_RESPONSE("batch-response", "http://hl7.org/fhir/bundle-type"), 057 058 /** 059 * Display: <b>History List</b><br> 060 * Code Value: <b>history</b> 061 * 062 * The bundle is a list of resources from a history interaction on a server. 063 */ 064 HISTORY_LIST("history", "http://hl7.org/fhir/bundle-type"), 065 066 /** 067 * Display: <b>Search Results</b><br> 068 * Code Value: <b>searchset</b> 069 * 070 * The bundle is a list of resources returned as a result of a search/query interaction, operation, or message. 071 */ 072 SEARCH_RESULTS("searchset", "http://hl7.org/fhir/bundle-type"), 073 074 /** 075 * Display: <b>Collection</b><br> 076 * Code Value: <b>collection</b> 077 * 078 * The bundle is a set of resources collected into a single document for ease of distribution. 079 */ 080 COLLECTION("collection", "http://hl7.org/fhir/bundle-type"), 081 082 ; 083 084 /** 085 * Identifier for this Value Set: 086 * 087 */ 088 public static final String VALUESET_IDENTIFIER = ""; 089 090 /** 091 * Name for this Value Set: 092 * BundleType 093 */ 094 public static final String VALUESET_NAME = "BundleType"; 095 096 private static Map<String, BundleTypeEnum> CODE_TO_ENUM = new HashMap<String, BundleTypeEnum>(); 097 private static Map<String, Map<String, BundleTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, BundleTypeEnum>>(); 098 099 private final String myCode; 100 private final String mySystem; 101 102 static { 103 for (BundleTypeEnum next : BundleTypeEnum.values()) { 104 CODE_TO_ENUM.put(next.getCode(), next); 105 106 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 107 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, BundleTypeEnum>()); 108 } 109 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 110 } 111 } 112 113 /** 114 * Returns the code associated with this enumerated value 115 */ 116 public String getCode() { 117 return myCode; 118 } 119 120 /** 121 * Returns the code system associated with this enumerated value 122 */ 123 public String getSystem() { 124 return mySystem; 125 } 126 127 /** 128 * Returns the enumerated value associated with this code 129 */ 130 public static BundleTypeEnum forCode(String theCode) { 131 BundleTypeEnum retVal = CODE_TO_ENUM.get(theCode); 132 return retVal; 133 } 134 135 /** 136 * Converts codes to their respective enumerated values 137 */ 138 public static final IValueSetEnumBinder<BundleTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<BundleTypeEnum>() { 139 @Override 140 public String toCodeString(BundleTypeEnum theEnum) { 141 return theEnum.getCode(); 142 } 143 144 @Override 145 public String toSystemString(BundleTypeEnum theEnum) { 146 return theEnum.getSystem(); 147 } 148 149 @Override 150 public BundleTypeEnum fromCodeString(String theCodeString) { 151 return CODE_TO_ENUM.get(theCodeString); 152 } 153 154 @Override 155 public BundleTypeEnum fromCodeString(String theCodeString, String theSystemString) { 156 Map<String, BundleTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 157 if (map == null) { 158 return null; 159 } 160 return map.get(theCodeString); 161 } 162 163 }; 164 165 /** 166 * Constructor 167 */ 168 BundleTypeEnum(String theCode, String theSystem) { 169 myCode = theCode; 170 mySystem = theSystem; 171 } 172 173 174}