001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are 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 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 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.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * Information about a user's current session. 047 */ 048@ResourceDef(name="UserSession", profile="http://hl7.org/fhir/StructureDefinition/UserSession") 049public class UserSession extends DomainResource { 050 051 public enum UserSessionStatus { 052 /** 053 * The user session is activating. 054 */ 055 ACTIVATING, 056 /** 057 * The user session is active. 058 */ 059 ACTIVE, 060 /** 061 * The user session is suspended. 062 */ 063 SUSPENDED, 064 /** 065 * The user session is closing. 066 */ 067 CLOSING, 068 /** 069 * The user session is closed. 070 */ 071 CLOSED, 072 /** 073 * added to help the parsers with the generic types 074 */ 075 NULL; 076 public static UserSessionStatus fromCode(String codeString) throws FHIRException { 077 if (codeString == null || "".equals(codeString)) 078 return null; 079 if ("activating".equals(codeString)) 080 return ACTIVATING; 081 if ("active".equals(codeString)) 082 return ACTIVE; 083 if ("suspended".equals(codeString)) 084 return SUSPENDED; 085 if ("closing".equals(codeString)) 086 return CLOSING; 087 if ("closed".equals(codeString)) 088 return CLOSED; 089 if (Configuration.isAcceptInvalidEnums()) 090 return null; 091 else 092 throw new FHIRException("Unknown UserSessionStatus code '"+codeString+"'"); 093 } 094 public String toCode() { 095 switch (this) { 096 case ACTIVATING: return "activating"; 097 case ACTIVE: return "active"; 098 case SUSPENDED: return "suspended"; 099 case CLOSING: return "closing"; 100 case CLOSED: return "closed"; 101 default: return "?"; 102 } 103 } 104 public String getSystem() { 105 switch (this) { 106 case ACTIVATING: return "http://hl7.org/fhir/usersession-status"; 107 case ACTIVE: return "http://hl7.org/fhir/usersession-status"; 108 case SUSPENDED: return "http://hl7.org/fhir/usersession-status"; 109 case CLOSING: return "http://hl7.org/fhir/usersession-status"; 110 case CLOSED: return "http://hl7.org/fhir/usersession-status"; 111 default: return "?"; 112 } 113 } 114 public String getDefinition() { 115 switch (this) { 116 case ACTIVATING: return "The user session is activating."; 117 case ACTIVE: return "The user session is active."; 118 case SUSPENDED: return "The user session is suspended."; 119 case CLOSING: return "The user session is closing."; 120 case CLOSED: return "The user session is closed."; 121 default: return "?"; 122 } 123 } 124 public String getDisplay() { 125 switch (this) { 126 case ACTIVATING: return "Activating"; 127 case ACTIVE: return "Active"; 128 case SUSPENDED: return "Suspending"; 129 case CLOSING: return "Closing"; 130 case CLOSED: return "Closed"; 131 default: return "?"; 132 } 133 } 134 } 135 136 public static class UserSessionStatusEnumFactory implements EnumFactory<UserSessionStatus> { 137 public UserSessionStatus fromCode(String codeString) throws IllegalArgumentException { 138 if (codeString == null || "".equals(codeString)) 139 if (codeString == null || "".equals(codeString)) 140 return null; 141 if ("activating".equals(codeString)) 142 return UserSessionStatus.ACTIVATING; 143 if ("active".equals(codeString)) 144 return UserSessionStatus.ACTIVE; 145 if ("suspended".equals(codeString)) 146 return UserSessionStatus.SUSPENDED; 147 if ("closing".equals(codeString)) 148 return UserSessionStatus.CLOSING; 149 if ("closed".equals(codeString)) 150 return UserSessionStatus.CLOSED; 151 throw new IllegalArgumentException("Unknown UserSessionStatus code '"+codeString+"'"); 152 } 153 public Enumeration<UserSessionStatus> fromType(Base code) throws FHIRException { 154 if (code == null) 155 return null; 156 if (code.isEmpty()) 157 return new Enumeration<UserSessionStatus>(this); 158 String codeString = ((PrimitiveType) code).asStringValue(); 159 if (codeString == null || "".equals(codeString)) 160 return null; 161 if ("activating".equals(codeString)) 162 return new Enumeration<UserSessionStatus>(this, UserSessionStatus.ACTIVATING); 163 if ("active".equals(codeString)) 164 return new Enumeration<UserSessionStatus>(this, UserSessionStatus.ACTIVE); 165 if ("suspended".equals(codeString)) 166 return new Enumeration<UserSessionStatus>(this, UserSessionStatus.SUSPENDED); 167 if ("closing".equals(codeString)) 168 return new Enumeration<UserSessionStatus>(this, UserSessionStatus.CLOSING); 169 if ("closed".equals(codeString)) 170 return new Enumeration<UserSessionStatus>(this, UserSessionStatus.CLOSED); 171 throw new FHIRException("Unknown UserSessionStatus code '"+codeString+"'"); 172 } 173 public String toCode(UserSessionStatus code) { 174 if (code == UserSessionStatus.ACTIVATING) 175 return "activating"; 176 if (code == UserSessionStatus.ACTIVE) 177 return "active"; 178 if (code == UserSessionStatus.SUSPENDED) 179 return "suspended"; 180 if (code == UserSessionStatus.CLOSING) 181 return "closing"; 182 if (code == UserSessionStatus.CLOSED) 183 return "closed"; 184 return "?"; 185 } 186 public String toSystem(UserSessionStatus code) { 187 return code.getSystem(); 188 } 189 } 190 191 public enum UserSessionStatusSource { 192 /** 193 * The status was reported by the user. 194 */ 195 USER, 196 /** 197 * The status was reported by the system. 198 */ 199 SYSTEM, 200 /** 201 * added to help the parsers with the generic types 202 */ 203 NULL; 204 public static UserSessionStatusSource fromCode(String codeString) throws FHIRException { 205 if (codeString == null || "".equals(codeString)) 206 return null; 207 if ("user".equals(codeString)) 208 return USER; 209 if ("system".equals(codeString)) 210 return SYSTEM; 211 if (Configuration.isAcceptInvalidEnums()) 212 return null; 213 else 214 throw new FHIRException("Unknown UserSessionStatusSource code '"+codeString+"'"); 215 } 216 public String toCode() { 217 switch (this) { 218 case USER: return "user"; 219 case SYSTEM: return "system"; 220 default: return "?"; 221 } 222 } 223 public String getSystem() { 224 switch (this) { 225 case USER: return "http://hl7.org/fhir/usersession-status-source"; 226 case SYSTEM: return "http://hl7.org/fhir/usersession-status-source"; 227 default: return "?"; 228 } 229 } 230 public String getDefinition() { 231 switch (this) { 232 case USER: return "The status was reported by the user."; 233 case SYSTEM: return "The status was reported by the system."; 234 default: return "?"; 235 } 236 } 237 public String getDisplay() { 238 switch (this) { 239 case USER: return "User"; 240 case SYSTEM: return "System"; 241 default: return "?"; 242 } 243 } 244 } 245 246 public static class UserSessionStatusSourceEnumFactory implements EnumFactory<UserSessionStatusSource> { 247 public UserSessionStatusSource fromCode(String codeString) throws IllegalArgumentException { 248 if (codeString == null || "".equals(codeString)) 249 if (codeString == null || "".equals(codeString)) 250 return null; 251 if ("user".equals(codeString)) 252 return UserSessionStatusSource.USER; 253 if ("system".equals(codeString)) 254 return UserSessionStatusSource.SYSTEM; 255 throw new IllegalArgumentException("Unknown UserSessionStatusSource code '"+codeString+"'"); 256 } 257 public Enumeration<UserSessionStatusSource> fromType(Base code) throws FHIRException { 258 if (code == null) 259 return null; 260 if (code.isEmpty()) 261 return new Enumeration<UserSessionStatusSource>(this); 262 String codeString = ((PrimitiveType) code).asStringValue(); 263 if (codeString == null || "".equals(codeString)) 264 return null; 265 if ("user".equals(codeString)) 266 return new Enumeration<UserSessionStatusSource>(this, UserSessionStatusSource.USER); 267 if ("system".equals(codeString)) 268 return new Enumeration<UserSessionStatusSource>(this, UserSessionStatusSource.SYSTEM); 269 throw new FHIRException("Unknown UserSessionStatusSource code '"+codeString+"'"); 270 } 271 public String toCode(UserSessionStatusSource code) { 272 if (code == UserSessionStatusSource.USER) 273 return "user"; 274 if (code == UserSessionStatusSource.SYSTEM) 275 return "system"; 276 return "?"; 277 } 278 public String toSystem(UserSessionStatusSource code) { 279 return code.getSystem(); 280 } 281 } 282 283 @Block() 284 public static class UserSessionStatusComponent extends BackboneElement implements IBaseBackboneElement { 285 /** 286 * The current status of the user session. 287 */ 288 @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 289 @Description(shortDefinition="activating | active | suspended | closing | closed", formalDefinition="The current status of the user session." ) 290 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/usersession-status") 291 protected Enumeration<UserSessionStatus> code; 292 293 /** 294 * The source of the status code. 295 */ 296 @Child(name = "source", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true) 297 @Description(shortDefinition="user | system", formalDefinition="The source of the status code." ) 298 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/usersession-status-source") 299 protected Enumeration<UserSessionStatusSource> source; 300 301 private static final long serialVersionUID = 2003820253L; 302 303 /** 304 * Constructor 305 */ 306 public UserSessionStatusComponent() { 307 super(); 308 } 309 310 /** 311 * Constructor 312 */ 313 public UserSessionStatusComponent(Enumeration<UserSessionStatus> code, Enumeration<UserSessionStatusSource> source) { 314 super(); 315 this.code = code; 316 this.source = source; 317 } 318 319 /** 320 * @return {@link #code} (The current status of the user session.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 321 */ 322 public Enumeration<UserSessionStatus> getCodeElement() { 323 if (this.code == null) 324 if (Configuration.errorOnAutoCreate()) 325 throw new Error("Attempt to auto-create UserSessionStatusComponent.code"); 326 else if (Configuration.doAutoCreate()) 327 this.code = new Enumeration<UserSessionStatus>(new UserSessionStatusEnumFactory()); // bb 328 return this.code; 329 } 330 331 public boolean hasCodeElement() { 332 return this.code != null && !this.code.isEmpty(); 333 } 334 335 public boolean hasCode() { 336 return this.code != null && !this.code.isEmpty(); 337 } 338 339 /** 340 * @param value {@link #code} (The current status of the user session.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 341 */ 342 public UserSessionStatusComponent setCodeElement(Enumeration<UserSessionStatus> value) { 343 this.code = value; 344 return this; 345 } 346 347 /** 348 * @return The current status of the user session. 349 */ 350 public UserSessionStatus getCode() { 351 return this.code == null ? null : this.code.getValue(); 352 } 353 354 /** 355 * @param value The current status of the user session. 356 */ 357 public UserSessionStatusComponent setCode(UserSessionStatus value) { 358 if (this.code == null) 359 this.code = new Enumeration<UserSessionStatus>(new UserSessionStatusEnumFactory()); 360 this.code.setValue(value); 361 return this; 362 } 363 364 /** 365 * @return {@link #source} (The source of the status code.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value 366 */ 367 public Enumeration<UserSessionStatusSource> getSourceElement() { 368 if (this.source == null) 369 if (Configuration.errorOnAutoCreate()) 370 throw new Error("Attempt to auto-create UserSessionStatusComponent.source"); 371 else if (Configuration.doAutoCreate()) 372 this.source = new Enumeration<UserSessionStatusSource>(new UserSessionStatusSourceEnumFactory()); // bb 373 return this.source; 374 } 375 376 public boolean hasSourceElement() { 377 return this.source != null && !this.source.isEmpty(); 378 } 379 380 public boolean hasSource() { 381 return this.source != null && !this.source.isEmpty(); 382 } 383 384 /** 385 * @param value {@link #source} (The source of the status code.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value 386 */ 387 public UserSessionStatusComponent setSourceElement(Enumeration<UserSessionStatusSource> value) { 388 this.source = value; 389 return this; 390 } 391 392 /** 393 * @return The source of the status code. 394 */ 395 public UserSessionStatusSource getSource() { 396 return this.source == null ? null : this.source.getValue(); 397 } 398 399 /** 400 * @param value The source of the status code. 401 */ 402 public UserSessionStatusComponent setSource(UserSessionStatusSource value) { 403 if (this.source == null) 404 this.source = new Enumeration<UserSessionStatusSource>(new UserSessionStatusSourceEnumFactory()); 405 this.source.setValue(value); 406 return this; 407 } 408 409 protected void listChildren(List<Property> children) { 410 super.listChildren(children); 411 children.add(new Property("code", "code", "The current status of the user session.", 0, 1, code)); 412 children.add(new Property("source", "code", "The source of the status code.", 0, 1, source)); 413 } 414 415 @Override 416 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 417 switch (_hash) { 418 case 3059181: /*code*/ return new Property("code", "code", "The current status of the user session.", 0, 1, code); 419 case -896505829: /*source*/ return new Property("source", "code", "The source of the status code.", 0, 1, source); 420 default: return super.getNamedProperty(_hash, _name, _checkValid); 421 } 422 423 } 424 425 @Override 426 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 427 switch (hash) { 428 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<UserSessionStatus> 429 case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Enumeration<UserSessionStatusSource> 430 default: return super.getProperty(hash, name, checkValid); 431 } 432 433 } 434 435 @Override 436 public Base setProperty(int hash, String name, Base value) throws FHIRException { 437 switch (hash) { 438 case 3059181: // code 439 value = new UserSessionStatusEnumFactory().fromType(castToCode(value)); 440 this.code = (Enumeration) value; // Enumeration<UserSessionStatus> 441 return value; 442 case -896505829: // source 443 value = new UserSessionStatusSourceEnumFactory().fromType(castToCode(value)); 444 this.source = (Enumeration) value; // Enumeration<UserSessionStatusSource> 445 return value; 446 default: return super.setProperty(hash, name, value); 447 } 448 449 } 450 451 @Override 452 public Base setProperty(String name, Base value) throws FHIRException { 453 if (name.equals("code")) { 454 value = new UserSessionStatusEnumFactory().fromType(castToCode(value)); 455 this.code = (Enumeration) value; // Enumeration<UserSessionStatus> 456 } else if (name.equals("source")) { 457 value = new UserSessionStatusSourceEnumFactory().fromType(castToCode(value)); 458 this.source = (Enumeration) value; // Enumeration<UserSessionStatusSource> 459 } else 460 return super.setProperty(name, value); 461 return value; 462 } 463 464 @Override 465 public Base makeProperty(int hash, String name) throws FHIRException { 466 switch (hash) { 467 case 3059181: return getCodeElement(); 468 case -896505829: return getSourceElement(); 469 default: return super.makeProperty(hash, name); 470 } 471 472 } 473 474 @Override 475 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 476 switch (hash) { 477 case 3059181: /*code*/ return new String[] {"code"}; 478 case -896505829: /*source*/ return new String[] {"code"}; 479 default: return super.getTypesForProperty(hash, name); 480 } 481 482 } 483 484 @Override 485 public Base addChild(String name) throws FHIRException { 486 if (name.equals("code")) { 487 throw new FHIRException("Cannot call addChild on a primitive type UserSession.code"); 488 } 489 else if (name.equals("source")) { 490 throw new FHIRException("Cannot call addChild on a primitive type UserSession.source"); 491 } 492 else 493 return super.addChild(name); 494 } 495 496 public UserSessionStatusComponent copy() { 497 UserSessionStatusComponent dst = new UserSessionStatusComponent(); 498 copyValues(dst); 499 dst.code = code == null ? null : code.copy(); 500 dst.source = source == null ? null : source.copy(); 501 return dst; 502 } 503 504 @Override 505 public boolean equalsDeep(Base other_) { 506 if (!super.equalsDeep(other_)) 507 return false; 508 if (!(other_ instanceof UserSessionStatusComponent)) 509 return false; 510 UserSessionStatusComponent o = (UserSessionStatusComponent) other_; 511 return compareDeep(code, o.code, true) && compareDeep(source, o.source, true); 512 } 513 514 @Override 515 public boolean equalsShallow(Base other_) { 516 if (!super.equalsShallow(other_)) 517 return false; 518 if (!(other_ instanceof UserSessionStatusComponent)) 519 return false; 520 UserSessionStatusComponent o = (UserSessionStatusComponent) other_; 521 return compareValues(code, o.code, true) && compareValues(source, o.source, true); 522 } 523 524 public boolean isEmpty() { 525 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, source); 526 } 527 528 public String fhirType() { 529 return "UserSession.status"; 530 531 } 532 533 } 534 535 @Block() 536 public static class UserSessionContextComponent extends BackboneElement implements IBaseBackboneElement { 537 /** 538 * Indicates which type of context is being provided. 539 */ 540 @Child(name = "type", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false) 541 @Description(shortDefinition="What type of context value", formalDefinition="Indicates which type of context is being provided." ) 542 protected StringType type; 543 544 /** 545 * Provides the context value. 546 */ 547 @Child(name = "value", type = {CodeableConcept.class, Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false) 548 @Description(shortDefinition="Value of the context", formalDefinition="Provides the context value." ) 549 protected Type value; 550 551 private static final long serialVersionUID = -1035059584L; 552 553 /** 554 * Constructor 555 */ 556 public UserSessionContextComponent() { 557 super(); 558 } 559 560 /** 561 * Constructor 562 */ 563 public UserSessionContextComponent(StringType type) { 564 super(); 565 this.type = type; 566 } 567 568 /** 569 * @return {@link #type} (Indicates which type of context is being provided.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 570 */ 571 public StringType getTypeElement() { 572 if (this.type == null) 573 if (Configuration.errorOnAutoCreate()) 574 throw new Error("Attempt to auto-create UserSessionContextComponent.type"); 575 else if (Configuration.doAutoCreate()) 576 this.type = new StringType(); // bb 577 return this.type; 578 } 579 580 public boolean hasTypeElement() { 581 return this.type != null && !this.type.isEmpty(); 582 } 583 584 public boolean hasType() { 585 return this.type != null && !this.type.isEmpty(); 586 } 587 588 /** 589 * @param value {@link #type} (Indicates which type of context is being provided.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 590 */ 591 public UserSessionContextComponent setTypeElement(StringType value) { 592 this.type = value; 593 return this; 594 } 595 596 /** 597 * @return Indicates which type of context is being provided. 598 */ 599 public String getType() { 600 return this.type == null ? null : this.type.getValue(); 601 } 602 603 /** 604 * @param value Indicates which type of context is being provided. 605 */ 606 public UserSessionContextComponent setType(String value) { 607 if (this.type == null) 608 this.type = new StringType(); 609 this.type.setValue(value); 610 return this; 611 } 612 613 /** 614 * @return {@link #value} (Provides the context value.) 615 */ 616 public Type getValue() { 617 return this.value; 618 } 619 620 /** 621 * @return {@link #value} (Provides the context value.) 622 */ 623 public CodeableConcept getValueCodeableConcept() throws FHIRException { 624 if (this.value == null) 625 return null; 626 if (!(this.value instanceof CodeableConcept)) 627 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 628 return (CodeableConcept) this.value; 629 } 630 631 public boolean hasValueCodeableConcept() { 632 return this != null && this.value instanceof CodeableConcept; 633 } 634 635 /** 636 * @return {@link #value} (Provides the context value.) 637 */ 638 public Quantity getValueQuantity() throws FHIRException { 639 if (this.value == null) 640 return null; 641 if (!(this.value instanceof Quantity)) 642 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 643 return (Quantity) this.value; 644 } 645 646 public boolean hasValueQuantity() { 647 return this != null && this.value instanceof Quantity; 648 } 649 650 public boolean hasValue() { 651 return this.value != null && !this.value.isEmpty(); 652 } 653 654 /** 655 * @param value {@link #value} (Provides the context value.) 656 */ 657 public UserSessionContextComponent setValue(Type value) { 658 if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity)) 659 throw new Error("Not the right type for UserSession.context.value[x]: "+value.fhirType()); 660 this.value = value; 661 return this; 662 } 663 664 protected void listChildren(List<Property> children) { 665 super.listChildren(children); 666 children.add(new Property("type", "string", "Indicates which type of context is being provided.", 0, 1, type)); 667 children.add(new Property("value[x]", "CodeableConcept|Quantity", "Provides the context value.", 0, 1, value)); 668 } 669 670 @Override 671 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 672 switch (_hash) { 673 case 3575610: /*type*/ return new Property("type", "string", "Indicates which type of context is being provided.", 0, 1, type); 674 case -1410166417: /*value[x]*/ return new Property("value[x]", "CodeableConcept|Quantity", "Provides the context value.", 0, 1, value); 675 case 111972721: /*value*/ return new Property("value[x]", "CodeableConcept|Quantity", "Provides the context value.", 0, 1, value); 676 case 924902896: /*valueCodeableConcept*/ return new Property("value[x]", "CodeableConcept|Quantity", "Provides the context value.", 0, 1, value); 677 case -2029823716: /*valueQuantity*/ return new Property("value[x]", "CodeableConcept|Quantity", "Provides the context value.", 0, 1, value); 678 default: return super.getNamedProperty(_hash, _name, _checkValid); 679 } 680 681 } 682 683 @Override 684 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 685 switch (hash) { 686 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType 687 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type 688 default: return super.getProperty(hash, name, checkValid); 689 } 690 691 } 692 693 @Override 694 public Base setProperty(int hash, String name, Base value) throws FHIRException { 695 switch (hash) { 696 case 3575610: // type 697 this.type = castToString(value); // StringType 698 return value; 699 case 111972721: // value 700 this.value = castToType(value); // Type 701 return value; 702 default: return super.setProperty(hash, name, value); 703 } 704 705 } 706 707 @Override 708 public Base setProperty(String name, Base value) throws FHIRException { 709 if (name.equals("type")) { 710 this.type = castToString(value); // StringType 711 } else if (name.equals("value[x]")) { 712 this.value = castToType(value); // Type 713 } else 714 return super.setProperty(name, value); 715 return value; 716 } 717 718 @Override 719 public Base makeProperty(int hash, String name) throws FHIRException { 720 switch (hash) { 721 case 3575610: return getTypeElement(); 722 case -1410166417: return getValue(); 723 case 111972721: return getValue(); 724 default: return super.makeProperty(hash, name); 725 } 726 727 } 728 729 @Override 730 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 731 switch (hash) { 732 case 3575610: /*type*/ return new String[] {"string"}; 733 case 111972721: /*value*/ return new String[] {"CodeableConcept", "Quantity"}; 734 default: return super.getTypesForProperty(hash, name); 735 } 736 737 } 738 739 @Override 740 public Base addChild(String name) throws FHIRException { 741 if (name.equals("type")) { 742 throw new FHIRException("Cannot call addChild on a primitive type UserSession.type"); 743 } 744 else if (name.equals("valueCodeableConcept")) { 745 this.value = new CodeableConcept(); 746 return this.value; 747 } 748 else if (name.equals("valueQuantity")) { 749 this.value = new Quantity(); 750 return this.value; 751 } 752 else 753 return super.addChild(name); 754 } 755 756 public UserSessionContextComponent copy() { 757 UserSessionContextComponent dst = new UserSessionContextComponent(); 758 copyValues(dst); 759 dst.type = type == null ? null : type.copy(); 760 dst.value = value == null ? null : value.copy(); 761 return dst; 762 } 763 764 @Override 765 public boolean equalsDeep(Base other_) { 766 if (!super.equalsDeep(other_)) 767 return false; 768 if (!(other_ instanceof UserSessionContextComponent)) 769 return false; 770 UserSessionContextComponent o = (UserSessionContextComponent) other_; 771 return compareDeep(type, o.type, true) && compareDeep(value, o.value, true); 772 } 773 774 @Override 775 public boolean equalsShallow(Base other_) { 776 if (!super.equalsShallow(other_)) 777 return false; 778 if (!(other_ instanceof UserSessionContextComponent)) 779 return false; 780 UserSessionContextComponent o = (UserSessionContextComponent) other_; 781 return compareValues(type, o.type, true); 782 } 783 784 public boolean isEmpty() { 785 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value); 786 } 787 788 public String fhirType() { 789 return "UserSession.context"; 790 791 } 792 793 } 794 795 /** 796 * Allows a service to provide a unique, business identifier for the session. 797 */ 798 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 799 @Description(shortDefinition="Business identifier", formalDefinition="Allows a service to provide a unique, business identifier for the session." ) 800 protected Identifier identifier; 801 802 /** 803 * A practitioner, patient, device, or related person engaged in the session. 804 */ 805 @Child(name = "user", type = {Device.class, Practitioner.class, Patient.class, RelatedPerson.class}, order=1, min=1, max=1, modifier=false, summary=true) 806 @Description(shortDefinition="User engaged in the session", formalDefinition="A practitioner, patient, device, or related person engaged in the session." ) 807 protected Reference user; 808 809 /** 810 * The actual object that is the target of the reference (A practitioner, patient, device, or related person engaged in the session.) 811 */ 812 protected Resource userTarget; 813 814 /** 815 * Status of the session. 816 */ 817 @Child(name = "status", type = {}, order=2, min=0, max=1, modifier=false, summary=false) 818 @Description(shortDefinition="Status of the session", formalDefinition="Status of the session." ) 819 protected UserSessionStatusComponent status; 820 821 /** 822 * Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation. 823 */ 824 @Child(name = "workstation", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false) 825 @Description(shortDefinition="Where is the session", formalDefinition="Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation." ) 826 protected Identifier workstation; 827 828 /** 829 * The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc. 830 */ 831 @Child(name = "focus", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 832 @Description(shortDefinition="What is the user's current focus", formalDefinition="The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc." ) 833 protected List<Reference> focus; 834 /** 835 * The actual objects that are the target of the reference (The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc.) 836 */ 837 protected List<Resource> focusTarget; 838 839 840 /** 841 * Indicates the timestamp when the user session was first created. 842 */ 843 @Child(name = "created", type = {InstantType.class}, order=5, min=0, max=1, modifier=false, summary=false) 844 @Description(shortDefinition="When was the session created", formalDefinition="Indicates the timestamp when the user session was first created." ) 845 protected InstantType created; 846 847 /** 848 * Indicates the timestamp when the user session will expire (i.e. no longer be valid). 849 */ 850 @Child(name = "expires", type = {InstantType.class}, order=6, min=0, max=1, modifier=false, summary=true) 851 @Description(shortDefinition="When does the session expire", formalDefinition="Indicates the timestamp when the user session will expire (i.e. no longer be valid)." ) 852 protected InstantType expires; 853 854 /** 855 * Provides additional information associated with the context. 856 */ 857 @Child(name = "context", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 858 @Description(shortDefinition="Additional information about the session", formalDefinition="Provides additional information associated with the context." ) 859 protected List<UserSessionContextComponent> context; 860 861 private static final long serialVersionUID = -1422979558L; 862 863 /** 864 * Constructor 865 */ 866 public UserSession() { 867 super(); 868 } 869 870 /** 871 * Constructor 872 */ 873 public UserSession(Reference user) { 874 super(); 875 this.user = user; 876 } 877 878 /** 879 * @return {@link #identifier} (Allows a service to provide a unique, business identifier for the session.) 880 */ 881 public Identifier getIdentifier() { 882 if (this.identifier == null) 883 if (Configuration.errorOnAutoCreate()) 884 throw new Error("Attempt to auto-create UserSession.identifier"); 885 else if (Configuration.doAutoCreate()) 886 this.identifier = new Identifier(); // cc 887 return this.identifier; 888 } 889 890 public boolean hasIdentifier() { 891 return this.identifier != null && !this.identifier.isEmpty(); 892 } 893 894 /** 895 * @param value {@link #identifier} (Allows a service to provide a unique, business identifier for the session.) 896 */ 897 public UserSession setIdentifier(Identifier value) { 898 this.identifier = value; 899 return this; 900 } 901 902 /** 903 * @return {@link #user} (A practitioner, patient, device, or related person engaged in the session.) 904 */ 905 public Reference getUser() { 906 if (this.user == null) 907 if (Configuration.errorOnAutoCreate()) 908 throw new Error("Attempt to auto-create UserSession.user"); 909 else if (Configuration.doAutoCreate()) 910 this.user = new Reference(); // cc 911 return this.user; 912 } 913 914 public boolean hasUser() { 915 return this.user != null && !this.user.isEmpty(); 916 } 917 918 /** 919 * @param value {@link #user} (A practitioner, patient, device, or related person engaged in the session.) 920 */ 921 public UserSession setUser(Reference value) { 922 this.user = value; 923 return this; 924 } 925 926 /** 927 * @return {@link #user} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A practitioner, patient, device, or related person engaged in the session.) 928 */ 929 public Resource getUserTarget() { 930 return this.userTarget; 931 } 932 933 /** 934 * @param value {@link #user} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A practitioner, patient, device, or related person engaged in the session.) 935 */ 936 public UserSession setUserTarget(Resource value) { 937 this.userTarget = value; 938 return this; 939 } 940 941 /** 942 * @return {@link #status} (Status of the session.) 943 */ 944 public UserSessionStatusComponent getStatus() { 945 if (this.status == null) 946 if (Configuration.errorOnAutoCreate()) 947 throw new Error("Attempt to auto-create UserSession.status"); 948 else if (Configuration.doAutoCreate()) 949 this.status = new UserSessionStatusComponent(); // cc 950 return this.status; 951 } 952 953 public boolean hasStatus() { 954 return this.status != null && !this.status.isEmpty(); 955 } 956 957 /** 958 * @param value {@link #status} (Status of the session.) 959 */ 960 public UserSession setStatus(UserSessionStatusComponent value) { 961 this.status = value; 962 return this; 963 } 964 965 /** 966 * @return {@link #workstation} (Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation.) 967 */ 968 public Identifier getWorkstation() { 969 if (this.workstation == null) 970 if (Configuration.errorOnAutoCreate()) 971 throw new Error("Attempt to auto-create UserSession.workstation"); 972 else if (Configuration.doAutoCreate()) 973 this.workstation = new Identifier(); // cc 974 return this.workstation; 975 } 976 977 public boolean hasWorkstation() { 978 return this.workstation != null && !this.workstation.isEmpty(); 979 } 980 981 /** 982 * @param value {@link #workstation} (Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation.) 983 */ 984 public UserSession setWorkstation(Identifier value) { 985 this.workstation = value; 986 return this; 987 } 988 989 /** 990 * @return {@link #focus} (The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc.) 991 */ 992 public List<Reference> getFocus() { 993 if (this.focus == null) 994 this.focus = new ArrayList<Reference>(); 995 return this.focus; 996 } 997 998 /** 999 * @return Returns a reference to <code>this</code> for easy method chaining 1000 */ 1001 public UserSession setFocus(List<Reference> theFocus) { 1002 this.focus = theFocus; 1003 return this; 1004 } 1005 1006 public boolean hasFocus() { 1007 if (this.focus == null) 1008 return false; 1009 for (Reference item : this.focus) 1010 if (!item.isEmpty()) 1011 return true; 1012 return false; 1013 } 1014 1015 public Reference addFocus() { //3 1016 Reference t = new Reference(); 1017 if (this.focus == null) 1018 this.focus = new ArrayList<Reference>(); 1019 this.focus.add(t); 1020 return t; 1021 } 1022 1023 public UserSession addFocus(Reference t) { //3 1024 if (t == null) 1025 return this; 1026 if (this.focus == null) 1027 this.focus = new ArrayList<Reference>(); 1028 this.focus.add(t); 1029 return this; 1030 } 1031 1032 /** 1033 * @return The first repetition of repeating field {@link #focus}, creating it if it does not already exist 1034 */ 1035 public Reference getFocusFirstRep() { 1036 if (getFocus().isEmpty()) { 1037 addFocus(); 1038 } 1039 return getFocus().get(0); 1040 } 1041 1042 /** 1043 * @deprecated Use Reference#setResource(IBaseResource) instead 1044 */ 1045 @Deprecated 1046 public List<Resource> getFocusTarget() { 1047 if (this.focusTarget == null) 1048 this.focusTarget = new ArrayList<Resource>(); 1049 return this.focusTarget; 1050 } 1051 1052 /** 1053 * @return {@link #created} (Indicates the timestamp when the user session was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 1054 */ 1055 public InstantType getCreatedElement() { 1056 if (this.created == null) 1057 if (Configuration.errorOnAutoCreate()) 1058 throw new Error("Attempt to auto-create UserSession.created"); 1059 else if (Configuration.doAutoCreate()) 1060 this.created = new InstantType(); // bb 1061 return this.created; 1062 } 1063 1064 public boolean hasCreatedElement() { 1065 return this.created != null && !this.created.isEmpty(); 1066 } 1067 1068 public boolean hasCreated() { 1069 return this.created != null && !this.created.isEmpty(); 1070 } 1071 1072 /** 1073 * @param value {@link #created} (Indicates the timestamp when the user session was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value 1074 */ 1075 public UserSession setCreatedElement(InstantType value) { 1076 this.created = value; 1077 return this; 1078 } 1079 1080 /** 1081 * @return Indicates the timestamp when the user session was first created. 1082 */ 1083 public Date getCreated() { 1084 return this.created == null ? null : this.created.getValue(); 1085 } 1086 1087 /** 1088 * @param value Indicates the timestamp when the user session was first created. 1089 */ 1090 public UserSession setCreated(Date value) { 1091 if (value == null) 1092 this.created = null; 1093 else { 1094 if (this.created == null) 1095 this.created = new InstantType(); 1096 this.created.setValue(value); 1097 } 1098 return this; 1099 } 1100 1101 /** 1102 * @return {@link #expires} (Indicates the timestamp when the user session will expire (i.e. no longer be valid).). This is the underlying object with id, value and extensions. The accessor "getExpires" gives direct access to the value 1103 */ 1104 public InstantType getExpiresElement() { 1105 if (this.expires == null) 1106 if (Configuration.errorOnAutoCreate()) 1107 throw new Error("Attempt to auto-create UserSession.expires"); 1108 else if (Configuration.doAutoCreate()) 1109 this.expires = new InstantType(); // bb 1110 return this.expires; 1111 } 1112 1113 public boolean hasExpiresElement() { 1114 return this.expires != null && !this.expires.isEmpty(); 1115 } 1116 1117 public boolean hasExpires() { 1118 return this.expires != null && !this.expires.isEmpty(); 1119 } 1120 1121 /** 1122 * @param value {@link #expires} (Indicates the timestamp when the user session will expire (i.e. no longer be valid).). This is the underlying object with id, value and extensions. The accessor "getExpires" gives direct access to the value 1123 */ 1124 public UserSession setExpiresElement(InstantType value) { 1125 this.expires = value; 1126 return this; 1127 } 1128 1129 /** 1130 * @return Indicates the timestamp when the user session will expire (i.e. no longer be valid). 1131 */ 1132 public Date getExpires() { 1133 return this.expires == null ? null : this.expires.getValue(); 1134 } 1135 1136 /** 1137 * @param value Indicates the timestamp when the user session will expire (i.e. no longer be valid). 1138 */ 1139 public UserSession setExpires(Date value) { 1140 if (value == null) 1141 this.expires = null; 1142 else { 1143 if (this.expires == null) 1144 this.expires = new InstantType(); 1145 this.expires.setValue(value); 1146 } 1147 return this; 1148 } 1149 1150 /** 1151 * @return {@link #context} (Provides additional information associated with the context.) 1152 */ 1153 public List<UserSessionContextComponent> getContext() { 1154 if (this.context == null) 1155 this.context = new ArrayList<UserSessionContextComponent>(); 1156 return this.context; 1157 } 1158 1159 /** 1160 * @return Returns a reference to <code>this</code> for easy method chaining 1161 */ 1162 public UserSession setContext(List<UserSessionContextComponent> theContext) { 1163 this.context = theContext; 1164 return this; 1165 } 1166 1167 public boolean hasContext() { 1168 if (this.context == null) 1169 return false; 1170 for (UserSessionContextComponent item : this.context) 1171 if (!item.isEmpty()) 1172 return true; 1173 return false; 1174 } 1175 1176 public UserSessionContextComponent addContext() { //3 1177 UserSessionContextComponent t = new UserSessionContextComponent(); 1178 if (this.context == null) 1179 this.context = new ArrayList<UserSessionContextComponent>(); 1180 this.context.add(t); 1181 return t; 1182 } 1183 1184 public UserSession addContext(UserSessionContextComponent t) { //3 1185 if (t == null) 1186 return this; 1187 if (this.context == null) 1188 this.context = new ArrayList<UserSessionContextComponent>(); 1189 this.context.add(t); 1190 return this; 1191 } 1192 1193 /** 1194 * @return The first repetition of repeating field {@link #context}, creating it if it does not already exist 1195 */ 1196 public UserSessionContextComponent getContextFirstRep() { 1197 if (getContext().isEmpty()) { 1198 addContext(); 1199 } 1200 return getContext().get(0); 1201 } 1202 1203 protected void listChildren(List<Property> children) { 1204 super.listChildren(children); 1205 children.add(new Property("identifier", "Identifier", "Allows a service to provide a unique, business identifier for the session.", 0, 1, identifier)); 1206 children.add(new Property("user", "Reference(Device|Practitioner|Patient|RelatedPerson)", "A practitioner, patient, device, or related person engaged in the session.", 0, 1, user)); 1207 children.add(new Property("status", "", "Status of the session.", 0, 1, status)); 1208 children.add(new Property("workstation", "Identifier", "Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation.", 0, 1, workstation)); 1209 children.add(new Property("focus", "Reference(Any)", "The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc.", 0, java.lang.Integer.MAX_VALUE, focus)); 1210 children.add(new Property("created", "instant", "Indicates the timestamp when the user session was first created.", 0, 1, created)); 1211 children.add(new Property("expires", "instant", "Indicates the timestamp when the user session will expire (i.e. no longer be valid).", 0, 1, expires)); 1212 children.add(new Property("context", "", "Provides additional information associated with the context.", 0, java.lang.Integer.MAX_VALUE, context)); 1213 } 1214 1215 @Override 1216 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1217 switch (_hash) { 1218 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Allows a service to provide a unique, business identifier for the session.", 0, 1, identifier); 1219 case 3599307: /*user*/ return new Property("user", "Reference(Device|Practitioner|Patient|RelatedPerson)", "A practitioner, patient, device, or related person engaged in the session.", 0, 1, user); 1220 case -892481550: /*status*/ return new Property("status", "", "Status of the session.", 0, 1, status); 1221 case 581588227: /*workstation*/ return new Property("workstation", "Identifier", "Location that identifies the physical place at which the user's session is occurring. For the purposes of context synchronization, this is intended to represent the user's workstation.", 0, 1, workstation); 1222 case 97604824: /*focus*/ return new Property("focus", "Reference(Any)", "The current focus of the user's session. Common values are a reference to a Patient, Encounter, ImagingStudy, etc.", 0, java.lang.Integer.MAX_VALUE, focus); 1223 case 1028554472: /*created*/ return new Property("created", "instant", "Indicates the timestamp when the user session was first created.", 0, 1, created); 1224 case -1309235404: /*expires*/ return new Property("expires", "instant", "Indicates the timestamp when the user session will expire (i.e. no longer be valid).", 0, 1, expires); 1225 case 951530927: /*context*/ return new Property("context", "", "Provides additional information associated with the context.", 0, java.lang.Integer.MAX_VALUE, context); 1226 default: return super.getNamedProperty(_hash, _name, _checkValid); 1227 } 1228 1229 } 1230 1231 @Override 1232 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1233 switch (hash) { 1234 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 1235 case 3599307: /*user*/ return this.user == null ? new Base[0] : new Base[] {this.user}; // Reference 1236 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // UserSessionStatusComponent 1237 case 581588227: /*workstation*/ return this.workstation == null ? new Base[0] : new Base[] {this.workstation}; // Identifier 1238 case 97604824: /*focus*/ return this.focus == null ? new Base[0] : this.focus.toArray(new Base[this.focus.size()]); // Reference 1239 case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // InstantType 1240 case -1309235404: /*expires*/ return this.expires == null ? new Base[0] : new Base[] {this.expires}; // InstantType 1241 case 951530927: /*context*/ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // UserSessionContextComponent 1242 default: return super.getProperty(hash, name, checkValid); 1243 } 1244 1245 } 1246 1247 @Override 1248 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1249 switch (hash) { 1250 case -1618432855: // identifier 1251 this.identifier = castToIdentifier(value); // Identifier 1252 return value; 1253 case 3599307: // user 1254 this.user = castToReference(value); // Reference 1255 return value; 1256 case -892481550: // status 1257 this.status = (UserSessionStatusComponent) value; // UserSessionStatusComponent 1258 return value; 1259 case 581588227: // workstation 1260 this.workstation = castToIdentifier(value); // Identifier 1261 return value; 1262 case 97604824: // focus 1263 this.getFocus().add(castToReference(value)); // Reference 1264 return value; 1265 case 1028554472: // created 1266 this.created = castToInstant(value); // InstantType 1267 return value; 1268 case -1309235404: // expires 1269 this.expires = castToInstant(value); // InstantType 1270 return value; 1271 case 951530927: // context 1272 this.getContext().add((UserSessionContextComponent) value); // UserSessionContextComponent 1273 return value; 1274 default: return super.setProperty(hash, name, value); 1275 } 1276 1277 } 1278 1279 @Override 1280 public Base setProperty(String name, Base value) throws FHIRException { 1281 if (name.equals("identifier")) { 1282 this.identifier = castToIdentifier(value); // Identifier 1283 } else if (name.equals("user")) { 1284 this.user = castToReference(value); // Reference 1285 } else if (name.equals("status")) { 1286 this.status = (UserSessionStatusComponent) value; // UserSessionStatusComponent 1287 } else if (name.equals("workstation")) { 1288 this.workstation = castToIdentifier(value); // Identifier 1289 } else if (name.equals("focus")) { 1290 this.getFocus().add(castToReference(value)); 1291 } else if (name.equals("created")) { 1292 this.created = castToInstant(value); // InstantType 1293 } else if (name.equals("expires")) { 1294 this.expires = castToInstant(value); // InstantType 1295 } else if (name.equals("context")) { 1296 this.getContext().add((UserSessionContextComponent) value); 1297 } else 1298 return super.setProperty(name, value); 1299 return value; 1300 } 1301 1302 @Override 1303 public Base makeProperty(int hash, String name) throws FHIRException { 1304 switch (hash) { 1305 case -1618432855: return getIdentifier(); 1306 case 3599307: return getUser(); 1307 case -892481550: return getStatus(); 1308 case 581588227: return getWorkstation(); 1309 case 97604824: return addFocus(); 1310 case 1028554472: return getCreatedElement(); 1311 case -1309235404: return getExpiresElement(); 1312 case 951530927: return addContext(); 1313 default: return super.makeProperty(hash, name); 1314 } 1315 1316 } 1317 1318 @Override 1319 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1320 switch (hash) { 1321 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1322 case 3599307: /*user*/ return new String[] {"Reference"}; 1323 case -892481550: /*status*/ return new String[] {}; 1324 case 581588227: /*workstation*/ return new String[] {"Identifier"}; 1325 case 97604824: /*focus*/ return new String[] {"Reference"}; 1326 case 1028554472: /*created*/ return new String[] {"instant"}; 1327 case -1309235404: /*expires*/ return new String[] {"instant"}; 1328 case 951530927: /*context*/ return new String[] {}; 1329 default: return super.getTypesForProperty(hash, name); 1330 } 1331 1332 } 1333 1334 @Override 1335 public Base addChild(String name) throws FHIRException { 1336 if (name.equals("identifier")) { 1337 this.identifier = new Identifier(); 1338 return this.identifier; 1339 } 1340 else if (name.equals("user")) { 1341 this.user = new Reference(); 1342 return this.user; 1343 } 1344 else if (name.equals("status")) { 1345 this.status = new UserSessionStatusComponent(); 1346 return this.status; 1347 } 1348 else if (name.equals("workstation")) { 1349 this.workstation = new Identifier(); 1350 return this.workstation; 1351 } 1352 else if (name.equals("focus")) { 1353 return addFocus(); 1354 } 1355 else if (name.equals("created")) { 1356 throw new FHIRException("Cannot call addChild on a primitive type UserSession.created"); 1357 } 1358 else if (name.equals("expires")) { 1359 throw new FHIRException("Cannot call addChild on a primitive type UserSession.expires"); 1360 } 1361 else if (name.equals("context")) { 1362 return addContext(); 1363 } 1364 else 1365 return super.addChild(name); 1366 } 1367 1368 public String fhirType() { 1369 return "UserSession"; 1370 1371 } 1372 1373 public UserSession copy() { 1374 UserSession dst = new UserSession(); 1375 copyValues(dst); 1376 dst.identifier = identifier == null ? null : identifier.copy(); 1377 dst.user = user == null ? null : user.copy(); 1378 dst.status = status == null ? null : status.copy(); 1379 dst.workstation = workstation == null ? null : workstation.copy(); 1380 if (focus != null) { 1381 dst.focus = new ArrayList<Reference>(); 1382 for (Reference i : focus) 1383 dst.focus.add(i.copy()); 1384 }; 1385 dst.created = created == null ? null : created.copy(); 1386 dst.expires = expires == null ? null : expires.copy(); 1387 if (context != null) { 1388 dst.context = new ArrayList<UserSessionContextComponent>(); 1389 for (UserSessionContextComponent i : context) 1390 dst.context.add(i.copy()); 1391 }; 1392 return dst; 1393 } 1394 1395 protected UserSession typedCopy() { 1396 return copy(); 1397 } 1398 1399 @Override 1400 public boolean equalsDeep(Base other_) { 1401 if (!super.equalsDeep(other_)) 1402 return false; 1403 if (!(other_ instanceof UserSession)) 1404 return false; 1405 UserSession o = (UserSession) other_; 1406 return compareDeep(identifier, o.identifier, true) && compareDeep(user, o.user, true) && compareDeep(status, o.status, true) 1407 && compareDeep(workstation, o.workstation, true) && compareDeep(focus, o.focus, true) && compareDeep(created, o.created, true) 1408 && compareDeep(expires, o.expires, true) && compareDeep(context, o.context, true); 1409 } 1410 1411 @Override 1412 public boolean equalsShallow(Base other_) { 1413 if (!super.equalsShallow(other_)) 1414 return false; 1415 if (!(other_ instanceof UserSession)) 1416 return false; 1417 UserSession o = (UserSession) other_; 1418 return compareValues(created, o.created, true) && compareValues(expires, o.expires, true); 1419 } 1420 1421 public boolean isEmpty() { 1422 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, user, status 1423 , workstation, focus, created, expires, context); 1424 } 1425 1426 @Override 1427 public ResourceType getResourceType() { 1428 return ResourceType.UserSession; 1429 } 1430 1431 /** 1432 * Search parameter: <b>identifier</b> 1433 * <p> 1434 * Description: <b>External identifiers for the user session</b><br> 1435 * Type: <b>token</b><br> 1436 * Path: <b>UserSession.identifier</b><br> 1437 * </p> 1438 */ 1439 @SearchParamDefinition(name="identifier", path="UserSession.identifier", description="External identifiers for the user session", type="token" ) 1440 public static final String SP_IDENTIFIER = "identifier"; 1441 /** 1442 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1443 * <p> 1444 * Description: <b>External identifiers for the user session</b><br> 1445 * Type: <b>token</b><br> 1446 * Path: <b>UserSession.identifier</b><br> 1447 * </p> 1448 */ 1449 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1450 1451 /** 1452 * Search parameter: <b>patient</b> 1453 * <p> 1454 * Description: <b>The identity of a patient to search for user sessions</b><br> 1455 * Type: <b>reference</b><br> 1456 * Path: <b>UserSession.focus</b><br> 1457 * </p> 1458 */ 1459 @SearchParamDefinition(name="patient", path="UserSession.focus.where(resolve() is Patient)", description="The identity of a patient to search for user sessions", type="reference", target={Patient.class } ) 1460 public static final String SP_PATIENT = "patient"; 1461 /** 1462 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1463 * <p> 1464 * Description: <b>The identity of a patient to search for user sessions</b><br> 1465 * Type: <b>reference</b><br> 1466 * Path: <b>UserSession.focus</b><br> 1467 * </p> 1468 */ 1469 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1470 1471/** 1472 * Constant for fluent queries to be used to add include statements. Specifies 1473 * the path value of "<b>UserSession:patient</b>". 1474 */ 1475 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("UserSession:patient").toLocked(); 1476 1477 /** 1478 * Search parameter: <b>focus</b> 1479 * <p> 1480 * Description: <b>The focus of the user session</b><br> 1481 * Type: <b>reference</b><br> 1482 * Path: <b>UserSession.focus</b><br> 1483 * </p> 1484 */ 1485 @SearchParamDefinition(name="focus", path="UserSession.focus", description="The focus of the user session", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") } ) 1486 public static final String SP_FOCUS = "focus"; 1487 /** 1488 * <b>Fluent Client</b> search parameter constant for <b>focus</b> 1489 * <p> 1490 * Description: <b>The focus of the user session</b><br> 1491 * Type: <b>reference</b><br> 1492 * Path: <b>UserSession.focus</b><br> 1493 * </p> 1494 */ 1495 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOCUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FOCUS); 1496 1497/** 1498 * Constant for fluent queries to be used to add include statements. Specifies 1499 * the path value of "<b>UserSession:focus</b>". 1500 */ 1501 public static final ca.uhn.fhir.model.api.Include INCLUDE_FOCUS = new ca.uhn.fhir.model.api.Include("UserSession:focus").toLocked(); 1502 1503 /** 1504 * Search parameter: <b>workstation</b> 1505 * <p> 1506 * Description: <b>The workstation of the session</b><br> 1507 * Type: <b>token</b><br> 1508 * Path: <b>UserSession.workstation</b><br> 1509 * </p> 1510 */ 1511 @SearchParamDefinition(name="workstation", path="UserSession.workstation", description="The workstation of the session", type="token" ) 1512 public static final String SP_WORKSTATION = "workstation"; 1513 /** 1514 * <b>Fluent Client</b> search parameter constant for <b>workstation</b> 1515 * <p> 1516 * Description: <b>The workstation of the session</b><br> 1517 * Type: <b>token</b><br> 1518 * Path: <b>UserSession.workstation</b><br> 1519 * </p> 1520 */ 1521 public static final ca.uhn.fhir.rest.gclient.TokenClientParam WORKSTATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_WORKSTATION); 1522 1523 /** 1524 * Search parameter: <b>user</b> 1525 * <p> 1526 * Description: <b>The user of the session</b><br> 1527 * Type: <b>reference</b><br> 1528 * Path: <b>UserSession.user</b><br> 1529 * </p> 1530 */ 1531 @SearchParamDefinition(name="user", path="UserSession.user", description="The user of the session", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Patient.class, Practitioner.class, RelatedPerson.class } ) 1532 public static final String SP_USER = "user"; 1533 /** 1534 * <b>Fluent Client</b> search parameter constant for <b>user</b> 1535 * <p> 1536 * Description: <b>The user of the session</b><br> 1537 * Type: <b>reference</b><br> 1538 * Path: <b>UserSession.user</b><br> 1539 * </p> 1540 */ 1541 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam USER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_USER); 1542 1543/** 1544 * Constant for fluent queries to be used to add include statements. Specifies 1545 * the path value of "<b>UserSession:user</b>". 1546 */ 1547 public static final ca.uhn.fhir.model.api.Include INCLUDE_USER = new ca.uhn.fhir.model.api.Include("UserSession:user").toLocked(); 1548 1549 /** 1550 * Search parameter: <b>status</b> 1551 * <p> 1552 * Description: <b>The status of the user session</b><br> 1553 * Type: <b>token</b><br> 1554 * Path: <b>UserSession.status.code</b><br> 1555 * </p> 1556 */ 1557 @SearchParamDefinition(name="status", path="UserSession.status.code", description="The status of the user session", type="token" ) 1558 public static final String SP_STATUS = "status"; 1559 /** 1560 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1561 * <p> 1562 * Description: <b>The status of the user session</b><br> 1563 * Type: <b>token</b><br> 1564 * Path: <b>UserSession.status.code</b><br> 1565 * </p> 1566 */ 1567 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1568 1569 1570} 1571