001package org.hl7.fhir.r5.utils; 002 003import org.hl7.fhir.exceptions.FHIRException; 004import org.hl7.fhir.r5.model.Base; 005import org.hl7.fhir.r5.model.Configuration; 006import org.hl7.fhir.r5.model.EnumFactory; 007import org.hl7.fhir.r5.model.Enumeration; 008import org.hl7.fhir.r5.model.PrimitiveType; 009 010public enum GuideParameterCode { 011 /** 012 * If the value of this string 0..* parameter is one of the metadata fields then all conformance resources will have any specified [Resource].[field] overwritten with the ImplementationGuide.[field], where field is one of: version, date, status, publisher, contact, copyright, experimental, jurisdiction, useContext. 013 */ 014 APPLY, 015 /** 016 * The value of this string 0..* parameter is a subfolder of the build context's location that is to be scanned to load resources. Scope is (if present) a particular resource type. 017 */ 018 PATHRESOURCE, 019 /** 020 * The value of this string 0..1 parameter is a subfolder of the build context's location that contains files that are part of the html content processed by the builder. 021 */ 022 PATHPAGES, 023 /** 024 * The value of this string 0..1 parameter is a subfolder of the build context's location that is used as the terminology cache. If this is not present, the terminology cache is on the local system, not under version control. 025 */ 026 PATHTXCACHE, 027 /** 028 * The value of this string 0..* parameter is a parameter (name=value) when expanding value sets for this implementation guide. This is particularly used to specify the versions of published terminologies such as SNOMED CT. 029 */ 030 EXPANSIONPARAMETER, 031 /** 032 * The value of this string 0..1 parameter is either "warning" or "error" (default = "error"). If the value is "warning" then IG build tools allow the IG to be considered successfully build even when there is no internal broken links. 033 */ 034 RULEBROKENLINKS, 035 /** 036 * The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in XML format. If not present, the Publication Tool decides whether to generate XML. 037 */ 038 GENERATEXML, 039 /** 040 * The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in JSON format. If not present, the Publication Tool decides whether to generate JSON. 041 */ 042 GENERATEJSON, 043 /** 044 * The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in Turtle format. If not present, the Publication Tool decides whether to generate Turtle. 045 */ 046 GENERATETURTLE, 047 /** 048 * The value of this string singleton parameter is the name of the file to use as the builder template for each generated page (see templating). 049 */ 050 HTMLTEMPLATE, 051 /** 052 * added to help the parsers with the generic types 053 */ 054 NULL; 055 public static GuideParameterCode fromCode(String codeString) throws FHIRException { 056 if (codeString == null || "".equals(codeString)) 057 return null; 058 if ("apply".equals(codeString)) 059 return APPLY; 060 if ("path-resource".equals(codeString)) 061 return PATHRESOURCE; 062 if ("path-pages".equals(codeString)) 063 return PATHPAGES; 064 if ("path-tx-cache".equals(codeString)) 065 return PATHTXCACHE; 066 if ("expansion-parameter".equals(codeString)) 067 return EXPANSIONPARAMETER; 068 if ("rule-broken-links".equals(codeString)) 069 return RULEBROKENLINKS; 070 if ("generate-xml".equals(codeString)) 071 return GENERATEXML; 072 if ("generate-json".equals(codeString)) 073 return GENERATEJSON; 074 if ("generate-turtle".equals(codeString)) 075 return GENERATETURTLE; 076 if ("html-template".equals(codeString)) 077 return HTMLTEMPLATE; 078 if (Configuration.isAcceptInvalidEnums()) 079 return null; 080 else 081 throw new FHIRException("Unknown GuideParameterCode code '"+codeString+"'"); 082 } 083 public String toCode() { 084 switch (this) { 085 case APPLY: return "apply"; 086 case PATHRESOURCE: return "path-resource"; 087 case PATHPAGES: return "path-pages"; 088 case PATHTXCACHE: return "path-tx-cache"; 089 case EXPANSIONPARAMETER: return "expansion-parameter"; 090 case RULEBROKENLINKS: return "rule-broken-links"; 091 case GENERATEXML: return "generate-xml"; 092 case GENERATEJSON: return "generate-json"; 093 case GENERATETURTLE: return "generate-turtle"; 094 case HTMLTEMPLATE: return "html-template"; 095 default: return "?"; 096 } 097 } 098 public String getSystem() { 099 switch (this) { 100 case APPLY: return "http://hl7.org/fhir/guide-parameter-code"; 101 case PATHRESOURCE: return "http://hl7.org/fhir/guide-parameter-code"; 102 case PATHPAGES: return "http://hl7.org/fhir/guide-parameter-code"; 103 case PATHTXCACHE: return "http://hl7.org/fhir/guide-parameter-code"; 104 case EXPANSIONPARAMETER: return "http://hl7.org/fhir/guide-parameter-code"; 105 case RULEBROKENLINKS: return "http://hl7.org/fhir/guide-parameter-code"; 106 case GENERATEXML: return "http://hl7.org/fhir/guide-parameter-code"; 107 case GENERATEJSON: return "http://hl7.org/fhir/guide-parameter-code"; 108 case GENERATETURTLE: return "http://hl7.org/fhir/guide-parameter-code"; 109 case HTMLTEMPLATE: return "http://hl7.org/fhir/guide-parameter-code"; 110 default: return "?"; 111 } 112 } 113 public String getDefinition() { 114 switch (this) { 115 case APPLY: return "If the value of this string 0..* parameter is one of the metadata fields then all conformance resources will have any specified [Resource].[field] overwritten with the ImplementationGuide.[field], where field is one of: version, date, status, publisher, contact, copyright, experimental, jurisdiction, useContext."; 116 case PATHRESOURCE: return "The value of this string 0..* parameter is a subfolder of the build context's location that is to be scanned to load resources. Scope is (if present) a particular resource type."; 117 case PATHPAGES: return "The value of this string 0..1 parameter is a subfolder of the build context's location that contains files that are part of the html content processed by the builder."; 118 case PATHTXCACHE: return "The value of this string 0..1 parameter is a subfolder of the build context's location that is used as the terminology cache. If this is not present, the terminology cache is on the local system, not under version control."; 119 case EXPANSIONPARAMETER: return "The value of this string 0..* parameter is a parameter (name=value) when expanding value sets for this implementation guide. This is particularly used to specify the versions of published terminologies such as SNOMED CT."; 120 case RULEBROKENLINKS: return "The value of this string 0..1 parameter is either \"warning\" or \"error\" (default = \"error\"). If the value is \"warning\" then IG build tools allow the IG to be considered successfully build even when there is no internal broken links."; 121 case GENERATEXML: return "The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in XML format. If not present, the Publication Tool decides whether to generate XML."; 122 case GENERATEJSON: return "The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in JSON format. If not present, the Publication Tool decides whether to generate JSON."; 123 case GENERATETURTLE: return "The value of this boolean 0..1 parameter specifies whether the IG publisher creates examples in Turtle format. If not present, the Publication Tool decides whether to generate Turtle."; 124 case HTMLTEMPLATE: return "The value of this string singleton parameter is the name of the file to use as the builder template for each generated page (see templating)."; 125 default: return "?"; 126 } 127 } 128 public String getDisplay() { 129 switch (this) { 130 case APPLY: return "Apply Metadata Value"; 131 case PATHRESOURCE: return "Resource Path"; 132 case PATHPAGES: return "Pages Path"; 133 case PATHTXCACHE: return "Terminology Cache Path"; 134 case EXPANSIONPARAMETER: return "Expansion Profile"; 135 case RULEBROKENLINKS: return "Broken Links Rule"; 136 case GENERATEXML: return "Generate XML"; 137 case GENERATEJSON: return "Generate JSON"; 138 case GENERATETURTLE: return "Generate Turtle"; 139 case HTMLTEMPLATE: return "HTML Template"; 140 default: return "?"; 141 } 142 } 143 public class GuideParameterCodeEnumFactory implements EnumFactory<GuideParameterCode> { 144 public GuideParameterCode fromCode(String codeString) throws IllegalArgumentException { 145 if (codeString == null || "".equals(codeString)) 146 if (codeString == null || "".equals(codeString)) 147 return null; 148 if ("apply".equals(codeString)) 149 return GuideParameterCode.APPLY; 150 if ("path-resource".equals(codeString)) 151 return GuideParameterCode.PATHRESOURCE; 152 if ("path-pages".equals(codeString)) 153 return GuideParameterCode.PATHPAGES; 154 if ("path-tx-cache".equals(codeString)) 155 return GuideParameterCode.PATHTXCACHE; 156 if ("expansion-parameter".equals(codeString)) 157 return GuideParameterCode.EXPANSIONPARAMETER; 158 if ("rule-broken-links".equals(codeString)) 159 return GuideParameterCode.RULEBROKENLINKS; 160 if ("generate-xml".equals(codeString)) 161 return GuideParameterCode.GENERATEXML; 162 if ("generate-json".equals(codeString)) 163 return GuideParameterCode.GENERATEJSON; 164 if ("generate-turtle".equals(codeString)) 165 return GuideParameterCode.GENERATETURTLE; 166 if ("html-template".equals(codeString)) 167 return GuideParameterCode.HTMLTEMPLATE; 168 throw new IllegalArgumentException("Unknown GuideParameterCode code '"+codeString+"'"); 169 } 170 public Enumeration<GuideParameterCode> fromType(Base code) throws FHIRException { 171 if (code == null) 172 return null; 173 if (code.isEmpty()) 174 return new Enumeration<GuideParameterCode>(this); 175 String codeString = ((PrimitiveType) code).asStringValue(); 176 if (codeString == null || "".equals(codeString)) 177 return null; 178 if ("apply".equals(codeString)) 179 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.APPLY); 180 if ("path-resource".equals(codeString)) 181 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.PATHRESOURCE); 182 if ("path-pages".equals(codeString)) 183 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.PATHPAGES); 184 if ("path-tx-cache".equals(codeString)) 185 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.PATHTXCACHE); 186 if ("expansion-parameter".equals(codeString)) 187 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.EXPANSIONPARAMETER); 188 if ("rule-broken-links".equals(codeString)) 189 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.RULEBROKENLINKS); 190 if ("generate-xml".equals(codeString)) 191 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.GENERATEXML); 192 if ("generate-json".equals(codeString)) 193 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.GENERATEJSON); 194 if ("generate-turtle".equals(codeString)) 195 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.GENERATETURTLE); 196 if ("html-template".equals(codeString)) 197 return new Enumeration<GuideParameterCode>(this, GuideParameterCode.HTMLTEMPLATE); 198 throw new FHIRException("Unknown GuideParameterCode code '"+codeString+"'"); 199 } 200 public String toCode(GuideParameterCode code) { 201 if (code == GuideParameterCode.APPLY) 202 return "apply"; 203 if (code == GuideParameterCode.PATHRESOURCE) 204 return "path-resource"; 205 if (code == GuideParameterCode.PATHPAGES) 206 return "path-pages"; 207 if (code == GuideParameterCode.PATHTXCACHE) 208 return "path-tx-cache"; 209 if (code == GuideParameterCode.EXPANSIONPARAMETER) 210 return "expansion-parameter"; 211 if (code == GuideParameterCode.RULEBROKENLINKS) 212 return "rule-broken-links"; 213 if (code == GuideParameterCode.GENERATEXML) 214 return "generate-xml"; 215 if (code == GuideParameterCode.GENERATEJSON) 216 return "generate-json"; 217 if (code == GuideParameterCode.GENERATETURTLE) 218 return "generate-turtle"; 219 if (code == GuideParameterCode.HTMLTEMPLATE) 220 return "html-template"; 221 return "?"; 222 } 223 public String toSystem(GuideParameterCode code) { 224 return code.getSystem(); 225 } 226 } 227}