001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.DatatypeDef; 043import ca.uhn.fhir.model.api.annotation.Block; 044import org.hl7.fhir.instance.model.api.*; 045import org.hl7.fhir.exceptions.FHIRException; 046/** 047 * The marketing status describes the date when a medicinal product is actually put on the market or the date as of which it is no longer available. 048 */ 049@DatatypeDef(name="MarketingStatus") 050public class MarketingStatus extends BackboneType implements ICompositeType { 051 052 /** 053 * The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements. 054 */ 055 @Child(name = "country", type = {CodeableConcept.class}, order=0, min=1, max=1, modifier=false, summary=true) 056 @Description(shortDefinition="The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements", formalDefinition="The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements." ) 057 protected CodeableConcept country; 058 059 /** 060 * Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified. 061 */ 062 @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 063 @Description(shortDefinition="Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified", formalDefinition="Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified." ) 064 protected CodeableConcept jurisdiction; 065 066 /** 067 * This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples. 068 */ 069 @Child(name = "status", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true) 070 @Description(shortDefinition="This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples", formalDefinition="This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples." ) 071 protected CodeableConcept status; 072 073 /** 074 * The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. 075 */ 076 @Child(name = "dateRange", type = {Period.class}, order=3, min=1, max=1, modifier=false, summary=true) 077 @Description(shortDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain", formalDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain." ) 078 protected Period dateRange; 079 080 /** 081 * The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. 082 */ 083 @Child(name = "restoreDate", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true) 084 @Description(shortDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain", formalDefinition="The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain." ) 085 protected DateTimeType restoreDate; 086 087 private static final long serialVersionUID = -1445736863L; 088 089 /** 090 * Constructor 091 */ 092 public MarketingStatus() { 093 super(); 094 } 095 096 /** 097 * Constructor 098 */ 099 public MarketingStatus(CodeableConcept country, CodeableConcept status, Period dateRange) { 100 super(); 101 this.country = country; 102 this.status = status; 103 this.dateRange = dateRange; 104 } 105 106 /** 107 * @return {@link #country} (The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.) 108 */ 109 public CodeableConcept getCountry() { 110 if (this.country == null) 111 if (Configuration.errorOnAutoCreate()) 112 throw new Error("Attempt to auto-create MarketingStatus.country"); 113 else if (Configuration.doAutoCreate()) 114 this.country = new CodeableConcept(); // cc 115 return this.country; 116 } 117 118 public boolean hasCountry() { 119 return this.country != null && !this.country.isEmpty(); 120 } 121 122 /** 123 * @param value {@link #country} (The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.) 124 */ 125 public MarketingStatus setCountry(CodeableConcept value) { 126 this.country = value; 127 return this; 128 } 129 130 /** 131 * @return {@link #jurisdiction} (Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.) 132 */ 133 public CodeableConcept getJurisdiction() { 134 if (this.jurisdiction == null) 135 if (Configuration.errorOnAutoCreate()) 136 throw new Error("Attempt to auto-create MarketingStatus.jurisdiction"); 137 else if (Configuration.doAutoCreate()) 138 this.jurisdiction = new CodeableConcept(); // cc 139 return this.jurisdiction; 140 } 141 142 public boolean hasJurisdiction() { 143 return this.jurisdiction != null && !this.jurisdiction.isEmpty(); 144 } 145 146 /** 147 * @param value {@link #jurisdiction} (Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.) 148 */ 149 public MarketingStatus setJurisdiction(CodeableConcept value) { 150 this.jurisdiction = value; 151 return this; 152 } 153 154 /** 155 * @return {@link #status} (This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.) 156 */ 157 public CodeableConcept getStatus() { 158 if (this.status == null) 159 if (Configuration.errorOnAutoCreate()) 160 throw new Error("Attempt to auto-create MarketingStatus.status"); 161 else if (Configuration.doAutoCreate()) 162 this.status = new CodeableConcept(); // cc 163 return this.status; 164 } 165 166 public boolean hasStatus() { 167 return this.status != null && !this.status.isEmpty(); 168 } 169 170 /** 171 * @param value {@link #status} (This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.) 172 */ 173 public MarketingStatus setStatus(CodeableConcept value) { 174 this.status = value; 175 return this; 176 } 177 178 /** 179 * @return {@link #dateRange} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.) 180 */ 181 public Period getDateRange() { 182 if (this.dateRange == null) 183 if (Configuration.errorOnAutoCreate()) 184 throw new Error("Attempt to auto-create MarketingStatus.dateRange"); 185 else if (Configuration.doAutoCreate()) 186 this.dateRange = new Period(); // cc 187 return this.dateRange; 188 } 189 190 public boolean hasDateRange() { 191 return this.dateRange != null && !this.dateRange.isEmpty(); 192 } 193 194 /** 195 * @param value {@link #dateRange} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.) 196 */ 197 public MarketingStatus setDateRange(Period value) { 198 this.dateRange = value; 199 return this; 200 } 201 202 /** 203 * @return {@link #restoreDate} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value 204 */ 205 public DateTimeType getRestoreDateElement() { 206 if (this.restoreDate == null) 207 if (Configuration.errorOnAutoCreate()) 208 throw new Error("Attempt to auto-create MarketingStatus.restoreDate"); 209 else if (Configuration.doAutoCreate()) 210 this.restoreDate = new DateTimeType(); // bb 211 return this.restoreDate; 212 } 213 214 public boolean hasRestoreDateElement() { 215 return this.restoreDate != null && !this.restoreDate.isEmpty(); 216 } 217 218 public boolean hasRestoreDate() { 219 return this.restoreDate != null && !this.restoreDate.isEmpty(); 220 } 221 222 /** 223 * @param value {@link #restoreDate} (The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.). This is the underlying object with id, value and extensions. The accessor "getRestoreDate" gives direct access to the value 224 */ 225 public MarketingStatus setRestoreDateElement(DateTimeType value) { 226 this.restoreDate = value; 227 return this; 228 } 229 230 /** 231 * @return The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. 232 */ 233 public Date getRestoreDate() { 234 return this.restoreDate == null ? null : this.restoreDate.getValue(); 235 } 236 237 /** 238 * @param value The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. 239 */ 240 public MarketingStatus setRestoreDate(Date value) { 241 if (value == null) 242 this.restoreDate = null; 243 else { 244 if (this.restoreDate == null) 245 this.restoreDate = new DateTimeType(); 246 this.restoreDate.setValue(value); 247 } 248 return this; 249 } 250 251 protected void listChildren(List<Property> children) { 252 super.listChildren(children); 253 children.add(new Property("country", "CodeableConcept", "The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.", 0, 1, country)); 254 children.add(new Property("jurisdiction", "CodeableConcept", "Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.", 0, 1, jurisdiction)); 255 children.add(new Property("status", "CodeableConcept", "This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.", 0, 1, status)); 256 children.add(new Property("dateRange", "Period", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, dateRange)); 257 children.add(new Property("restoreDate", "dateTime", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, restoreDate)); 258 } 259 260 @Override 261 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 262 switch (_hash) { 263 case 957831062: /*country*/ return new Property("country", "CodeableConcept", "The country in which the marketing authorisation has been granted shall be specified It should be specified using the ISO 3166 ‑ 1 alpha-2 code elements.", 0, 1, country); 264 case -507075711: /*jurisdiction*/ return new Property("jurisdiction", "CodeableConcept", "Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified.", 0, 1, jurisdiction); 265 case -892481550: /*status*/ return new Property("status", "CodeableConcept", "This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples.", 0, 1, status); 266 case -261425617: /*dateRange*/ return new Property("dateRange", "Period", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, dateRange); 267 case 329465692: /*restoreDate*/ return new Property("restoreDate", "dateTime", "The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain.", 0, 1, restoreDate); 268 default: return super.getNamedProperty(_hash, _name, _checkValid); 269 } 270 271 } 272 273 @Override 274 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 275 switch (hash) { 276 case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // CodeableConcept 277 case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // CodeableConcept 278 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept 279 case -261425617: /*dateRange*/ return this.dateRange == null ? new Base[0] : new Base[] {this.dateRange}; // Period 280 case 329465692: /*restoreDate*/ return this.restoreDate == null ? new Base[0] : new Base[] {this.restoreDate}; // DateTimeType 281 default: return super.getProperty(hash, name, checkValid); 282 } 283 284 } 285 286 @Override 287 public Base setProperty(int hash, String name, Base value) throws FHIRException { 288 switch (hash) { 289 case 957831062: // country 290 this.country = castToCodeableConcept(value); // CodeableConcept 291 return value; 292 case -507075711: // jurisdiction 293 this.jurisdiction = castToCodeableConcept(value); // CodeableConcept 294 return value; 295 case -892481550: // status 296 this.status = castToCodeableConcept(value); // CodeableConcept 297 return value; 298 case -261425617: // dateRange 299 this.dateRange = castToPeriod(value); // Period 300 return value; 301 case 329465692: // restoreDate 302 this.restoreDate = castToDateTime(value); // DateTimeType 303 return value; 304 default: return super.setProperty(hash, name, value); 305 } 306 307 } 308 309 @Override 310 public Base setProperty(String name, Base value) throws FHIRException { 311 if (name.equals("country")) { 312 this.country = castToCodeableConcept(value); // CodeableConcept 313 } else if (name.equals("jurisdiction")) { 314 this.jurisdiction = castToCodeableConcept(value); // CodeableConcept 315 } else if (name.equals("status")) { 316 this.status = castToCodeableConcept(value); // CodeableConcept 317 } else if (name.equals("dateRange")) { 318 this.dateRange = castToPeriod(value); // Period 319 } else if (name.equals("restoreDate")) { 320 this.restoreDate = castToDateTime(value); // DateTimeType 321 } else 322 return super.setProperty(name, value); 323 return value; 324 } 325 326 @Override 327 public Base makeProperty(int hash, String name) throws FHIRException { 328 switch (hash) { 329 case 957831062: return getCountry(); 330 case -507075711: return getJurisdiction(); 331 case -892481550: return getStatus(); 332 case -261425617: return getDateRange(); 333 case 329465692: return getRestoreDateElement(); 334 default: return super.makeProperty(hash, name); 335 } 336 337 } 338 339 @Override 340 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 341 switch (hash) { 342 case 957831062: /*country*/ return new String[] {"CodeableConcept"}; 343 case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"}; 344 case -892481550: /*status*/ return new String[] {"CodeableConcept"}; 345 case -261425617: /*dateRange*/ return new String[] {"Period"}; 346 case 329465692: /*restoreDate*/ return new String[] {"dateTime"}; 347 default: return super.getTypesForProperty(hash, name); 348 } 349 350 } 351 352 @Override 353 public Base addChild(String name) throws FHIRException { 354 if (name.equals("country")) { 355 this.country = new CodeableConcept(); 356 return this.country; 357 } 358 else if (name.equals("jurisdiction")) { 359 this.jurisdiction = new CodeableConcept(); 360 return this.jurisdiction; 361 } 362 else if (name.equals("status")) { 363 this.status = new CodeableConcept(); 364 return this.status; 365 } 366 else if (name.equals("dateRange")) { 367 this.dateRange = new Period(); 368 return this.dateRange; 369 } 370 else if (name.equals("restoreDate")) { 371 throw new FHIRException("Cannot call addChild on a primitive type MarketingStatus.restoreDate"); 372 } 373 else 374 return super.addChild(name); 375 } 376 377 public String fhirType() { 378 return "MarketingStatus"; 379 380 } 381 382 public MarketingStatus copy() { 383 MarketingStatus dst = new MarketingStatus(); 384 copyValues(dst); 385 return dst; 386 } 387 388 public void copyValues(MarketingStatus dst) { 389 super.copyValues(dst); 390 dst.country = country == null ? null : country.copy(); 391 dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy(); 392 dst.status = status == null ? null : status.copy(); 393 dst.dateRange = dateRange == null ? null : dateRange.copy(); 394 dst.restoreDate = restoreDate == null ? null : restoreDate.copy(); 395 } 396 397 protected MarketingStatus typedCopy() { 398 return copy(); 399 } 400 401 @Override 402 public boolean equalsDeep(Base other_) { 403 if (!super.equalsDeep(other_)) 404 return false; 405 if (!(other_ instanceof MarketingStatus)) 406 return false; 407 MarketingStatus o = (MarketingStatus) other_; 408 return compareDeep(country, o.country, true) && compareDeep(jurisdiction, o.jurisdiction, true) 409 && compareDeep(status, o.status, true) && compareDeep(dateRange, o.dateRange, true) && compareDeep(restoreDate, o.restoreDate, true) 410 ; 411 } 412 413 @Override 414 public boolean equalsShallow(Base other_) { 415 if (!super.equalsShallow(other_)) 416 return false; 417 if (!(other_ instanceof MarketingStatus)) 418 return false; 419 MarketingStatus o = (MarketingStatus) other_; 420 return compareValues(restoreDate, o.restoreDate, true); 421 } 422 423 public boolean isEmpty() { 424 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(country, jurisdiction, status 425 , dateRange, restoreDate); 426 } 427 428 429}