
001package org.hl7.fhir.r5.openehr; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.r5.openehr.Enumerations.*; 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.r5.model.*; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046 047/** 048 * Capability of a role, such as ehr modifier, health care provider. Capability should be backed up by credentials. 049 */ 050@DatatypeDef(name="CAPABILITY") 051public class CAPABILITY extends LOCATABLE implements ICompositeType { 052 053 /** 054 * The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc. 055 */ 056 @Child(name = "credentials", type = {ITEM_STRUCTURE.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="The qualifications of the performer of the role for this capability", formalDefinition="The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc." ) 058 protected ITEM_STRUCTURE credentials; 059 060 /** 061 * Valid time interval for the credentials of this capability. 062 */ 063 @Child(name = "time_validity", type = {DV_INTERVAL.class}, order=1, min=0, max=1, modifier=false, summary=false) 064 @Description(shortDefinition="Valid time interval for the credentials of this capability", formalDefinition="Valid time interval for the credentials of this capability." ) 065 protected DV_INTERVAL time_validity; 066 067 private static final long serialVersionUID = -541927433L; 068 069 /** 070 * Constructor 071 */ 072 public CAPABILITY() { 073 super(); 074 } 075 076 /** 077 * Constructor 078 */ 079 public CAPABILITY(ITEM_STRUCTURE credentials) { 080 super(); 081 this.setCredentials(credentials); 082 } 083 084 /** 085 * @return {@link #credentials} (The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc.) 086 */ 087 public ITEM_STRUCTURE getCredentials() { 088 return this.credentials; 089 } 090 091 public boolean hasCredentials() { 092 return this.credentials != null && !this.credentials.isEmpty(); 093 } 094 095 /** 096 * @param value {@link #credentials} (The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc.) 097 */ 098 public CAPABILITY setCredentials(ITEM_STRUCTURE value) { 099 this.credentials = value; 100 return this; 101 } 102 103 /** 104 * @return {@link #time_validity} (Valid time interval for the credentials of this capability.) 105 */ 106 public DV_INTERVAL getTime_validity() { 107 if (this.time_validity == null) 108 if (Configuration.errorOnAutoCreate()) 109 throw new Error("Attempt to auto-create CAPABILITY.time_validity"); 110 else if (Configuration.doAutoCreate()) 111 this.time_validity = new DV_INTERVAL(); // cc 112 return this.time_validity; 113 } 114 115 public boolean hasTime_validity() { 116 return this.time_validity != null && !this.time_validity.isEmpty(); 117 } 118 119 /** 120 * @param value {@link #time_validity} (Valid time interval for the credentials of this capability.) 121 */ 122 public CAPABILITY setTime_validity(DV_INTERVAL value) { 123 this.time_validity = value; 124 return this; 125 } 126 127 protected void listChildren(List<Property> children) { 128 super.listChildren(children); 129 children.add(new Property("credentials", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc.", 0, 1, credentials)); 130 children.add(new Property("time_validity", "http://openehr.org/fhir/StructureDefinition/DV-INTERVAL", "Valid time interval for the credentials of this capability.", 0, 1, time_validity)); 131 } 132 133 @Override 134 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 135 switch (_hash) { 136 case 288957180: /*credentials*/ return new Property("credentials", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "The qualifications of the performer of the role for this capability. This might include professional qualifications and official identifications such as provider numbers etc.", 0, 1, credentials); 137 case -1304171420: /*time_validity*/ return new Property("time_validity", "http://openehr.org/fhir/StructureDefinition/DV-INTERVAL", "Valid time interval for the credentials of this capability.", 0, 1, time_validity); 138 default: return super.getNamedProperty(_hash, _name, _checkValid); 139 } 140 141 } 142 143 @Override 144 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 145 switch (hash) { 146 case 288957180: /*credentials*/ return this.credentials == null ? new Base[0] : new Base[] {this.credentials}; // ITEM_STRUCTURE 147 case -1304171420: /*time_validity*/ return this.time_validity == null ? new Base[0] : new Base[] {this.time_validity}; // DV_INTERVAL 148 default: return super.getProperty(hash, name, checkValid); 149 } 150 151 } 152 153 @Override 154 public Base setProperty(int hash, String name, Base value) throws FHIRException { 155 switch (hash) { 156 case 288957180: // credentials 157 this.credentials = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 158 return value; 159 case -1304171420: // time_validity 160 this.time_validity = (DV_INTERVAL) value; // DV_INTERVAL 161 return value; 162 default: return super.setProperty(hash, name, value); 163 } 164 165 } 166 167 @Override 168 public Base setProperty(String name, Base value) throws FHIRException { 169 if (name.equals("credentials")) { 170 this.credentials = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 171 } else if (name.equals("time_validity")) { 172 this.time_validity = (DV_INTERVAL) value; // DV_INTERVAL 173 } else 174 return super.setProperty(name, value); 175 return value; 176 } 177 178 @Override 179 public Base makeProperty(int hash, String name) throws FHIRException { 180 switch (hash) { 181 case 288957180: /*div*/ 182 throw new Error("Unable to make an instance of the abstract property 'credentials'"); 183 case -1304171420: return getTime_validity(); 184 default: return super.makeProperty(hash, name); 185 } 186 187 } 188 189 @Override 190 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 191 switch (hash) { 192 case 288957180: /*credentials*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"}; 193 case -1304171420: /*time_validity*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-INTERVAL"}; 194 default: return super.getTypesForProperty(hash, name); 195 } 196 197 } 198 199 @Override 200 public Base addChild(String name) throws FHIRException { 201 if (name.equals("credentials")) { 202 throw new FHIRException("Cannot call addChild on an abstract type CAPABILITY.credentials"); 203 } 204 else if (name.equals("time_validity")) { 205 this.time_validity = new DV_INTERVAL(); 206 return this.time_validity; 207 } 208 else 209 return super.addChild(name); 210 } 211 212 public String fhirType() { 213 return "CAPABILITY"; 214 215 } 216 217 public CAPABILITY copy() { 218 CAPABILITY dst = new CAPABILITY(); 219 copyValues(dst); 220 return dst; 221 } 222 223 public void copyValues(CAPABILITY dst) { 224 super.copyValues(dst); 225 dst.credentials = credentials == null ? null : credentials.copy(); 226 dst.time_validity = time_validity == null ? null : time_validity.copy(); 227 } 228 229 protected CAPABILITY typedCopy() { 230 return copy(); 231 } 232 233 @Override 234 public boolean equalsDeep(Base other_) { 235 if (!super.equalsDeep(other_)) 236 return false; 237 if (!(other_ instanceof CAPABILITY)) 238 return false; 239 CAPABILITY o = (CAPABILITY) other_; 240 return compareDeep(credentials, o.credentials, true) && compareDeep(time_validity, o.time_validity, true) 241 ; 242 } 243 244 @Override 245 public boolean equalsShallow(Base other_) { 246 if (!super.equalsShallow(other_)) 247 return false; 248 if (!(other_ instanceof CAPABILITY)) 249 return false; 250 CAPABILITY o = (CAPABILITY) other_; 251 return true; 252 } 253 254 public boolean isEmpty() { 255 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(credentials, time_validity 256 ); 257 } 258 259 260} 261