Update RI structures

This commit is contained in:
James Agnew 2015-05-22 17:32:36 -04:00
parent b89ee3d2a7
commit ec3c94a823
182 changed files with 156245 additions and 154576 deletions

View File

@ -52,7 +52,7 @@ import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.ICompositeType; import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement; import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.instance.model.api.IBaseDatatype; import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseEnumFactory; import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
@ -510,7 +510,7 @@ class ModelScanner {
RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName); RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName);
orderMap.put(order, def); orderMap.put(order, def);
} else if (IRefImplResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) { } else if (IAnyResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) {
/* /*
* Child is a resource as a direct child, as in Bundle.entry.resource * Child is a resource as a direct child, as in Bundle.entry.resource
*/ */

View File

@ -29,7 +29,7 @@ import java.util.Map;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
@ -58,7 +58,7 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
try { try {
IBaseResource instance = theClass.newInstance(); IBaseResource instance = theClass.newInstance();
if (instance instanceof IRefImplResource) { if (instance instanceof IAnyResource) {
myStructureVersion = FhirVersionEnum.DSTU2_HL7ORG; myStructureVersion = FhirVersionEnum.DSTU2_HL7ORG;
} else { } else {
myStructureVersion = ((IResource)instance).getStructureFhirVersionEnum(); myStructureVersion = ((IResource)instance).getStructureFhirVersionEnum();

View File

@ -26,7 +26,7 @@ import java.util.Map;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
@ -56,7 +56,7 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>(); myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>();
for (Class<? extends IBaseResource> next : myResourceTypes) { for (Class<? extends IBaseResource> next : myResourceTypes) {
if (next.equals(IResource.class) || next.equals(IRefImplResource.class) || next.equals(IBaseResource.class)) { if (next.equals(IResource.class) || next.equals(IAnyResource.class) || next.equals(IBaseResource.class)) {
continue; continue;
} }
RuntimeResourceDefinition definition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next); RuntimeResourceDefinition definition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);

View File

@ -29,7 +29,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype;
@ -546,8 +546,8 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
throw new NullPointerException("theResource can not be null"); throw new NullPointerException("theResource can not be null");
} else if (theResouce instanceof IResource) { } else if (theResouce instanceof IResource) {
((IResource) theResouce).setId(new IdDt(getValue())); ((IResource) theResouce).setId(new IdDt(getValue()));
} else if (theResouce instanceof IRefImplResource) { } else if (theResouce instanceof IAnyResource) {
((IRefImplResource) theResouce).setId(getValue()); ((IAnyResource) theResouce).setId(getValue());
} else { } else {
throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource"); throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource");
} }

View File

@ -40,7 +40,7 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IDomainResource; import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseReference;
@ -95,8 +95,8 @@ public abstract class BaseParser implements IParser {
} }
} }
} else if (theTarget instanceof IDomainResource) { } else if (theTarget instanceof IDomainResource) {
List<? extends IRefImplResource> containedResources = ((IDomainResource) theTarget).getContained(); List<? extends IAnyResource> containedResources = ((IDomainResource) theTarget).getContained();
for (IRefImplResource next : containedResources) { for (IAnyResource next : containedResources) {
String nextId = next.getIdElement().getValue(); String nextId = next.getIdElement().getValue();
if (StringUtils.isNotBlank(nextId)) { if (StringUtils.isNotBlank(nextId)) {
if (!nextId.startsWith("#")) { if (!nextId.startsWith("#")) {

View File

@ -54,7 +54,7 @@ import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseBinary; import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype; import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
import org.hl7.fhir.instance.model.api.IBaseDatatype; import org.hl7.fhir.instance.model.api.IBaseDatatype;
@ -676,8 +676,8 @@ public class JsonParser extends BaseParser implements IParser {
resourceId = res.getId().getIdPart(); resourceId = res.getId().getIdPart();
} }
} }
} else if (theResource instanceof IRefImplResource) { } else if (theResource instanceof IAnyResource) {
IRefImplResource res = (IRefImplResource) theResource; IAnyResource res = (IAnyResource) theResource;
if (/*theContainedResource && */ StringUtils.isNotBlank(res.getIdElement().getIdPart())) { if (/*theContainedResource && */ StringUtils.isNotBlank(res.getIdElement().getIdPart())) {
resourceId = res.getIdElement().getIdPart(); resourceId = res.getIdElement().getIdPart();
} }

View File

@ -50,7 +50,7 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseBinary; import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IBaseDatatype; import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseExtension;
@ -751,7 +751,7 @@ public class XmlParser extends BaseParser implements IParser {
} }
} else { } else {
// HL7 structs // HL7 structs
IRefImplResource resource = (IRefImplResource) theResource; IAnyResource resource = (IAnyResource) theResource;
if (StringUtils.isNotBlank(resource.getIdElement().getIdPart())) { if (StringUtils.isNotBlank(resource.getIdElement().getIdPart())) {
resourceId = resource.getIdElement().getIdPart(); resourceId = resource.getIdElement().getIdPart();
} }
@ -777,7 +777,7 @@ public class XmlParser extends BaseParser implements IParser {
theEventWriter.writeStartElement(resDef.getName()); theEventWriter.writeStartElement(resDef.getName());
theEventWriter.writeDefaultNamespace(FHIR_NS); theEventWriter.writeDefaultNamespace(FHIR_NS);
if (theResource instanceof IRefImplResource) { if (theResource instanceof IAnyResource) {
// HL7.org Structures // HL7.org Structures
writeOptionalTagWithValue(theEventWriter, "id", theResourceId); writeOptionalTagWithValue(theEventWriter, "id", theResourceId);

View File

@ -28,7 +28,7 @@ import org.apache.http.client.utils.DateUtils;
import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
@ -460,8 +460,8 @@ public class MethodUtil {
if (resource instanceof IResource) { if (resource instanceof IResource) {
InstantDt lmValue = new InstantDt(headerDateValue); InstantDt lmValue = new InstantDt(headerDateValue);
((IResource) resource).getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue); ((IResource) resource).getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
} else if (resource instanceof IRefImplResource) { } else if (resource instanceof IAnyResource) {
((IRefImplResource) resource).getMeta().setLastUpdated(headerDateValue); ((IAnyResource) resource).getMeta().setLastUpdated(headerDateValue);
} }
} catch (Exception e) { } catch (Exception e) {
ourLog.warn("Unable to parse date string '{}'. Error is: {}", headerValue, e.toString()); ourLog.warn("Unable to parse date string '{}'. Error is: {}", headerValue, e.toString());
@ -505,8 +505,8 @@ public class MethodUtil {
} }
if (resource instanceof IResource) { if (resource instanceof IResource) {
ResourceMetadataKeyEnum.TAG_LIST.put((IResource) resource, tagList); ResourceMetadataKeyEnum.TAG_LIST.put((IResource) resource, tagList);
} else if (resource instanceof IRefImplResource) { } else if (resource instanceof IAnyResource) {
IBaseMetaType meta = ((IRefImplResource) resource).getMeta(); IBaseMetaType meta = ((IAnyResource) resource).getMeta();
for (Tag next : tagList) { for (Tag next : tagList) {
meta.addTag().setSystem(next.getScheme()).setCode(next.getTerm()).setDisplay(next.getLabel()); meta.addTag().setSystem(next.getScheme()).setCode(next.getTerm()).setDisplay(next.getLabel());
} }

View File

@ -41,7 +41,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.DateUtils; import org.apache.http.client.utils.DateUtils;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseBinary; import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
@ -148,7 +148,7 @@ public class RestfulServerUtils {
} }
} }
} else { } else {
Date lastUpdated = ((IRefImplResource)theResource).getMeta().getLastUpdated(); Date lastUpdated = ((IAnyResource)theResource).getMeta().getLastUpdated();
if (lastUpdated != null) { if (lastUpdated != null) {
theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated)); theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated));
} }

View File

@ -21,11 +21,11 @@ package org.hl7.fhir.instance.model.api;
*/ */
public interface IRefImplResource extends IBaseResource { public interface IAnyResource extends IBaseResource {
String getId(); String getId();
IRefImplResource setId(String theId); IAnyResource setId(String theId);
IIdType getIdElement(); IIdType getIdElement();

View File

@ -0,0 +1,26 @@
package org.hl7.fhir.instance.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface IBackboneElement extends IBase {
}

View File

@ -43,5 +43,5 @@ public interface IBaseBundle extends IBaseResource {
* this bundle. * this bundle.
*/ */
public static final String LINK_SELF = "self"; public static final String LINK_SELF = "self";
} }

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model.api; package org.hl7.fhir.instance.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface IBaseConformance extends IBaseResource { public interface IBaseConformance extends IBaseResource {

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model.api; package org.hl7.fhir.instance.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface IBaseXhtml extends IPrimitiveType<String> { public interface IBaseXhtml extends IPrimitiveType<String> {

View File

@ -22,9 +22,9 @@ package org.hl7.fhir.instance.model.api;
import java.util.List; import java.util.List;
public interface IDomainResource extends IRefImplResource { public interface IDomainResource extends IAnyResource {
List<? extends IRefImplResource> getContained(); List<? extends IAnyResource> getContained();
INarrative getText(); INarrative getText();

View File

@ -27,26 +27,21 @@
<version>${servlet_api_version}</version> <version>${servlet_api_version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- <!-- <dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId>
<version>8.7</version> </dependency> -->
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
<version>1.1.4c</version>
</dependency>
<dependency> <dependency>
<groupId>net.sf.saxon</groupId> <groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId> <artifactId>Saxon-HE</artifactId>
<version>8.7</version> <version>9.6.0-4</version>
</dependency> </dependency>
-->
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
<version>1.1.4c</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.6.0-4</version>
</dependency>
<!-- Testing --> <!-- Testing -->
<dependency> <dependency>
@ -192,6 +187,15 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${maven_license_plugin_version}</version>
<configuration>
<!-- Don't add UHN licenses to RI structures -->
<skipUpdateLicense>true</skipUpdateLicense>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -40,7 +40,7 @@ import org.hl7.fhir.instance.model.InstantType;
import org.hl7.fhir.instance.model.OperationOutcome; import org.hl7.fhir.instance.model.OperationOutcome;
import org.hl7.fhir.instance.model.Resource; import org.hl7.fhir.instance.model.Resource;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IDomainResource; import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseReference;
@ -93,7 +93,7 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
IDomainResource next = (IDomainResource) nextBaseRes; IDomainResource next = (IDomainResource) nextBaseRes;
Set<String> containedIds = new HashSet<String>(); Set<String> containedIds = new HashSet<String>();
for (IRefImplResource nextContained : next.getContained()) { for (IAnyResource nextContained : next.getContained()) {
if (nextContained.getId().isEmpty() == false) { if (nextContained.getId().isEmpty() == false) {
containedIds.add(nextContained.getIdElement().getValue()); containedIds.add(nextContained.getIdElement().getValue());
} }

View File

@ -1,111 +1,90 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import org.hl7.fhir.instance.model.annotations.DatatypeDef;
and/or other materials provided with the distribution. import org.hl7.fhir.instance.model.annotations.Block;
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.api.*;
endorse or promote products derived from this software without specific /**
prior written permission. * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND @DatatypeDef(name="Age")
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED public class Age extends Quantity {
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, private static final long serialVersionUID = -483422721L;
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public Age copy() {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, Age dst = new Age();
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) copyValues(dst);
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dst.value = value == null ? null : value.copy();
POSSIBILITY OF SUCH DAMAGE. dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy();
*/ dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 return dst;
}
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block; protected Age typedCopy() {
import org.hl7.fhir.instance.model.api.*; return copy();
/** }
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/ @Override
@DatatypeDef(name="Age") public boolean equalsDeep(Base other) {
public class Age extends Quantity { if (!super.equalsDeep(other))
return false;
private static final long serialVersionUID = -483422721L; if (!(other instanceof Age))
return false;
public Age copy() { Age o = (Age) other;
Age dst = new Age(); return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
copyValues(dst); && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
dst.value = value == null ? null : value.copy(); }
dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy(); @Override
dst.system = system == null ? null : system.copy(); public boolean equalsShallow(Base other) {
dst.code = code == null ? null : code.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Age))
return false;
protected Age typedCopy() { Age o = (Age) other;
return copy(); return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
} && compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
return false; && (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
if (!(other instanceof Age)) ;
return false; }
Age o = (Age) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true); }
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Age))
return false;
Age o = (Age) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -1,164 +1,143 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.annotations.Child;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.Description;
prior written permission. import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.api.*;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED /**
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * Base definition for all elements that are defined inside a resource - but not those in a data type.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, */
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT @DatatypeDef(name="BackboneElement")
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public abstract class BackboneElement extends Element implements IBaseBackboneElement {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) /**
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.
POSSIBILITY OF SUCH DAMAGE. */
@Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
*/ @Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." )
protected List<Extension> modifierExtension;
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
private static final long serialVersionUID = -1431673179L;
import java.util.*;
/*
import org.hl7.fhir.instance.model.annotations.Child; * Constructor
import org.hl7.fhir.instance.model.annotations.Description; */
import org.hl7.fhir.instance.model.annotations.DatatypeDef; public BackboneElement() {
import org.hl7.fhir.instance.model.annotations.Block; super();
import org.hl7.fhir.instance.model.api.*; }
/**
* Base definition for all elements that are defined inside a resource - but not those in a data type. /**
*/ * @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.)
@DatatypeDef(name="BackboneElement") */
public abstract class BackboneElement extends Element implements IBaseBackboneElement { public List<Extension> getModifierExtension() {
if (this.modifierExtension == null)
/** this.modifierExtension = new ArrayList<Extension>();
* May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. return this.modifierExtension;
*/ }
@Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." ) public boolean hasModifierExtension() {
protected List<Extension> modifierExtension; if (this.modifierExtension == null)
return false;
private static final long serialVersionUID = -1431673179L; for (Extension item : this.modifierExtension)
if (!item.isEmpty())
/* return true;
* Constructor return false;
*/ }
public BackboneElement() {
super(); /**
} * @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.)
*/
/** // syntactic sugar
* @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.) public Extension addModifierExtension() { //3
*/ Extension t = new Extension();
public List<Extension> getModifierExtension() { if (this.modifierExtension == null)
if (this.modifierExtension == null) this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension = new ArrayList<Extension>(); this.modifierExtension.add(t);
return this.modifierExtension; return t;
} }
public boolean hasModifierExtension() { // syntactic sugar
if (this.modifierExtension == null) public BackboneElement addModifierExtension(Extension t) { //3
return false; if (t == null)
for (Extension item : this.modifierExtension) return this;
if (!item.isEmpty()) if (this.modifierExtension == null)
return true; this.modifierExtension = new ArrayList<Extension>();
return false; this.modifierExtension.add(t);
} return this;
}
/**
* @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.) protected void listChildren(List<Property> childrenList) {
*/ childrenList.add(new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", 0, java.lang.Integer.MAX_VALUE, modifierExtension));
// syntactic sugar }
public Extension addModifierExtension() { //3
Extension t = new Extension(); public abstract BackboneElement copy();
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>(); public void copyValues(BackboneElement dst) {
this.modifierExtension.add(t); if (modifierExtension != null) {
return t; dst.modifierExtension = new ArrayList<Extension>();
} for (Extension i : modifierExtension)
dst.modifierExtension.add(i.copy());
// syntactic sugar };
public BackboneElement addModifierExtension(Extension t) { //3 }
if (t == null)
return this; @Override
if (this.modifierExtension == null) public boolean equalsDeep(Base other) {
this.modifierExtension = new ArrayList<Extension>(); if (!super.equalsDeep(other))
this.modifierExtension.add(t); return false;
return this; if (!(other instanceof BackboneElement))
} return false;
BackboneElement o = (BackboneElement) other;
protected void listChildren(List<Property> childrenList) { return compareDeep(modifierExtension, o.modifierExtension, true);
childrenList.add(new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", 0, java.lang.Integer.MAX_VALUE, modifierExtension)); }
}
@Override
public abstract BackboneElement copy(); public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
public void copyValues(BackboneElement dst) { return false;
if (modifierExtension != null) { if (!(other instanceof BackboneElement))
dst.modifierExtension = new ArrayList<Extension>(); return false;
for (Extension i : modifierExtension) BackboneElement o = (BackboneElement) other;
dst.modifierExtension.add(i.copy()); return true;
}; }
}
public boolean isEmpty() {
@Override return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty());
public boolean equalsDeep(Base other) { }
if (!super.equalsDeep(other))
return false;
if (!(other instanceof BackboneElement)) }
return false;
BackboneElement o = (BackboneElement) other;
return compareDeep(modifierExtension, o.modifierExtension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof BackboneElement))
return false;
BackboneElement o = (BackboneElement) other;
return true;
}
public boolean isEmpty() {
return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty());
}
}

View File

@ -1,178 +1,157 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import java.io.Serializable;
* #%L import java.util.ArrayList;
* HAPI FHIR Structures - HL7.org DSTU2 import java.util.HashMap;
* %% import java.util.List;
* Copyright (C) 2014 - 2015 University Health Network import java.util.Map;
* %%
* Licensed under the Apache License, Version 2.0 (the "License"); import org.hl7.fhir.instance.model.api.IBase;
* you may not use this file except in compliance with the License. import org.hl7.fhir.utilities.xhtml.XhtmlNode;
* You may obtain a copy of the License at
* public abstract class Base implements Serializable, IBase {
* http://www.apache.org/licenses/LICENSE-2.0
* /**
* Unless required by applicable law or agreed to in writing, software * User appended data items - allow users to add extra information to the class
* distributed under the License is distributed on an "AS IS" BASIS, */
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. private Map<String, Object> userData;
* See the License for the specific language governing permissions and
* limitations under the License. /**
* #L% * Round tracking xml comments for testing convenience
*/ */
private List<String> formatComments;
import java.io.Serializable;
import java.util.ArrayList; public Object getUserData(String name) {
import java.util.HashMap; if (userData == null)
import java.util.List; return null;
import java.util.Map; return userData.get(name);
}
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; public void setUserData(String name, Object value) {
if (userData == null)
public abstract class Base implements Serializable, IBase { userData = new HashMap<String, Object>();
userData.put(name, value);
/** }
* User appended data items - allow users to add extra information to the class
*/ public boolean hasUserData(String name) {
private Map<String, Object> userData; if (userData == null)
return false;
/** else
* Round tracking xml comments for testing convenience return userData.containsKey(name);
*/ }
private List<String> formatComments;
public String getUserString(String name) {
return (String) getUserData(name);
public Object getUserData(String name) { }
if (userData == null)
return null; public boolean hasFormatComment() {
return userData.get(name); return (formatComments != null && !formatComments.isEmpty());
} }
public void setUserData(String name, Object value) { public List<String> getFormatComments() {
if (userData == null) if (formatComments == null)
userData = new HashMap<String, Object>(); formatComments = new ArrayList<String>();
userData.put(name, value); return formatComments;
} }
public boolean hasUserData(String name) { protected abstract void listChildren(List<Property> result) ;
if (userData == null)
return false; /**
else * Supports iterating the children elements in some generic processor or browser
return userData.containsKey(name); * All defined children will be listed, even if they have no value on this instance
} *
* Note that the actual content of primitive or xhtml elements is not iterated explicitly.
public String getUserString(String name) { * To find these, the processing code must recognise the element as a primitive, typecast
return (String) getUserData(name); * the value to a {@link Type}, and examine the value
} *
* @return a list of all the children defined for this element
public boolean hasFormatComment() { */
return (formatComments != null && !formatComments.isEmpty()); public List<Property> children() {
} List<Property> result = new ArrayList<Property>();
listChildren(result);
public List<String> getFormatComments() { return result;
if (formatComments == null) }
formatComments = new ArrayList<String>();
return formatComments; public Property getChildByName(String name) {
} List<Property> children = new ArrayList<Property>();
listChildren(children);
protected abstract void listChildren(List<Property> result) ; for (Property c : children)
if (c.getName().equals(name))
/** return c;
* Supports iterating the children elements in some generic processor or browser return null;
* All defined children will be listed, even if they have no value on this instance }
*
* Note that the actual content of primitive or xhtml elements is not iterated explicitly. public List<Base> listChildrenByName(String name) {
* To find these, the processing code must recognise the element as a primitive, typecast List<Property> children = new ArrayList<Property>();
* the value to a {@link Type}, and examine the value listChildren(children);
* for (Property c : children)
* @return a list of all the children defined for this element if (c.getName().equals(name) || (c.getName().endsWith("[x]") && name.startsWith(c.getName())))
*/ return c.getValues();
public List<Property> children() { return new ArrayList<Base>();
List<Property> result = new ArrayList<Property>(); }
listChildren(result);
return result; public boolean isEmpty() {
} return true; // userData does not count
}
public Property getChildByName(String name) {
List<Property> children = new ArrayList<Property>(); public boolean equalsDeep(Base other) {
listChildren(children); return other != null;
for (Property c : children) }
if (c.getName().equals(name))
return c; public boolean equalsShallow(Base other) {
return null; return other != null;
} }
public List<Base> listChildrenByName(String name) { public static boolean compareDeep(List<? extends Base> e1, List<? extends Base> e2, boolean allowNull) {
List<Property> children = new ArrayList<Property>(); if (e1 == null && e2 == null && allowNull)
listChildren(children); return true;
for (Property c : children) if (e1 == null || e2 == null)
if (c.getName().equals(name) || (c.getName().endsWith("[x]") && name.startsWith(c.getName()))) return false;
return c.getValues(); if (e1.size() != e2.size())
return new ArrayList<Base>(); return false;
} for (int i = 0; i < e1.size(); i++) {
if (!compareDeep(e1.get(i), e2.get(i), allowNull))
public boolean isEmpty() { return false;
return true; // userData does not count }
} return true;
}
public boolean equalsDeep(Base other) { public static boolean compareDeep(Base e1, Base e2, boolean allowNull) {
return other != null; if (e1 == null && e2 == null && allowNull)
} return true;
if (e1 == null || e2 == null)
public boolean equalsShallow(Base other) { return false;
return other != null; return e1.equalsDeep(e2);
} }
public static boolean compareDeep(List<? extends Base> e1, List<? extends Base> e2, boolean allowNull) { public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) {
if (e1 == null && e2 == null && allowNull) if (div1 == null && div2 == null && allowNull)
return true; return true;
if (e1 == null || e2 == null) if (div1 == null || div2 == null)
return false; return false;
if (e1.size() != e2.size()) return div1.equalsDeep(div2);
return false; }
for (int i = 0; i < e1.size(); i++) {
if (!compareDeep(e1.get(i), e2.get(i), allowNull))
return false; public static boolean compareValues(List<? extends PrimitiveType> e1, List<? extends PrimitiveType> e2, boolean allowNull) {
} if (e1 == null && e2 == null && allowNull)
return true; return true;
} if (e1 == null || e2 == null)
public static boolean compareDeep(Base e1, Base e2, boolean allowNull) { return false;
if (e1 == null && e2 == null && allowNull) if (e1.size() != e2.size())
return true; return false;
if (e1 == null || e2 == null) for (int i = 0; i < e1.size(); i++) {
return false; if (!compareValues(e1.get(i), e2.get(i), allowNull))
return e1.equalsDeep(e2); return false;
} }
return true;
public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) { }
if (div1 == null && div2 == null && allowNull)
return true; public static boolean compareValues(PrimitiveType e1, PrimitiveType e2, boolean allowNull) {
if (div1 == null || div2 == null) if (e1 == null && e2 == null && allowNull)
return false; return true;
return div1.equalsDeep(div2); if (e1 == null || e2 == null)
} return false;
return e1.equalsShallow(e2);
}
public static boolean compareValues(List<? extends PrimitiveType> e1, List<? extends PrimitiveType> e2, boolean allowNull) { }
if (e1 == null && e2 == null && allowNull)
return true;
if (e1 == null || e2 == null)
return false;
if (e1.size() != e2.size())
return false;
for (int i = 0; i < e1.size(); i++) {
if (!compareValues(e1.get(i), e2.get(i), allowNull))
return false;
}
return true;
}
public static boolean compareValues(PrimitiveType e1, PrimitiveType e2, boolean allowNull) {
if (e1 == null && e2 == null && allowNull)
return true;
if (e1 == null || e2 == null)
return false;
return e1.equalsShallow(e2);
}
}

View File

@ -1,93 +1,72 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import org.apache.commons.codec.binary.Base64;
* #%L import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* HAPI FHIR Structures - HL7.org DSTU2
* %% /**
* Copyright (C) 2014 - 2015 University Health Network * Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64
* %% */
* Licensed under the Apache License, Version 2.0 (the "License"); @DatatypeDef(name="base64binary")
* you may not use this file except in compliance with the License. public class Base64BinaryType extends PrimitiveType<byte[]> {
* You may obtain a copy of the License at
* private static final long serialVersionUID = 3L;
* http://www.apache.org/licenses/LICENSE-2.0
* /**
* Unless required by applicable law or agreed to in writing, software * Constructor
* distributed under the License is distributed on an "AS IS" BASIS, */
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. public Base64BinaryType() {
* See the License for the specific language governing permissions and super();
* limitations under the License. }
* #L%
*/ public Base64BinaryType(byte[] theBytes) {
super();
setValue(theBytes);
import org.apache.commons.codec.binary.Base64; }
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
public Base64BinaryType(String theValue) {
/** super();
* Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64 setValueAsString(theValue);
*/ }
@DatatypeDef(name="base64binary")
public class Base64BinaryType extends PrimitiveType<byte[]> { protected byte[] parse(String theValue) {
return Base64.decodeBase64(theValue);
private static final long serialVersionUID = 3L; }
/** protected String encode(byte[] theValue) {
* Constructor return Base64.encodeBase64String(theValue);
*/ }
public Base64BinaryType() {
super(); @Override
} public Base64BinaryType copy() {
return new Base64BinaryType(getValue());
public Base64BinaryType(byte[] theBytes) { }
super();
setValue(theBytes); }
}
public Base64BinaryType(String theValue) {
super();
setValueAsString(theValue);
}
protected byte[] parse(String theValue) {
return Base64.decodeBase64(theValue);
}
protected String encode(byte[] theValue) {
return Base64.encodeBase64String(theValue);
}
@Override
public Base64BinaryType copy() {
return new Base64BinaryType(getValue());
}
}

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IBaseBinary; import org.hl7.fhir.instance.model.api.IBaseBinary;
public abstract class BaseBinary extends Resource implements IBaseBinary { public abstract class BaseBinary extends Resource implements IBaseBinary {

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IBaseDatatype; import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasExtensions;

View File

@ -1,25 +1,5 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.INarrative; import org.hl7.fhir.instance.model.api.INarrative;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;

View File

@ -1,30 +1,10 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.ICompositeType; import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IRefImplResource; import org.hl7.fhir.instance.model.api.IAnyResource;
public abstract class BaseReference extends Type implements IBaseReference, ICompositeType { public abstract class BaseReference extends Type implements IBaseReference, ICompositeType {
@ -45,7 +25,7 @@ public abstract class BaseReference extends Type implements IBaseReference, ICom
} }
} }
public BaseReference(IRefImplResource theResource) { public BaseReference(IAnyResource theResource) {
resource = theResource; resource = theResource;
} }

View File

@ -1,31 +1,13 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import org.hl7.fhir.instance.model.api.IAnyResource;
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IRefImplResource;
public abstract class BaseResource extends Base implements IRefImplResource { public abstract class BaseResource extends Base implements IAnyResource {
/** private static final long serialVersionUID = 1L;
/**
* @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes.
*/ */
public BaseResource setId(IIdType value) { public BaseResource setId(IIdType value) {

View File

@ -1,394 +1,373 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.annotations.ResourceDef;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
prior written permission. import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic")
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, public class Basic extends DomainResource {
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE /**
POSSIBILITY OF SUCH DAMAGE. * Identifier assigned to the resource for business purposes, outside the context of FHIR.
*/
*/ @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the resource for business purposes, outside the context of FHIR." )
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 protected List<Identifier> identifier;
import java.util.*; /**
* Identifies the 'type' of resource - equivalent to the resource name for other resources.
import org.hl7.fhir.instance.model.annotations.ResourceDef; */
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1)
import org.hl7.fhir.instance.model.annotations.Child; @Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
import org.hl7.fhir.instance.model.annotations.Description; protected CodeableConcept code;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; /**
/** * Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.
* Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification. */
*/ @Child(name = "subject", type = {}, order=2, min=0, max=1)
@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic") @Description(shortDefinition="Identifies the", formalDefinition="Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce." )
public class Basic extends DomainResource { protected Reference subject;
/** /**
* Identifier assigned to the resource for business purposes, outside the context of FHIR. * The actual object that is the target of the reference (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
*/ */
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED) protected Resource subjectTarget;
@Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the resource for business purposes, outside the context of FHIR." )
protected List<Identifier> identifier; /**
* Indicates who was responsible for creating the resource instance.
/** */
* Identifies the 'type' of resource - equivalent to the resource name for other resources. @Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1)
*/ @Description(shortDefinition="Who created", formalDefinition="Indicates who was responsible for creating the resource instance." )
@Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1) protected Reference author;
@Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
protected CodeableConcept code; /**
* The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.)
/** */
* Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce. protected Resource authorTarget;
*/
@Child(name = "subject", type = {}, order=2, min=0, max=1) /**
@Description(shortDefinition="Identifies the", formalDefinition="Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce." ) * Identifies when the resource was first created.
protected Reference subject; */
@Child(name = "created", type = {DateType.class}, order=4, min=0, max=1)
/** @Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." )
* The actual object that is the target of the reference (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.) protected DateType created;
*/
protected Resource subjectTarget; private static final long serialVersionUID = 916539354L;
/** /*
* Indicates who was responsible for creating the resource instance. * Constructor
*/ */
@Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1) public Basic() {
@Description(shortDefinition="Who created", formalDefinition="Indicates who was responsible for creating the resource instance." ) super();
protected Reference author; }
/** /*
* The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.) * Constructor
*/ */
protected Resource authorTarget; public Basic(CodeableConcept code) {
super();
/** this.code = code;
* Identifies when the resource was first created. }
*/
@Child(name = "created", type = {DateType.class}, order=4, min=0, max=1) /**
@Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." ) * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
protected DateType created; */
public List<Identifier> getIdentifier() {
private static final long serialVersionUID = 916539354L; if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
/* return this.identifier;
* Constructor }
*/
public Basic() { public boolean hasIdentifier() {
super(); if (this.identifier == null)
} return false;
for (Identifier item : this.identifier)
/* if (!item.isEmpty())
* Constructor return true;
*/ return false;
public Basic(CodeableConcept code) { }
super();
this.code = code; /**
} * @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
*/
/** // syntactic sugar
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.) public Identifier addIdentifier() { //3
*/ Identifier t = new Identifier();
public List<Identifier> getIdentifier() { if (this.identifier == null)
if (this.identifier == null) this.identifier = new ArrayList<Identifier>();
this.identifier = new ArrayList<Identifier>(); this.identifier.add(t);
return this.identifier; return t;
} }
public boolean hasIdentifier() { // syntactic sugar
if (this.identifier == null) public Basic addIdentifier(Identifier t) { //3
return false; if (t == null)
for (Identifier item : this.identifier) return this;
if (!item.isEmpty()) if (this.identifier == null)
return true; this.identifier = new ArrayList<Identifier>();
return false; this.identifier.add(t);
} return this;
}
/**
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.) /**
*/ * @return {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
// syntactic sugar */
public Identifier addIdentifier() { //3 public CodeableConcept getCode() {
Identifier t = new Identifier(); if (this.code == null)
if (this.identifier == null) if (Configuration.errorOnAutoCreate())
this.identifier = new ArrayList<Identifier>(); throw new Error("Attempt to auto-create Basic.code");
this.identifier.add(t); else if (Configuration.doAutoCreate())
return t; this.code = new CodeableConcept(); // cc
} return this.code;
}
// syntactic sugar
public Basic addIdentifier(Identifier t) { //3 public boolean hasCode() {
if (t == null) return this.code != null && !this.code.isEmpty();
return this; }
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>(); /**
this.identifier.add(t); * @param value {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
return this; */
} public Basic setCode(CodeableConcept value) {
this.code = value;
/** return this;
* @return {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.) }
*/
public CodeableConcept getCode() { /**
if (this.code == null) * @return {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create Basic.code"); public Reference getSubject() {
else if (Configuration.doAutoCreate()) if (this.subject == null)
this.code = new CodeableConcept(); // cc if (Configuration.errorOnAutoCreate())
return this.code; throw new Error("Attempt to auto-create Basic.subject");
} else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
public boolean hasCode() { return this.subject;
return this.code != null && !this.code.isEmpty(); }
}
public boolean hasSubject() {
/** return this.subject != null && !this.subject.isEmpty();
* @param value {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.) }
*/
public Basic setCode(CodeableConcept value) { /**
this.code = value; * @param value {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
return this; */
} public Basic setSubject(Reference value) {
this.subject = value;
/** return this;
* @return {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.) }
*/
public Reference getSubject() { /**
if (this.subject == null) * @return {@link #subject} 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. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create Basic.subject"); public Resource getSubjectTarget() {
else if (Configuration.doAutoCreate()) return this.subjectTarget;
this.subject = new Reference(); // cc }
return this.subject;
} /**
* @param value {@link #subject} 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. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
public boolean hasSubject() { */
return this.subject != null && !this.subject.isEmpty(); public Basic setSubjectTarget(Resource value) {
} this.subjectTarget = value;
return this;
/** }
* @param value {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.)
*/ /**
public Basic setSubject(Reference value) { * @return {@link #author} (Indicates who was responsible for creating the resource instance.)
this.subject = value; */
return this; public Reference getAuthor() {
} if (this.author == null)
if (Configuration.errorOnAutoCreate())
/** throw new Error("Attempt to auto-create Basic.author");
* @return {@link #subject} 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. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.) else if (Configuration.doAutoCreate())
*/ this.author = new Reference(); // cc
public Resource getSubjectTarget() { return this.author;
return this.subjectTarget; }
}
public boolean hasAuthor() {
/** return this.author != null && !this.author.isEmpty();
* @param value {@link #subject} 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. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.) }
*/
public Basic setSubjectTarget(Resource value) { /**
this.subjectTarget = value; * @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
return this; */
} public Basic setAuthor(Reference value) {
this.author = value;
/** return this;
* @return {@link #author} (Indicates who was responsible for creating the resource instance.) }
*/
public Reference getAuthor() { /**
if (this.author == null) * @return {@link #author} 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. (Indicates who was responsible for creating the resource instance.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create Basic.author"); public Resource getAuthorTarget() {
else if (Configuration.doAutoCreate()) return this.authorTarget;
this.author = new Reference(); // cc }
return this.author;
} /**
* @param value {@link #author} 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. (Indicates who was responsible for creating the resource instance.)
public boolean hasAuthor() { */
return this.author != null && !this.author.isEmpty(); public Basic setAuthorTarget(Resource value) {
} this.authorTarget = value;
return this;
/** }
* @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
*/ /**
public Basic setAuthor(Reference value) { * @return {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
this.author = value; */
return this; public DateType getCreatedElement() {
} if (this.created == null)
if (Configuration.errorOnAutoCreate())
/** throw new Error("Attempt to auto-create Basic.created");
* @return {@link #author} 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. (Indicates who was responsible for creating the resource instance.) else if (Configuration.doAutoCreate())
*/ this.created = new DateType(); // bb
public Resource getAuthorTarget() { return this.created;
return this.authorTarget; }
}
public boolean hasCreatedElement() {
/** return this.created != null && !this.created.isEmpty();
* @param value {@link #author} 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. (Indicates who was responsible for creating the resource instance.) }
*/
public Basic setAuthorTarget(Resource value) { public boolean hasCreated() {
this.authorTarget = value; return this.created != null && !this.created.isEmpty();
return this; }
}
/**
/** * @param value {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
* @return {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value */
*/ public Basic setCreatedElement(DateType value) {
public DateType getCreatedElement() { this.created = value;
if (this.created == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Basic.created");
else if (Configuration.doAutoCreate()) /**
this.created = new DateType(); // bb * @return Identifies when the resource was first created.
return this.created; */
} public Date getCreated() {
return this.created == null ? null : this.created.getValue();
public boolean hasCreatedElement() { }
return this.created != null && !this.created.isEmpty();
} /**
* @param value Identifies when the resource was first created.
public boolean hasCreated() { */
return this.created != null && !this.created.isEmpty(); public Basic setCreated(Date value) {
} if (value == null)
this.created = null;
/** else {
* @param value {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value if (this.created == null)
*/ this.created = new DateType();
public Basic setCreatedElement(DateType value) { this.created.setValue(value);
this.created = value; }
return this; return this;
} }
/** protected void listChildren(List<Property> childrenList) {
* @return Identifies when the resource was first created. super.listChildren(childrenList);
*/ childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the resource for business purposes, outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier));
public Date getCreated() { childrenList.add(new Property("code", "CodeableConcept", "Identifies the 'type' of resource - equivalent to the resource name for other resources.", 0, java.lang.Integer.MAX_VALUE, code));
return this.created == null ? null : this.created.getValue(); childrenList.add(new Property("subject", "Reference(Any)", "Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce.", 0, java.lang.Integer.MAX_VALUE, subject));
} childrenList.add(new Property("author", "Reference(Practitioner|Patient|RelatedPerson)", "Indicates who was responsible for creating the resource instance.", 0, java.lang.Integer.MAX_VALUE, author));
childrenList.add(new Property("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created));
/** }
* @param value Identifies when the resource was first created.
*/ public Basic copy() {
public Basic setCreated(Date value) { Basic dst = new Basic();
if (value == null) copyValues(dst);
this.created = null; if (identifier != null) {
else { dst.identifier = new ArrayList<Identifier>();
if (this.created == null) for (Identifier i : identifier)
this.created = new DateType(); dst.identifier.add(i.copy());
this.created.setValue(value); };
} dst.code = code == null ? null : code.copy();
return this; dst.subject = subject == null ? null : subject.copy();
} dst.author = author == null ? null : author.copy();
dst.created = created == null ? null : created.copy();
protected void listChildren(List<Property> childrenList) { return dst;
super.listChildren(childrenList); }
childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the resource for business purposes, outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("code", "CodeableConcept", "Identifies the 'type' of resource - equivalent to the resource name for other resources.", 0, java.lang.Integer.MAX_VALUE, code)); protected Basic typedCopy() {
childrenList.add(new Property("subject", "Reference(Any)", "Identifies the patient, practitioner, device or any other resource that is the 'focus' of this resoruce.", 0, java.lang.Integer.MAX_VALUE, subject)); return copy();
childrenList.add(new Property("author", "Reference(Practitioner|Patient|RelatedPerson)", "Indicates who was responsible for creating the resource instance.", 0, java.lang.Integer.MAX_VALUE, author)); }
childrenList.add(new Property("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created));
} @Override
public boolean equalsDeep(Base other) {
public Basic copy() { if (!super.equalsDeep(other))
Basic dst = new Basic(); return false;
copyValues(dst); if (!(other instanceof Basic))
if (identifier != null) { return false;
dst.identifier = new ArrayList<Identifier>(); Basic o = (Basic) other;
for (Identifier i : identifier) return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
dst.identifier.add(i.copy()); && compareDeep(author, o.author, true) && compareDeep(created, o.created, true);
}; }
dst.code = code == null ? null : code.copy();
dst.subject = subject == null ? null : subject.copy(); @Override
dst.author = author == null ? null : author.copy(); public boolean equalsShallow(Base other) {
dst.created = created == null ? null : created.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Basic))
return false;
protected Basic typedCopy() { Basic o = (Basic) other;
return copy(); return compareValues(created, o.created, true);
} }
@Override public boolean isEmpty() {
public boolean equalsDeep(Base other) { return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty())
if (!super.equalsDeep(other)) && (subject == null || subject.isEmpty()) && (author == null || author.isEmpty()) && (created == null || created.isEmpty())
return false; ;
if (!(other instanceof Basic)) }
return false;
Basic o = (Basic) other; @Override
return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) public ResourceType getResourceType() {
&& compareDeep(author, o.author, true) && compareDeep(created, o.created, true); return ResourceType.Basic;
} }
@Override @SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" )
public boolean equalsShallow(Base other) { public static final String SP_CODE = "code";
if (!super.equalsShallow(other)) @SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the", type="reference" )
return false; public static final String SP_SUBJECT = "subject";
if (!(other instanceof Basic)) @SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
return false; public static final String SP_CREATED = "created";
Basic o = (Basic) other; @SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the", type="reference" )
return compareValues(created, o.created, true); public static final String SP_PATIENT = "patient";
} @SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" )
public static final String SP_AUTHOR = "author";
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty()) }
&& (subject == null || subject.isEmpty()) && (author == null || author.isEmpty()) && (created == null || created.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Basic;
}
@SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" )
public static final String SP_AUTHOR = "author";
@SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
public static final String SP_CREATED = "created";
@SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" )
public static final String SP_CODE = "code";
}

View File

@ -1,244 +1,223 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.ResourceDef;
prior written permission. import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
import org.hl7.fhir.instance.model.annotations.Child;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Description;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.annotations.Block;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. import org.hl7.fhir.instance.model.api.*;
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, /**
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, @ResourceDef(name="Binary", profile="http://hl7.org/fhir/Profile/Binary")
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) public class Binary extends BaseBinary implements IBaseBinary {
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. /**
* MimeType of the binary content represented as a standard MimeType (BCP 13).
*/ */
@Child(name = "contentType", type = {CodeType.class}, order=0, min=1, max=1)
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 @Description(shortDefinition="MimeType of the binary content", formalDefinition="MimeType of the binary content represented as a standard MimeType (BCP 13)." )
protected CodeType contentType;
import java.util.*;
/**
import org.hl7.fhir.utilities.Utilities; * The actual content, base64 encoded.
import org.hl7.fhir.instance.model.annotations.ResourceDef; */
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; @Child(name = "content", type = {Base64BinaryType.class}, order=1, min=1, max=1)
import org.hl7.fhir.instance.model.annotations.Child; @Description(shortDefinition="The actual content", formalDefinition="The actual content, base64 encoded." )
import org.hl7.fhir.instance.model.annotations.Description; protected Base64BinaryType content;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; private static final long serialVersionUID = 974764407L;
/**
* A binary resource can contain any content, whether text, image, pdf, zip archive, etc. /*
*/ * Constructor
@ResourceDef(name="Binary", profile="http://hl7.org/fhir/Profile/Binary") */
public class Binary extends BaseBinary implements IBaseBinary { public Binary() {
super();
/** }
* MimeType of the binary content represented as a standard MimeType (BCP 13).
*/ /*
@Child(name = "contentType", type = {CodeType.class}, order=0, min=1, max=1) * Constructor
@Description(shortDefinition="MimeType of the binary content", formalDefinition="MimeType of the binary content represented as a standard MimeType (BCP 13)." ) */
protected CodeType contentType; public Binary(CodeType contentType, Base64BinaryType content) {
super();
/** this.contentType = contentType;
* The actual content, base64 encoded. this.content = content;
*/ }
@Child(name = "content", type = {Base64BinaryType.class}, order=1, min=1, max=1)
@Description(shortDefinition="The actual content", formalDefinition="The actual content, base64 encoded." ) /**
protected Base64BinaryType content; * @return {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
*/
private static final long serialVersionUID = 974764407L; public CodeType getContentTypeElement() {
if (this.contentType == null)
/* if (Configuration.errorOnAutoCreate())
* Constructor throw new Error("Attempt to auto-create Binary.contentType");
*/ else if (Configuration.doAutoCreate())
public Binary() { this.contentType = new CodeType(); // bb
super(); return this.contentType;
} }
/* public boolean hasContentTypeElement() {
* Constructor return this.contentType != null && !this.contentType.isEmpty();
*/ }
public Binary(CodeType contentType, Base64BinaryType content) {
super(); public boolean hasContentType() {
this.contentType = contentType; return this.contentType != null && !this.contentType.isEmpty();
this.content = content; }
}
/**
/** * @param value {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
* @return {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value */
*/ public Binary setContentTypeElement(CodeType value) {
public CodeType getContentTypeElement() { this.contentType = value;
if (this.contentType == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Binary.contentType");
else if (Configuration.doAutoCreate()) /**
this.contentType = new CodeType(); // bb * @return MimeType of the binary content represented as a standard MimeType (BCP 13).
return this.contentType; */
} public String getContentType() {
return this.contentType == null ? null : this.contentType.getValue();
public boolean hasContentTypeElement() { }
return this.contentType != null && !this.contentType.isEmpty();
} /**
* @param value MimeType of the binary content represented as a standard MimeType (BCP 13).
public boolean hasContentType() { */
return this.contentType != null && !this.contentType.isEmpty(); public Binary setContentType(String value) {
} if (this.contentType == null)
this.contentType = new CodeType();
/** this.contentType.setValue(value);
* @param value {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value return this;
*/ }
public Binary setContentTypeElement(CodeType value) {
this.contentType = value; /**
return this; * @return {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
} */
public Base64BinaryType getContentElement() {
/** if (this.content == null)
* @return MimeType of the binary content represented as a standard MimeType (BCP 13). if (Configuration.errorOnAutoCreate())
*/ throw new Error("Attempt to auto-create Binary.content");
public String getContentType() { else if (Configuration.doAutoCreate())
return this.contentType == null ? null : this.contentType.getValue(); this.content = new Base64BinaryType(); // bb
} return this.content;
}
/**
* @param value MimeType of the binary content represented as a standard MimeType (BCP 13). public boolean hasContentElement() {
*/ return this.content != null && !this.content.isEmpty();
public Binary setContentType(String value) { }
if (this.contentType == null)
this.contentType = new CodeType(); public boolean hasContent() {
this.contentType.setValue(value); return this.content != null && !this.content.isEmpty();
return this; }
}
/**
/** * @param value {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
* @return {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value */
*/ public Binary setContentElement(Base64BinaryType value) {
public Base64BinaryType getContentElement() { this.content = value;
if (this.content == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Binary.content");
else if (Configuration.doAutoCreate()) /**
this.content = new Base64BinaryType(); // bb * @return The actual content, base64 encoded.
return this.content; */
} public byte[] getContent() {
return this.content == null ? null : this.content.getValue();
public boolean hasContentElement() { }
return this.content != null && !this.content.isEmpty();
} /**
* @param value The actual content, base64 encoded.
public boolean hasContent() { */
return this.content != null && !this.content.isEmpty(); public Binary setContent(byte[] value) {
} if (this.content == null)
this.content = new Base64BinaryType();
/** this.content.setValue(value);
* @param value {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value return this;
*/ }
public Binary setContentElement(Base64BinaryType value) {
this.content = value; protected void listChildren(List<Property> childrenList) {
return this; super.listChildren(childrenList);
} childrenList.add(new Property("contentType", "code", "MimeType of the binary content represented as a standard MimeType (BCP 13).", 0, java.lang.Integer.MAX_VALUE, contentType));
childrenList.add(new Property("content", "base64Binary", "The actual content, base64 encoded.", 0, java.lang.Integer.MAX_VALUE, content));
/** }
* @return The actual content, base64 encoded.
*/ public Binary copy() {
public byte[] getContent() { Binary dst = new Binary();
return this.content == null ? null : this.content.getValue(); copyValues(dst);
} dst.contentType = contentType == null ? null : contentType.copy();
dst.content = content == null ? null : content.copy();
/** return dst;
* @param value The actual content, base64 encoded. }
*/
public Binary setContent(byte[] value) { protected Binary typedCopy() {
if (this.content == null) return copy();
this.content = new Base64BinaryType(); }
this.content.setValue(value);
return this; @Override
} public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
protected void listChildren(List<Property> childrenList) { return false;
super.listChildren(childrenList); if (!(other instanceof Binary))
childrenList.add(new Property("contentType", "code", "MimeType of the binary content represented as a standard MimeType (BCP 13).", 0, java.lang.Integer.MAX_VALUE, contentType)); return false;
childrenList.add(new Property("content", "base64Binary", "The actual content, base64 encoded.", 0, java.lang.Integer.MAX_VALUE, content)); Binary o = (Binary) other;
} return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true);
}
public Binary copy() {
Binary dst = new Binary(); @Override
copyValues(dst); public boolean equalsShallow(Base other) {
dst.contentType = contentType == null ? null : contentType.copy(); if (!super.equalsShallow(other))
dst.content = content == null ? null : content.copy(); return false;
return dst; if (!(other instanceof Binary))
} return false;
Binary o = (Binary) other;
protected Binary typedCopy() { return compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true);
return copy(); }
}
public boolean isEmpty() {
@Override return super.isEmpty() && (contentType == null || contentType.isEmpty()) && (content == null || content.isEmpty())
public boolean equalsDeep(Base other) { ;
if (!super.equalsDeep(other)) }
return false;
if (!(other instanceof Binary)) @Override
return false; public ResourceType getResourceType() {
Binary o = (Binary) other; return ResourceType.Binary;
return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true); }
}
@SearchParamDefinition(name="contenttype", path="Binary.contentType", description="MimeType of the binary content", type="token" )
@Override public static final String SP_CONTENTTYPE = "contenttype";
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other)) }
return false;
if (!(other instanceof Binary))
return false;
Binary o = (Binary) other;
return compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true);
}
public boolean isEmpty() {
return super.isEmpty() && (contentType == null || contentType.isEmpty()) && (content == null || content.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Binary;
}
@SearchParamDefinition(name="contenttype", path="Binary.contentType", description="MimeType of the binary content", type="token" )
public static final String SP_CONTENTTYPE = "contenttype";
}

View File

@ -1,448 +1,427 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.ResourceDef;
prior written permission. import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
import org.hl7.fhir.instance.model.annotations.Child;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Description;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.annotations.Block;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. import org.hl7.fhir.instance.model.api.*;
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, /**
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * Record details about the anatomical location of a specimen or body part. This resource may be used when a coded concept does not provide the necessary detail needed for the use case.
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, @ResourceDef(name="BodySite", profile="http://hl7.org/fhir/Profile/BodySite")
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) public class BodySite extends DomainResource {
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. /**
* The person to which the body site belongs.
*/ */
@Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1)
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 @Description(shortDefinition="Patient", formalDefinition="The person to which the body site belongs." )
protected Reference patient;
import java.util.*;
/**
import org.hl7.fhir.utilities.Utilities; * The actual object that is the target of the reference (The person to which the body site belongs.)
import org.hl7.fhir.instance.model.annotations.ResourceDef; */
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; protected Patient patientTarget;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description; /**
import org.hl7.fhir.instance.model.annotations.Block; * Identifier for this instance of the anatomical location.
import org.hl7.fhir.instance.model.api.*; */
/** @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
* Record details about the anatomical location of a specimen or body part. This resource may be used when a coded concept does not provide the necessary detail needed for the use case. @Description(shortDefinition="Bodysite identifier", formalDefinition="Identifier for this instance of the anatomical location." )
*/ protected List<Identifier> identifier;
@ResourceDef(name="BodySite", profile="http://hl7.org/fhir/Profile/BodySite")
public class BodySite extends DomainResource { /**
* Named anatomical location - ideally would be coded where possible.
/** */
* The person to which the body site belongs. @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1)
*/ @Description(shortDefinition="Named anatomical location", formalDefinition="Named anatomical location - ideally would be coded where possible." )
@Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1) protected CodeableConcept code;
@Description(shortDefinition="Patient", formalDefinition="The person to which the body site belongs." )
protected Reference patient; /**
* Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.
/** */
* The actual object that is the target of the reference (The person to which the body site belongs.) @Child(name = "modifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED)
*/ @Description(shortDefinition="Modification to location code", formalDefinition="Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane." )
protected Patient patientTarget; protected List<CodeableConcept> modifier;
/** /**
* Identifier for this instance of the anatomical location. * Description of anatomical location.
*/ */
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED) @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1)
@Description(shortDefinition="Bodysite identifier", formalDefinition="Identifier for this instance of the anatomical location." ) @Description(shortDefinition="The Description of anatomical location", formalDefinition="Description of anatomical location." )
protected List<Identifier> identifier; protected StringType description;
/** /**
* Named anatomical location - ideally would be coded where possible. * Image or images used to identify a location.
*/ */
@Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1) @Child(name = "image", type = {Attachment.class}, order=5, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Named anatomical location", formalDefinition="Named anatomical location - ideally would be coded where possible." ) @Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
protected CodeableConcept code; protected List<Attachment> image;
/** private static final long serialVersionUID = 1568109920L;
* Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.
*/ /*
@Child(name = "modifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED) * Constructor
@Description(shortDefinition="Modification to location code", formalDefinition="Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane." ) */
protected List<CodeableConcept> modifier; public BodySite() {
super();
/** }
* Description of anatomical location.
*/ /*
@Child(name = "description", type = {StringType.class}, order=4, min=0, max=1) * Constructor
@Description(shortDefinition="The Description of anatomical location", formalDefinition="Description of anatomical location." ) */
protected StringType description; public BodySite(Reference patient) {
super();
/** this.patient = patient;
* Image or images used to identify a location. }
*/
@Child(name = "image", type = {Attachment.class}, order=5, min=0, max=Child.MAX_UNLIMITED) /**
@Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." ) * @return {@link #patient} (The person to which the body site belongs.)
protected List<Attachment> image; */
public Reference getPatient() {
private static final long serialVersionUID = 1568109920L; if (this.patient == null)
if (Configuration.errorOnAutoCreate())
/* throw new Error("Attempt to auto-create BodySite.patient");
* Constructor else if (Configuration.doAutoCreate())
*/ this.patient = new Reference(); // cc
public BodySite() { return this.patient;
super(); }
}
public boolean hasPatient() {
/* return this.patient != null && !this.patient.isEmpty();
* Constructor }
*/
public BodySite(Reference patient) { /**
super(); * @param value {@link #patient} (The person to which the body site belongs.)
this.patient = patient; */
} public BodySite setPatient(Reference value) {
this.patient = value;
/** return this;
* @return {@link #patient} (The person to which the body site belongs.) }
*/
public Reference getPatient() { /**
if (this.patient == null) * @return {@link #patient} 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. (The person to which the body site belongs.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create BodySite.patient"); public Patient getPatientTarget() {
else if (Configuration.doAutoCreate()) if (this.patientTarget == null)
this.patient = new Reference(); // cc if (Configuration.errorOnAutoCreate())
return this.patient; throw new Error("Attempt to auto-create BodySite.patient");
} else if (Configuration.doAutoCreate())
this.patientTarget = new Patient(); // aa
public boolean hasPatient() { return this.patientTarget;
return this.patient != null && !this.patient.isEmpty(); }
}
/**
/** * @param value {@link #patient} 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. (The person to which the body site belongs.)
* @param value {@link #patient} (The person to which the body site belongs.) */
*/ public BodySite setPatientTarget(Patient value) {
public BodySite setPatient(Reference value) { this.patientTarget = value;
this.patient = value; return this;
return this; }
}
/**
/** * @return {@link #identifier} (Identifier for this instance of the anatomical location.)
* @return {@link #patient} 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. (The person to which the body site belongs.) */
*/ public List<Identifier> getIdentifier() {
public Patient getPatientTarget() { if (this.identifier == null)
if (this.patientTarget == null) this.identifier = new ArrayList<Identifier>();
if (Configuration.errorOnAutoCreate()) return this.identifier;
throw new Error("Attempt to auto-create BodySite.patient"); }
else if (Configuration.doAutoCreate())
this.patientTarget = new Patient(); // aa public boolean hasIdentifier() {
return this.patientTarget; if (this.identifier == null)
} return false;
for (Identifier item : this.identifier)
/** if (!item.isEmpty())
* @param value {@link #patient} 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. (The person to which the body site belongs.) return true;
*/ return false;
public BodySite setPatientTarget(Patient value) { }
this.patientTarget = value;
return this; /**
} * @return {@link #identifier} (Identifier for this instance of the anatomical location.)
*/
/** // syntactic sugar
* @return {@link #identifier} (Identifier for this instance of the anatomical location.) public Identifier addIdentifier() { //3
*/ Identifier t = new Identifier();
public List<Identifier> getIdentifier() { if (this.identifier == null)
if (this.identifier == null) this.identifier = new ArrayList<Identifier>();
this.identifier = new ArrayList<Identifier>(); this.identifier.add(t);
return this.identifier; return t;
} }
public boolean hasIdentifier() { // syntactic sugar
if (this.identifier == null) public BodySite addIdentifier(Identifier t) { //3
return false; if (t == null)
for (Identifier item : this.identifier) return this;
if (!item.isEmpty()) if (this.identifier == null)
return true; this.identifier = new ArrayList<Identifier>();
return false; this.identifier.add(t);
} return this;
}
/**
* @return {@link #identifier} (Identifier for this instance of the anatomical location.) /**
*/ * @return {@link #code} (Named anatomical location - ideally would be coded where possible.)
// syntactic sugar */
public Identifier addIdentifier() { //3 public CodeableConcept getCode() {
Identifier t = new Identifier(); if (this.code == null)
if (this.identifier == null) if (Configuration.errorOnAutoCreate())
this.identifier = new ArrayList<Identifier>(); throw new Error("Attempt to auto-create BodySite.code");
this.identifier.add(t); else if (Configuration.doAutoCreate())
return t; this.code = new CodeableConcept(); // cc
} return this.code;
}
// syntactic sugar
public BodySite addIdentifier(Identifier t) { //3 public boolean hasCode() {
if (t == null) return this.code != null && !this.code.isEmpty();
return this; }
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>(); /**
this.identifier.add(t); * @param value {@link #code} (Named anatomical location - ideally would be coded where possible.)
return this; */
} public BodySite setCode(CodeableConcept value) {
this.code = value;
/** return this;
* @return {@link #code} (Named anatomical location - ideally would be coded where possible.) }
*/
public CodeableConcept getCode() { /**
if (this.code == null) * @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create BodySite.code"); public List<CodeableConcept> getModifier() {
else if (Configuration.doAutoCreate()) if (this.modifier == null)
this.code = new CodeableConcept(); // cc this.modifier = new ArrayList<CodeableConcept>();
return this.code; return this.modifier;
} }
public boolean hasCode() { public boolean hasModifier() {
return this.code != null && !this.code.isEmpty(); if (this.modifier == null)
} return false;
for (CodeableConcept item : this.modifier)
/** if (!item.isEmpty())
* @param value {@link #code} (Named anatomical location - ideally would be coded where possible.) return true;
*/ return false;
public BodySite setCode(CodeableConcept value) { }
this.code = value;
return this; /**
} * @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
*/
/** // syntactic sugar
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.) public CodeableConcept addModifier() { //3
*/ CodeableConcept t = new CodeableConcept();
public List<CodeableConcept> getModifier() { if (this.modifier == null)
if (this.modifier == null) this.modifier = new ArrayList<CodeableConcept>();
this.modifier = new ArrayList<CodeableConcept>(); this.modifier.add(t);
return this.modifier; return t;
} }
public boolean hasModifier() { // syntactic sugar
if (this.modifier == null) public BodySite addModifier(CodeableConcept t) { //3
return false; if (t == null)
for (CodeableConcept item : this.modifier) return this;
if (!item.isEmpty()) if (this.modifier == null)
return true; this.modifier = new ArrayList<CodeableConcept>();
return false; this.modifier.add(t);
} return this;
}
/**
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.) /**
*/ * @return {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
// syntactic sugar */
public CodeableConcept addModifier() { //3 public StringType getDescriptionElement() {
CodeableConcept t = new CodeableConcept(); if (this.description == null)
if (this.modifier == null) if (Configuration.errorOnAutoCreate())
this.modifier = new ArrayList<CodeableConcept>(); throw new Error("Attempt to auto-create BodySite.description");
this.modifier.add(t); else if (Configuration.doAutoCreate())
return t; this.description = new StringType(); // bb
} return this.description;
}
// syntactic sugar
public BodySite addModifier(CodeableConcept t) { //3 public boolean hasDescriptionElement() {
if (t == null) return this.description != null && !this.description.isEmpty();
return this; }
if (this.modifier == null)
this.modifier = new ArrayList<CodeableConcept>(); public boolean hasDescription() {
this.modifier.add(t); return this.description != null && !this.description.isEmpty();
return this; }
}
/**
/** * @param value {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
* @return {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value */
*/ public BodySite setDescriptionElement(StringType value) {
public StringType getDescriptionElement() { this.description = value;
if (this.description == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create BodySite.description");
else if (Configuration.doAutoCreate()) /**
this.description = new StringType(); // bb * @return Description of anatomical location.
return this.description; */
} public String getDescription() {
return this.description == null ? null : this.description.getValue();
public boolean hasDescriptionElement() { }
return this.description != null && !this.description.isEmpty();
} /**
* @param value Description of anatomical location.
public boolean hasDescription() { */
return this.description != null && !this.description.isEmpty(); public BodySite setDescription(String value) {
} if (Utilities.noString(value))
this.description = null;
/** else {
* @param value {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value if (this.description == null)
*/ this.description = new StringType();
public BodySite setDescriptionElement(StringType value) { this.description.setValue(value);
this.description = value; }
return this; return this;
} }
/** /**
* @return Description of anatomical location. * @return {@link #image} (Image or images used to identify a location.)
*/ */
public String getDescription() { public List<Attachment> getImage() {
return this.description == null ? null : this.description.getValue(); if (this.image == null)
} this.image = new ArrayList<Attachment>();
return this.image;
/** }
* @param value Description of anatomical location.
*/ public boolean hasImage() {
public BodySite setDescription(String value) { if (this.image == null)
if (Utilities.noString(value)) return false;
this.description = null; for (Attachment item : this.image)
else { if (!item.isEmpty())
if (this.description == null) return true;
this.description = new StringType(); return false;
this.description.setValue(value); }
}
return this; /**
} * @return {@link #image} (Image or images used to identify a location.)
*/
/** // syntactic sugar
* @return {@link #image} (Image or images used to identify a location.) public Attachment addImage() { //3
*/ Attachment t = new Attachment();
public List<Attachment> getImage() { if (this.image == null)
if (this.image == null) this.image = new ArrayList<Attachment>();
this.image = new ArrayList<Attachment>(); this.image.add(t);
return this.image; return t;
} }
public boolean hasImage() { // syntactic sugar
if (this.image == null) public BodySite addImage(Attachment t) { //3
return false; if (t == null)
for (Attachment item : this.image) return this;
if (!item.isEmpty()) if (this.image == null)
return true; this.image = new ArrayList<Attachment>();
return false; this.image.add(t);
} return this;
}
/**
* @return {@link #image} (Image or images used to identify a location.) protected void listChildren(List<Property> childrenList) {
*/ super.listChildren(childrenList);
// syntactic sugar childrenList.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, java.lang.Integer.MAX_VALUE, patient));
public Attachment addImage() { //3 childrenList.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical location.", 0, java.lang.Integer.MAX_VALUE, identifier));
Attachment t = new Attachment(); childrenList.add(new Property("code", "CodeableConcept", "Named anatomical location - ideally would be coded where possible.", 0, java.lang.Integer.MAX_VALUE, code));
if (this.image == null) childrenList.add(new Property("modifier", "CodeableConcept", "Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.", 0, java.lang.Integer.MAX_VALUE, modifier));
this.image = new ArrayList<Attachment>(); childrenList.add(new Property("description", "string", "Description of anatomical location.", 0, java.lang.Integer.MAX_VALUE, description));
this.image.add(t); childrenList.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
return t; }
}
public BodySite copy() {
// syntactic sugar BodySite dst = new BodySite();
public BodySite addImage(Attachment t) { //3 copyValues(dst);
if (t == null) dst.patient = patient == null ? null : patient.copy();
return this; if (identifier != null) {
if (this.image == null) dst.identifier = new ArrayList<Identifier>();
this.image = new ArrayList<Attachment>(); for (Identifier i : identifier)
this.image.add(t); dst.identifier.add(i.copy());
return this; };
} dst.code = code == null ? null : code.copy();
if (modifier != null) {
protected void listChildren(List<Property> childrenList) { dst.modifier = new ArrayList<CodeableConcept>();
super.listChildren(childrenList); for (CodeableConcept i : modifier)
childrenList.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, java.lang.Integer.MAX_VALUE, patient)); dst.modifier.add(i.copy());
childrenList.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical location.", 0, java.lang.Integer.MAX_VALUE, identifier)); };
childrenList.add(new Property("code", "CodeableConcept", "Named anatomical location - ideally would be coded where possible.", 0, java.lang.Integer.MAX_VALUE, code)); dst.description = description == null ? null : description.copy();
childrenList.add(new Property("modifier", "CodeableConcept", "Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.", 0, java.lang.Integer.MAX_VALUE, modifier)); if (image != null) {
childrenList.add(new Property("description", "string", "Description of anatomical location.", 0, java.lang.Integer.MAX_VALUE, description)); dst.image = new ArrayList<Attachment>();
childrenList.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image)); for (Attachment i : image)
} dst.image.add(i.copy());
};
public BodySite copy() { return dst;
BodySite dst = new BodySite(); }
copyValues(dst);
dst.patient = patient == null ? null : patient.copy(); protected BodySite typedCopy() {
if (identifier != null) { return copy();
dst.identifier = new ArrayList<Identifier>(); }
for (Identifier i : identifier)
dst.identifier.add(i.copy()); @Override
}; public boolean equalsDeep(Base other) {
dst.code = code == null ? null : code.copy(); if (!super.equalsDeep(other))
if (modifier != null) { return false;
dst.modifier = new ArrayList<CodeableConcept>(); if (!(other instanceof BodySite))
for (CodeableConcept i : modifier) return false;
dst.modifier.add(i.copy()); BodySite o = (BodySite) other;
}; return compareDeep(patient, o.patient, true) && compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
dst.description = description == null ? null : description.copy(); && compareDeep(modifier, o.modifier, true) && compareDeep(description, o.description, true) && compareDeep(image, o.image, true)
if (image != null) { ;
dst.image = new ArrayList<Attachment>(); }
for (Attachment i : image)
dst.image.add(i.copy()); @Override
}; public boolean equalsShallow(Base other) {
return dst; if (!super.equalsShallow(other))
} return false;
if (!(other instanceof BodySite))
protected BodySite typedCopy() { return false;
return copy(); BodySite o = (BodySite) other;
} return compareValues(description, o.description, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (patient == null || patient.isEmpty()) && (identifier == null || identifier.isEmpty())
return false; && (code == null || code.isEmpty()) && (modifier == null || modifier.isEmpty()) && (description == null || description.isEmpty())
if (!(other instanceof BodySite)) && (image == null || image.isEmpty());
return false; }
BodySite o = (BodySite) other;
return compareDeep(patient, o.patient, true) && compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) @Override
&& compareDeep(modifier, o.modifier, true) && compareDeep(description, o.description, true) && compareDeep(image, o.image, true) public ResourceType getResourceType() {
; return ResourceType.BodySite;
} }
@Override @SearchParamDefinition(name="code", path="BodySite.code", description="Named anatomical location", type="token" )
public boolean equalsShallow(Base other) { public static final String SP_CODE = "code";
if (!super.equalsShallow(other)) @SearchParamDefinition(name="patient", path="BodySite.patient", description="Patient to whom bodysite belongs", type="reference" )
return false; public static final String SP_PATIENT = "patient";
if (!(other instanceof BodySite))
return false; }
BodySite o = (BodySite) other;
return compareValues(description, o.description, true);
}
public boolean isEmpty() {
return super.isEmpty() && (patient == null || patient.isEmpty()) && (identifier == null || identifier.isEmpty())
&& (code == null || code.isEmpty()) && (modifier == null || modifier.isEmpty()) && (description == null || description.isEmpty())
&& (image == null || image.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.BodySite;
}
@SearchParamDefinition(name="patient", path="BodySite.patient", description="Patient to whom bodysite belongs", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="code", path="BodySite.code", description="Named anatomical location", type="token" )
public static final String SP_CODE = "code";
}

View File

@ -1,107 +1,86 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/** /**
* *
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* #%L import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
* HAPI FHIR Structures - HL7.org DSTU2
* %% /**
* Copyright (C) 2014 - 2015 University Health Network * Primitive type "boolean" in FHIR "true" or "false"
* %% */
* Licensed under the Apache License, Version 2.0 (the "License"); @DatatypeDef(name="boolean")
* you may not use this file except in compliance with the License. public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanDatatype {
* You may obtain a copy of the License at
* private static final long serialVersionUID = 3L;
* http://www.apache.org/licenses/LICENSE-2.0
* public BooleanType() {
* Unless required by applicable law or agreed to in writing, software super();
* distributed under the License is distributed on an "AS IS" BASIS, }
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and public BooleanType(boolean theBoolean) {
* limitations under the License. super();
* #L% setValue(theBoolean);
*/ }
public BooleanType(Boolean theBoolean) {
import org.hl7.fhir.instance.model.annotations.DatatypeDef; super();
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype; setValue(theBoolean);
}
/**
* Primitive type "boolean" in FHIR "true" or "false" public BooleanType(String value) {
*/ super();
@DatatypeDef(name="boolean") setValueAsString(value);
public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanDatatype { }
private static final long serialVersionUID = 3L; protected Boolean parse(String theValue) {
String value = theValue.trim();
public BooleanType() { if ("true".equals(value)) {
super(); return Boolean.TRUE;
} } else if ("false".equals(value)) {
return Boolean.FALSE;
public BooleanType(boolean theBoolean) { } else {
super(); throw new IllegalArgumentException("Invalid boolean string: '" + theValue + "'");
setValue(theBoolean); }
} }
public BooleanType(Boolean theBoolean) { protected String encode(Boolean theValue) {
super(); if (Boolean.TRUE.equals(theValue)) {
setValue(theBoolean); return "true";
} } else {
return "false";
public BooleanType(String value) { }
super(); }
setValueAsString(value);
} public BooleanType copy() {
return new BooleanType(getValue());
protected Boolean parse(String theValue) { }
String value = theValue.trim(); }
if ("true".equals(value)) {
return Boolean.TRUE;
} else if ("false".equals(value)) {
return Boolean.FALSE;
} else {
throw new IllegalArgumentException("Invalid boolean string: '" + theValue + "'");
}
}
protected String encode(Boolean theValue) {
if (Boolean.TRUE.equals(theValue)) {
return "true";
} else {
return "false";
}
}
public BooleanType copy() {
return new BooleanType(getValue());
}
}

View File

@ -1,94 +1,73 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import static org.apache.commons.lang3.StringUtils.defaultString;
* #%L
* HAPI FHIR Structures - HL7.org DSTU2 import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* %%
* Copyright (C) 2014 - 2015 University Health Network /**
* %% * Primitive type "code" in FHIR, when not bound to an enumerated list of codes
* Licensed under the Apache License, Version 2.0 (the "License"); */
* you may not use this file except in compliance with the License. @DatatypeDef(name="code")
* You may obtain a copy of the License at public class CodeType extends PrimitiveType<String> implements Comparable<CodeType> {
*
* http://www.apache.org/licenses/LICENSE-2.0 private static final long serialVersionUID = 3L;
*
* Unless required by applicable law or agreed to in writing, software public CodeType() {
* distributed under the License is distributed on an "AS IS" BASIS, super();
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
* See the License for the specific language governing permissions and
* limitations under the License. public CodeType(String theCode) {
* #L% setValue(theCode);
*/ }
public int compareTo(CodeType theCode) {
import static org.apache.commons.lang3.StringUtils.defaultString; if (theCode == null) {
return 1;
import org.hl7.fhir.instance.model.annotations.DatatypeDef; }
return defaultString(getValue()).compareTo(defaultString(theCode.getValue()));
/** }
* Primitive type "code" in FHIR, when not bound to an enumerated list of codes
*/ @Override
@DatatypeDef(name="code") protected String parse(String theValue) {
public class CodeType extends PrimitiveType<String> implements Comparable<CodeType> { return theValue.trim();
}
private static final long serialVersionUID = 3L;
@Override
public CodeType() { protected String encode(String theValue) {
super(); return theValue;
} }
public CodeType(String theCode) { @Override
setValue(theCode); public CodeType copy() {
} return new CodeType(getValue());
}
public int compareTo(CodeType theCode) {
if (theCode == null) { }
return 1;
}
return defaultString(getValue()).compareTo(defaultString(theCode.getValue()));
}
@Override
protected String parse(String theValue) {
return theValue.trim();
}
@Override
protected String encode(String theValue) {
return theValue;
}
@Override
public CodeType copy() {
return new CodeType(getValue());
}
}

View File

@ -1,230 +1,209 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.Child;
prior written permission. import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @DatatypeDef(name="CodeableConcept")
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, public class CodeableConcept extends Type implements ICompositeType {
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE /**
POSSIBILITY OF SUCH DAMAGE. * A reference to a code defined by a terminology system.
*/
*/ @Child(name = "coding", type = {Coding.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Code defined by a terminology system", formalDefinition="A reference to a code defined by a terminology system." )
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 protected List<Coding> coding;
import java.util.*; /**
* A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
import org.hl7.fhir.utilities.Utilities; */
import org.hl7.fhir.instance.model.annotations.Child; @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1)
import org.hl7.fhir.instance.model.annotations.Description; @Description(shortDefinition="Plain text representation of the concept", formalDefinition="A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user." )
import org.hl7.fhir.instance.model.annotations.DatatypeDef; protected StringType text;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; private static final long serialVersionUID = 760353246L;
/**
* A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text. /*
*/ * Constructor
@DatatypeDef(name="CodeableConcept") */
public class CodeableConcept extends Type implements ICompositeType { public CodeableConcept() {
super();
/** }
* A reference to a code defined by a terminology system.
*/ /**
@Child(name = "coding", type = {Coding.class}, order=0, min=0, max=Child.MAX_UNLIMITED) * @return {@link #coding} (A reference to a code defined by a terminology system.)
@Description(shortDefinition="Code defined by a terminology system", formalDefinition="A reference to a code defined by a terminology system." ) */
protected List<Coding> coding; public List<Coding> getCoding() {
if (this.coding == null)
/** this.coding = new ArrayList<Coding>();
* A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. return this.coding;
*/ }
@Child(name = "text", type = {StringType.class}, order=1, min=0, max=1)
@Description(shortDefinition="Plain text representation of the concept", formalDefinition="A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user." ) public boolean hasCoding() {
protected StringType text; if (this.coding == null)
return false;
private static final long serialVersionUID = 760353246L; for (Coding item : this.coding)
if (!item.isEmpty())
/* return true;
* Constructor return false;
*/ }
public CodeableConcept() {
super(); /**
} * @return {@link #coding} (A reference to a code defined by a terminology system.)
*/
/** // syntactic sugar
* @return {@link #coding} (A reference to a code defined by a terminology system.) public Coding addCoding() { //3
*/ Coding t = new Coding();
public List<Coding> getCoding() { if (this.coding == null)
if (this.coding == null) this.coding = new ArrayList<Coding>();
this.coding = new ArrayList<Coding>(); this.coding.add(t);
return this.coding; return t;
} }
public boolean hasCoding() { // syntactic sugar
if (this.coding == null) public CodeableConcept addCoding(Coding t) { //3
return false; if (t == null)
for (Coding item : this.coding) return this;
if (!item.isEmpty()) if (this.coding == null)
return true; this.coding = new ArrayList<Coding>();
return false; this.coding.add(t);
} return this;
}
/**
* @return {@link #coding} (A reference to a code defined by a terminology system.) /**
*/ * @return {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
// syntactic sugar */
public Coding addCoding() { //3 public StringType getTextElement() {
Coding t = new Coding(); if (this.text == null)
if (this.coding == null) if (Configuration.errorOnAutoCreate())
this.coding = new ArrayList<Coding>(); throw new Error("Attempt to auto-create CodeableConcept.text");
this.coding.add(t); else if (Configuration.doAutoCreate())
return t; this.text = new StringType(); // bb
} return this.text;
}
// syntactic sugar
public CodeableConcept addCoding(Coding t) { //3 public boolean hasTextElement() {
if (t == null) return this.text != null && !this.text.isEmpty();
return this; }
if (this.coding == null)
this.coding = new ArrayList<Coding>(); public boolean hasText() {
this.coding.add(t); return this.text != null && !this.text.isEmpty();
return this; }
}
/**
/** * @param value {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
* @return {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value */
*/ public CodeableConcept setTextElement(StringType value) {
public StringType getTextElement() { this.text = value;
if (this.text == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create CodeableConcept.text");
else if (Configuration.doAutoCreate()) /**
this.text = new StringType(); // bb * @return A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
return this.text; */
} public String getText() {
return this.text == null ? null : this.text.getValue();
public boolean hasTextElement() { }
return this.text != null && !this.text.isEmpty();
} /**
* @param value A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
public boolean hasText() { */
return this.text != null && !this.text.isEmpty(); public CodeableConcept setText(String value) {
} if (Utilities.noString(value))
this.text = null;
/** else {
* @param value {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value if (this.text == null)
*/ this.text = new StringType();
public CodeableConcept setTextElement(StringType value) { this.text.setValue(value);
this.text = value; }
return this; return this;
} }
/** protected void listChildren(List<Property> childrenList) {
* @return A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. super.listChildren(childrenList);
*/ childrenList.add(new Property("coding", "Coding", "A reference to a code defined by a terminology system.", 0, java.lang.Integer.MAX_VALUE, coding));
public String getText() { childrenList.add(new Property("text", "string", "A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.", 0, java.lang.Integer.MAX_VALUE, text));
return this.text == null ? null : this.text.getValue(); }
}
public CodeableConcept copy() {
/** CodeableConcept dst = new CodeableConcept();
* @param value A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. copyValues(dst);
*/ if (coding != null) {
public CodeableConcept setText(String value) { dst.coding = new ArrayList<Coding>();
if (Utilities.noString(value)) for (Coding i : coding)
this.text = null; dst.coding.add(i.copy());
else { };
if (this.text == null) dst.text = text == null ? null : text.copy();
this.text = new StringType(); return dst;
this.text.setValue(value); }
}
return this; protected CodeableConcept typedCopy() {
} return copy();
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList); @Override
childrenList.add(new Property("coding", "Coding", "A reference to a code defined by a terminology system.", 0, java.lang.Integer.MAX_VALUE, coding)); public boolean equalsDeep(Base other) {
childrenList.add(new Property("text", "string", "A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.", 0, java.lang.Integer.MAX_VALUE, text)); if (!super.equalsDeep(other))
} return false;
if (!(other instanceof CodeableConcept))
public CodeableConcept copy() { return false;
CodeableConcept dst = new CodeableConcept(); CodeableConcept o = (CodeableConcept) other;
copyValues(dst); return compareDeep(coding, o.coding, true) && compareDeep(text, o.text, true);
if (coding != null) { }
dst.coding = new ArrayList<Coding>();
for (Coding i : coding) @Override
dst.coding.add(i.copy()); public boolean equalsShallow(Base other) {
}; if (!super.equalsShallow(other))
dst.text = text == null ? null : text.copy(); return false;
return dst; if (!(other instanceof CodeableConcept))
} return false;
CodeableConcept o = (CodeableConcept) other;
protected CodeableConcept typedCopy() { return compareValues(text, o.text, true);
return copy(); }
}
public boolean isEmpty() {
@Override return super.isEmpty() && (coding == null || coding.isEmpty()) && (text == null || text.isEmpty())
public boolean equalsDeep(Base other) { ;
if (!super.equalsDeep(other)) }
return false;
if (!(other instanceof CodeableConcept))
return false; }
CodeableConcept o = (CodeableConcept) other;
return compareDeep(coding, o.coding, true) && compareDeep(text, o.text, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof CodeableConcept))
return false;
CodeableConcept o = (CodeableConcept) other;
return compareValues(text, o.text, true);
}
public boolean isEmpty() {
return super.isEmpty() && (coding == null || coding.isEmpty()) && (text == null || text.isEmpty())
;
}
}

View File

@ -1,408 +1,387 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.Child;
prior written permission. import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * A reference to a code defined by a terminology system.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @DatatypeDef(name="Coding")
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, public class Coding extends Type implements IBaseCoding, ICompositeType {
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE /**
POSSIBILITY OF SUCH DAMAGE. * The identification of the code system that defines the meaning of the symbol in the code.
*/
*/ @Child(name = "system", type = {UriType.class}, order=0, min=0, max=1)
@Description(shortDefinition="Identity of the terminology system", formalDefinition="The identification of the code system that defines the meaning of the symbol in the code." )
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 protected UriType system;
import java.util.*; /**
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
import org.hl7.fhir.utilities.Utilities; */
import org.hl7.fhir.instance.model.annotations.Child; @Child(name = "version", type = {StringType.class}, order=1, min=0, max=1)
import org.hl7.fhir.instance.model.annotations.Description; @Description(shortDefinition="Version of the system - if relevant", formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged." )
import org.hl7.fhir.instance.model.annotations.DatatypeDef; protected StringType version;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; /**
/** * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
* A reference to a code defined by a terminology system. */
*/ @Child(name = "code", type = {CodeType.class}, order=2, min=0, max=1)
@DatatypeDef(name="Coding") @Description(shortDefinition="Symbol in syntax defined by the system", formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)." )
public class Coding extends Type implements IBaseCoding, ICompositeType { protected CodeType code;
/** /**
* The identification of the code system that defines the meaning of the symbol in the code. * A representation of the meaning of the code in the system, following the rules of the system.
*/ */
@Child(name = "system", type = {UriType.class}, order=0, min=0, max=1) @Child(name = "display", type = {StringType.class}, order=3, min=0, max=1)
@Description(shortDefinition="Identity of the terminology system", formalDefinition="The identification of the code system that defines the meaning of the symbol in the code." ) @Description(shortDefinition="Representation defined by the system", formalDefinition="A representation of the meaning of the code in the system, following the rules of the system." )
protected UriType system; protected StringType display;
/** /**
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged. * Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
*/ */
@Child(name = "version", type = {StringType.class}, order=1, min=0, max=1) @Child(name = "primary", type = {BooleanType.class}, order=4, min=0, max=1)
@Description(shortDefinition="Version of the system - if relevant", formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged." ) @Description(shortDefinition="If this code was chosen directly by the user", formalDefinition="Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)." )
protected StringType version; protected BooleanType primary;
/** private static final long serialVersionUID = 2019442517L;
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
*/ /*
@Child(name = "code", type = {CodeType.class}, order=2, min=0, max=1) * Constructor
@Description(shortDefinition="Symbol in syntax defined by the system", formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)." ) */
protected CodeType code; public Coding() {
super();
/** }
* A representation of the meaning of the code in the system, following the rules of the system.
*/ /**
@Child(name = "display", type = {StringType.class}, order=3, min=0, max=1) * @return {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
@Description(shortDefinition="Representation defined by the system", formalDefinition="A representation of the meaning of the code in the system, following the rules of the system." ) */
protected StringType display; public UriType getSystemElement() {
if (this.system == null)
/** if (Configuration.errorOnAutoCreate())
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays). throw new Error("Attempt to auto-create Coding.system");
*/ else if (Configuration.doAutoCreate())
@Child(name = "primary", type = {BooleanType.class}, order=4, min=0, max=1) this.system = new UriType(); // bb
@Description(shortDefinition="If this code was chosen directly by the user", formalDefinition="Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)." ) return this.system;
protected BooleanType primary; }
private static final long serialVersionUID = 2019442517L; public boolean hasSystemElement() {
return this.system != null && !this.system.isEmpty();
/* }
* Constructor
*/ public boolean hasSystem() {
public Coding() { return this.system != null && !this.system.isEmpty();
super(); }
}
/**
/** * @param value {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
* @return {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value */
*/ public Coding setSystemElement(UriType value) {
public UriType getSystemElement() { this.system = value;
if (this.system == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Coding.system");
else if (Configuration.doAutoCreate()) /**
this.system = new UriType(); // bb * @return The identification of the code system that defines the meaning of the symbol in the code.
return this.system; */
} public String getSystem() {
return this.system == null ? null : this.system.getValue();
public boolean hasSystemElement() { }
return this.system != null && !this.system.isEmpty();
} /**
* @param value The identification of the code system that defines the meaning of the symbol in the code.
public boolean hasSystem() { */
return this.system != null && !this.system.isEmpty(); public Coding setSystem(String value) {
} if (Utilities.noString(value))
this.system = null;
/** else {
* @param value {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value if (this.system == null)
*/ this.system = new UriType();
public Coding setSystemElement(UriType value) { this.system.setValue(value);
this.system = value; }
return this; return this;
} }
/** /**
* @return The identification of the code system that defines the meaning of the symbol in the code. * @return {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
*/ */
public String getSystem() { public StringType getVersionElement() {
return this.system == null ? null : this.system.getValue(); if (this.version == null)
} if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.version");
/** else if (Configuration.doAutoCreate())
* @param value The identification of the code system that defines the meaning of the symbol in the code. this.version = new StringType(); // bb
*/ return this.version;
public Coding setSystem(String value) { }
if (Utilities.noString(value))
this.system = null; public boolean hasVersionElement() {
else { return this.version != null && !this.version.isEmpty();
if (this.system == null) }
this.system = new UriType();
this.system.setValue(value); public boolean hasVersion() {
} return this.version != null && !this.version.isEmpty();
return this; }
}
/**
/** * @param value {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
* @return {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value */
*/ public Coding setVersionElement(StringType value) {
public StringType getVersionElement() { this.version = value;
if (this.version == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Coding.version");
else if (Configuration.doAutoCreate()) /**
this.version = new StringType(); // bb * @return The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
return this.version; */
} public String getVersion() {
return this.version == null ? null : this.version.getValue();
public boolean hasVersionElement() { }
return this.version != null && !this.version.isEmpty();
} /**
* @param value The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
public boolean hasVersion() { */
return this.version != null && !this.version.isEmpty(); public Coding setVersion(String value) {
} if (Utilities.noString(value))
this.version = null;
/** else {
* @param value {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value if (this.version == null)
*/ this.version = new StringType();
public Coding setVersionElement(StringType value) { this.version.setValue(value);
this.version = value; }
return this; return this;
} }
/** /**
* @return The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged. * @return {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/ */
public String getVersion() { public CodeType getCodeElement() {
return this.version == null ? null : this.version.getValue(); if (this.code == null)
} if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.code");
/** else if (Configuration.doAutoCreate())
* @param value The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged. this.code = new CodeType(); // bb
*/ return this.code;
public Coding setVersion(String value) { }
if (Utilities.noString(value))
this.version = null; public boolean hasCodeElement() {
else { return this.code != null && !this.code.isEmpty();
if (this.version == null) }
this.version = new StringType();
this.version.setValue(value); public boolean hasCode() {
} return this.code != null && !this.code.isEmpty();
return this; }
}
/**
/** * @param value {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
* @return {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value */
*/ public Coding setCodeElement(CodeType value) {
public CodeType getCodeElement() { this.code = value;
if (this.code == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Coding.code");
else if (Configuration.doAutoCreate()) /**
this.code = new CodeType(); // bb * @return A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
return this.code; */
} public String getCode() {
return this.code == null ? null : this.code.getValue();
public boolean hasCodeElement() { }
return this.code != null && !this.code.isEmpty();
} /**
* @param value A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
public boolean hasCode() { */
return this.code != null && !this.code.isEmpty(); public Coding setCode(String value) {
} if (Utilities.noString(value))
this.code = null;
/** else {
* @param value {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value if (this.code == null)
*/ this.code = new CodeType();
public Coding setCodeElement(CodeType value) { this.code.setValue(value);
this.code = value; }
return this; return this;
} }
/** /**
* @return A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). * @return {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
*/ */
public String getCode() { public StringType getDisplayElement() {
return this.code == null ? null : this.code.getValue(); if (this.display == null)
} if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.display");
/** else if (Configuration.doAutoCreate())
* @param value A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). this.display = new StringType(); // bb
*/ return this.display;
public Coding setCode(String value) { }
if (Utilities.noString(value))
this.code = null; public boolean hasDisplayElement() {
else { return this.display != null && !this.display.isEmpty();
if (this.code == null) }
this.code = new CodeType();
this.code.setValue(value); public boolean hasDisplay() {
} return this.display != null && !this.display.isEmpty();
return this; }
}
/**
/** * @param value {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
* @return {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value */
*/ public Coding setDisplayElement(StringType value) {
public StringType getDisplayElement() { this.display = value;
if (this.display == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Coding.display");
else if (Configuration.doAutoCreate()) /**
this.display = new StringType(); // bb * @return A representation of the meaning of the code in the system, following the rules of the system.
return this.display; */
} public String getDisplay() {
return this.display == null ? null : this.display.getValue();
public boolean hasDisplayElement() { }
return this.display != null && !this.display.isEmpty();
} /**
* @param value A representation of the meaning of the code in the system, following the rules of the system.
public boolean hasDisplay() { */
return this.display != null && !this.display.isEmpty(); public Coding setDisplay(String value) {
} if (Utilities.noString(value))
this.display = null;
/** else {
* @param value {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value if (this.display == null)
*/ this.display = new StringType();
public Coding setDisplayElement(StringType value) { this.display.setValue(value);
this.display = value; }
return this; return this;
} }
/** /**
* @return A representation of the meaning of the code in the system, following the rules of the system. * @return {@link #primary} (Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getPrimary" gives direct access to the value
*/ */
public String getDisplay() { public BooleanType getPrimaryElement() {
return this.display == null ? null : this.display.getValue(); if (this.primary == null)
} if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.primary");
/** else if (Configuration.doAutoCreate())
* @param value A representation of the meaning of the code in the system, following the rules of the system. this.primary = new BooleanType(); // bb
*/ return this.primary;
public Coding setDisplay(String value) { }
if (Utilities.noString(value))
this.display = null; public boolean hasPrimaryElement() {
else { return this.primary != null && !this.primary.isEmpty();
if (this.display == null) }
this.display = new StringType();
this.display.setValue(value); public boolean hasPrimary() {
} return this.primary != null && !this.primary.isEmpty();
return this; }
}
/**
/** * @param value {@link #primary} (Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getPrimary" gives direct access to the value
* @return {@link #primary} (Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getPrimary" gives direct access to the value */
*/ public Coding setPrimaryElement(BooleanType value) {
public BooleanType getPrimaryElement() { this.primary = value;
if (this.primary == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Coding.primary");
else if (Configuration.doAutoCreate()) /**
this.primary = new BooleanType(); // bb * @return Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
return this.primary; */
} public boolean getPrimary() {
return this.primary == null || this.primary.isEmpty() ? false : this.primary.getValue();
public boolean hasPrimaryElement() { }
return this.primary != null && !this.primary.isEmpty();
} /**
* @param value Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
public boolean hasPrimary() { */
return this.primary != null && !this.primary.isEmpty(); public Coding setPrimary(boolean value) {
} if (this.primary == null)
this.primary = new BooleanType();
/** this.primary.setValue(value);
* @param value {@link #primary} (Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getPrimary" gives direct access to the value return this;
*/ }
public Coding setPrimaryElement(BooleanType value) {
this.primary = value; protected void listChildren(List<Property> childrenList) {
return this; super.listChildren(childrenList);
} childrenList.add(new Property("system", "uri", "The identification of the code system that defines the meaning of the symbol in the code.", 0, java.lang.Integer.MAX_VALUE, system));
childrenList.add(new Property("version", "string", "The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.", 0, java.lang.Integer.MAX_VALUE, version));
/** childrenList.add(new Property("code", "code", "A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).", 0, java.lang.Integer.MAX_VALUE, code));
* @return Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays). childrenList.add(new Property("display", "string", "A representation of the meaning of the code in the system, following the rules of the system.", 0, java.lang.Integer.MAX_VALUE, display));
*/ childrenList.add(new Property("primary", "boolean", "Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).", 0, java.lang.Integer.MAX_VALUE, primary));
public boolean getPrimary() { }
return this.primary == null || this.primary.isEmpty() ? false : this.primary.getValue();
} public Coding copy() {
Coding dst = new Coding();
/** copyValues(dst);
* @param value Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays). dst.system = system == null ? null : system.copy();
*/ dst.version = version == null ? null : version.copy();
public Coding setPrimary(boolean value) { dst.code = code == null ? null : code.copy();
if (this.primary == null) dst.display = display == null ? null : display.copy();
this.primary = new BooleanType(); dst.primary = primary == null ? null : primary.copy();
this.primary.setValue(value); return dst;
return this; }
}
protected Coding typedCopy() {
protected void listChildren(List<Property> childrenList) { return copy();
super.listChildren(childrenList); }
childrenList.add(new Property("system", "uri", "The identification of the code system that defines the meaning of the symbol in the code.", 0, java.lang.Integer.MAX_VALUE, system));
childrenList.add(new Property("version", "string", "The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.", 0, java.lang.Integer.MAX_VALUE, version)); @Override
childrenList.add(new Property("code", "code", "A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).", 0, java.lang.Integer.MAX_VALUE, code)); public boolean equalsDeep(Base other) {
childrenList.add(new Property("display", "string", "A representation of the meaning of the code in the system, following the rules of the system.", 0, java.lang.Integer.MAX_VALUE, display)); if (!super.equalsDeep(other))
childrenList.add(new Property("primary", "boolean", "Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).", 0, java.lang.Integer.MAX_VALUE, primary)); return false;
} if (!(other instanceof Coding))
return false;
public Coding copy() { Coding o = (Coding) other;
Coding dst = new Coding(); return compareDeep(system, o.system, true) && compareDeep(version, o.version, true) && compareDeep(code, o.code, true)
copyValues(dst); && compareDeep(display, o.display, true) && compareDeep(primary, o.primary, true);
dst.system = system == null ? null : system.copy(); }
dst.version = version == null ? null : version.copy();
dst.code = code == null ? null : code.copy(); @Override
dst.display = display == null ? null : display.copy(); public boolean equalsShallow(Base other) {
dst.primary = primary == null ? null : primary.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Coding))
return false;
protected Coding typedCopy() { Coding o = (Coding) other;
return copy(); return compareValues(system, o.system, true) && compareValues(version, o.version, true) && compareValues(code, o.code, true)
} && compareValues(display, o.display, true) && compareValues(primary, o.primary, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (system == null || system.isEmpty()) && (version == null || version.isEmpty())
return false; && (code == null || code.isEmpty()) && (display == null || display.isEmpty()) && (primary == null || primary.isEmpty())
if (!(other instanceof Coding)) ;
return false; }
Coding o = (Coding) other;
return compareDeep(system, o.system, true) && compareDeep(version, o.version, true) && compareDeep(code, o.code, true)
&& compareDeep(display, o.display, true) && compareDeep(primary, o.primary, true); }
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Coding))
return false;
Coding o = (Coding) other;
return compareValues(system, o.system, true) && compareValues(version, o.version, true) && compareValues(code, o.code, true)
&& compareValues(display, o.display, true) && compareValues(primary, o.primary, true);
}
public boolean isEmpty() {
return super.isEmpty() && (system == null || system.isEmpty()) && (version == null || version.isEmpty())
&& (code == null || code.isEmpty()) && (display == null || display.isEmpty()) && (primary == null || primary.isEmpty())
;
}
}

View File

@ -1,129 +1,108 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import java.util.List;
* #%L
* HAPI FHIR Structures - HL7.org DSTU2 import org.hl7.fhir.utilities.Utilities;
* %%
* Copyright (C) 2014 - 2015 University Health Network /**
* %% * See http://www.healthintersections.com.au/?p=1941
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. * @author Grahame
* You may obtain a copy of the License at *
* */
* http://www.apache.org/licenses/LICENSE-2.0 public class Comparison {
*
* Unless required by applicable law or agreed to in writing, software public class MatchProfile {
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
* See the License for the specific language governing permissions and
* limitations under the License. public static boolean matches(String c1, String c2, MatchProfile profile) {
* #L% if (Utilities.noString(c1) || Utilities.noString(c2))
*/ return false;
c1 = Utilities.normalize(c1);
c2 = Utilities.normalize(c2);
import java.util.List; return c1.equals(c2);
}
import org.hl7.fhir.utilities.Utilities;
public static <T extends Enum<?>> boolean matches(Enumeration<T> e1, Enumeration<T> e2, MatchProfile profile) {
/** if (e1 == null || e2 == null)
* See http://www.healthintersections.com.au/?p=1941 return false;
* return e1.getValue().equals(e2.getValue());
* @author Grahame }
*
*/ public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws Exception {
public class Comparison { if (profile != null)
throw new Exception("Not Implemented Yet");
public class MatchProfile {
if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) {
} return matches(c1.getText(), c2.getText(), null);
} else {
public static boolean matches(String c1, String c2, MatchProfile profile) { // in the absence of specific guidance, we just require that all codes match
if (Utilities.noString(c1) || Utilities.noString(c2)) boolean ok = true;
return false; for (Coding c : c1.getCoding()) {
c1 = Utilities.normalize(c1); ok = ok && inList(c2.getCoding(), c, null);
c2 = Utilities.normalize(c2); }
return c1.equals(c2); for (Coding c : c2.getCoding()) {
} ok = ok && inList(c1.getCoding(), c, null);
}
public static <T extends Enum<?>> boolean matches(Enumeration<T> e1, Enumeration<T> e2, MatchProfile profile) { return ok;
if (e1 == null || e2 == null) }
return false; }
return e1.getValue().equals(e2.getValue());
} public static void merge(CodeableConcept dst, CodeableConcept src) {
if (dst.getTextElement() == null && src.getTextElement() != null)
public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws Exception { dst.setTextElement(src.getTextElement());
if (profile != null) }
throw new Exception("Not Implemented Yet");
if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) { public static boolean inList(List<Coding> list, Coding c, MatchProfile profile) throws Exception {
return matches(c1.getText(), c2.getText(), null); for (Coding item : list) {
} else { if (matches(item, c, profile))
// in the absence of specific guidance, we just require that all codes match return true;
boolean ok = true; }
for (Coding c : c1.getCoding()) { return false;
ok = ok && inList(c2.getCoding(), c, null); }
}
for (Coding c : c2.getCoding()) { public static boolean matches(Coding c1, Coding c2, MatchProfile profile) throws Exception {
ok = ok && inList(c1.getCoding(), c, null); if (profile != null)
} throw new Exception("Not Implemented Yet");
return ok;
} // in the absence of a profile, we ignore version
} return matches(c1.getSystem(), c2.getSystem(), null) && matches(c1.getCode(), c2.getCode(), null);
}
public static void merge(CodeableConcept dst, CodeableConcept src) {
if (dst.getTextElement() == null && src.getTextElement() != null) public static boolean matches(Identifier i1, Identifier i2, MatchProfile profile) throws Exception {
dst.setTextElement(src.getTextElement()); if (profile != null)
} throw new Exception("Not Implemented Yet");
// in the absence of a profile, we ignore version
public static boolean inList(List<Coding> list, Coding c, MatchProfile profile) throws Exception { return matches(i1.getSystem(), i2.getSystem(), null) && matches(i1.getValue(), i2.getValue(), null);
for (Coding item : list) { }
if (matches(item, c, profile))
return true; public static void merge(Identifier dst, Identifier src) {
} if (dst.getUseElement() == null && src.getUseElement() != null)
return false; dst.setUseElement(src.getUseElement());
} if (dst.getType() == null && src.getType() != null)
dst.setType(src.getType());
public static boolean matches(Coding c1, Coding c2, MatchProfile profile) throws Exception { if (dst.getPeriod() == null && src.getPeriod() != null)
if (profile != null) dst.setPeriod(src.getPeriod());
throw new Exception("Not Implemented Yet"); if (dst.getAssigner() == null && src.getAssigner() != null)
dst.setAssigner(src.getAssigner());
// in the absence of a profile, we ignore version }
return matches(c1.getSystem(), c2.getSystem(), null) && matches(c1.getCode(), c2.getCode(), null);
} public static boolean matches(ContactPoint c1, ContactPoint c2, Object profile) throws Exception {
if (profile != null)
public static boolean matches(Identifier i1, Identifier i2, MatchProfile profile) throws Exception { throw new Exception("Not Implemented Yet");
if (profile != null)
throw new Exception("Not Implemented Yet"); // in the absence of a profile, we insist on system
return matches(c1.getSystemElement(), c2.getSystemElement(), null) && matches(c1.getValue(), c2.getValue(), null);
// in the absence of a profile, we ignore version }
return matches(i1.getSystem(), i2.getSystem(), null) && matches(i1.getValue(), i2.getValue(), null);
} public static void merge(ContactPoint dst, ContactPoint src) {
if (dst.getUseElement() == null && src.getUseElement() != null)
public static void merge(Identifier dst, Identifier src) { dst.setUseElement(src.getUseElement());
if (dst.getUseElement() == null && src.getUseElement() != null) if (dst.getPeriod() == null && src.getPeriod() != null)
dst.setUseElement(src.getUseElement()); dst.setPeriod(src.getPeriod());
if (dst.getType() == null && src.getType() != null) }
dst.setType(src.getType());
if (dst.getPeriod() == null && src.getPeriod() != null) }
dst.setPeriod(src.getPeriod());
if (dst.getAssigner() == null && src.getAssigner() != null)
dst.setAssigner(src.getAssigner());
}
public static boolean matches(ContactPoint c1, ContactPoint c2, Object profile) throws Exception {
if (profile != null)
throw new Exception("Not Implemented Yet");
// in the absence of a profile, we insist on system
return matches(c1.getSystemElement(), c2.getSystemElement(), null) && matches(c1.getValue(), c2.getValue(), null);
}
public static void merge(ContactPoint dst, ContactPoint src) {
if (dst.getUseElement() == null && src.getUseElement() != null)
dst.setUseElement(src.getUseElement());
if (dst.getPeriod() == null && src.getPeriod() != null)
dst.setPeriod(src.getPeriod());
}
}

View File

@ -1,127 +1,106 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. /**
* Redistributions in binary form must reproduce the above copyright notice, * This class is created to help implementers deal with a change to
this list of conditions and the following disclaimer in the documentation * the API that was made between versions 0.81 and 0.9
and/or other materials provided with the distribution. *
* Neither the name of HL7 nor the names of its contributors may be used to * The change is the behaviour of the .getX() where the cardinality of
endorse or promote products derived from this software without specific * x is 0..1 or 1..1. Before the change, these routines would return
prior written permission. * null if the object had not previously been assigned, and after the '
* change, they will automatically create the object if it had not
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * been assigned (unless the object is polymorphic, in which case,
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * only the type specific getters create the object)
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * When making the transition from the old style to the new style,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * the main change is that when testing for presence or abssense
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * of the element, instead of doing one of these two:
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, *
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * if (obj.getProperty() == null)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * if (obj.getProperty() != null)
POSSIBILITY OF SUCH DAMAGE. *
* you instead do
*/ *
* if (!obj.hasProperty())
/** * if (obj.hasProperty())
* This class is created to help implementers deal with a change to *
* the API that was made between versions 0.81 and 0.9 * or else one of these two:
* *
* The change is the behaviour of the .getX() where the cardinality of * if (obj.getProperty().isEmpty())
* x is 0..1 or 1..1. Before the change, these routines would return * if (!obj.getProperty().isEmpty())
* null if the object had not previously been assigned, and after the ' *
* change, they will automatically create the object if it had not * The only way to sort this out is by finding all these things
* been assigned (unless the object is polymorphic, in which case, * in the code, and changing them.
* only the type specific getters create the object) *
* * To help with that, you can set the status field of this class
* When making the transition from the old style to the new style, * to change how this API behaves. Note: the status value is tied
* the main change is that when testing for presence or abssense * to the way that you program. The intent of this class is to
* of the element, instead of doing one of these two: * help make developers the transiition to status = 0. The old
* * behaviour is status = 2. To make the transition, set the
* if (obj.getProperty() == null) * status code to 1. This way, any time a .getX routine needs
* if (obj.getProperty() != null) * to automatically create an object, an exception will be
* * raised instead. The expected use of this is:
* you instead do * - set status = 1
* * - test your code (all paths)
* if (!obj.hasProperty()) * - when an exception happens, change the code to use .hasX() or .isEmpty()
* if (obj.hasProperty()) * - when all execution paths don't raise an exception, set status = 0
* * - start programming to the new style.
* or else one of these two: *
* * You can set status = 2 and leave it like that, but this is not
* if (obj.getProperty().isEmpty()) * compatible with the utilities and validation code, nor with the
* if (!obj.getProperty().isEmpty()) * HAPI code. So everyone shoul make this transition
* *
* The only way to sort this out is by finding all these things * This is a difficult change to make to an API. Most users should engage with it
* in the code, and changing them. * as they migrate from DSTU1 to DSTU2, at the same time as they encounter
* * other changes. This change was made in order to align the two java reference
* To help with that, you can set the status field of this class * implementations on a common object model, which is an important outcome that
* to change how this API behaves. Note: the status value is tied * justifies making this change to implementers (sorry for any pain caused)
* to the way that you program. The intent of this class is to *
* help make developers the transiition to status = 0. The old * @author Grahame
* behaviour is status = 2. To make the transition, set the *
* status code to 1. This way, any time a .getX routine needs */
* to automatically create an object, an exception will be public class Configuration {
* raised instead. The expected use of this is:
* - set status = 1 private static int status = 0;
* - test your code (all paths) // 0: auto-create
* - when an exception happens, change the code to use .hasX() or .isEmpty() // 1: error
* - when all execution paths don't raise an exception, set status = 0 // 2: return null
* - start programming to the new style.
* public static boolean errorOnAutoCreate() {
* You can set status = 2 and leave it like that, but this is not return status == 1;
* compatible with the utilities and validation code, nor with the }
* HAPI code. So everyone shoul make this transition
*
* This is a difficult change to make to an API. Most users should engage with it public static boolean doAutoCreate() {
* as they migrate from DSTU1 to DSTU2, at the same time as they encounter return status == 0;
* other changes. This change was made in order to align the two java reference }
* implementations on a common object model, which is an important outcome that
* justifies making this change to implementers (sorry for any pain caused) }
*
* @author Grahame
*
*/
public class Configuration {
private static int status = 0;
// 0: auto-create
// 1: error
// 2: return null
public static boolean errorOnAutoCreate() {
return status == 1;
}
public static boolean doAutoCreate() {
return status == 0;
}
}

View File

@ -1,61 +1,40 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. public class Constants {
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific public final static String VERSION = "0.5.0";
prior written permission. public final static String REVISION = "5283";
public final static String DATE = "Fri May 22 17:15:32 EDT 2015";
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND }
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
public class Constants {
public final static String VERSION = "0.5.0";
public final static String REVISION = "5239";
public final static String DATE = "Tue May 05 16:13:57 EDT 2015";
}

View File

@ -1,111 +1,90 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import org.hl7.fhir.instance.model.annotations.DatatypeDef;
and/or other materials provided with the distribution. import org.hl7.fhir.instance.model.annotations.Block;
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.api.*;
endorse or promote products derived from this software without specific /**
prior written permission. * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND @DatatypeDef(name="Count")
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED public class Count extends Quantity {
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, private static final long serialVersionUID = -483422721L;
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public Count copy() {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, Count dst = new Count();
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) copyValues(dst);
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dst.value = value == null ? null : value.copy();
POSSIBILITY OF SUCH DAMAGE. dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy();
*/ dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 return dst;
}
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block; protected Count typedCopy() {
import org.hl7.fhir.instance.model.api.*; return copy();
/** }
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/ @Override
@DatatypeDef(name="Count") public boolean equalsDeep(Base other) {
public class Count extends Quantity { if (!super.equalsDeep(other))
return false;
private static final long serialVersionUID = -483422721L; if (!(other instanceof Count))
return false;
public Count copy() { Count o = (Count) other;
Count dst = new Count(); return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
copyValues(dst); && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
dst.value = value == null ? null : value.copy(); }
dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy(); @Override
dst.system = system == null ? null : system.copy(); public boolean equalsShallow(Base other) {
dst.code = code == null ? null : code.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Count))
return false;
protected Count typedCopy() { Count o = (Count) other;
return copy(); return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
} && compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
return false; && (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
if (!(other instanceof Count)) ;
return false; }
Count o = (Count) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true); }
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Count))
return false;
Count o = (Count) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -0,0 +1,611 @@
package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.text.ParseException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.hl7.fhir.utilities.Utilities;
// java 1.7 can parse xml date/times, but going java 1.7 is too hard for implementers
// javax.xml.bind.DatatypeConverter can parse xml date/times, but is not available on android. (and it's error message sucks)
// anyway, the underlying date/time concept has variable precision, and timezone, and neither Date nor Calendar real with
// that nicely. So we parse the date directly
public class DateAndTime {
private int year;
private int month;
private int day;
private boolean time;
private int hour;
private int minute;
private boolean seconds;
private int second;
private int fractions;
private int fraction;
private java.lang.Boolean timezone;
private boolean positiveOffset; //needed to represent negative offset of less than an hour (for example -00:00 or -00:30)
private int tzHour;
private int tzMin;
public DateAndTime(String xDate) throws ParseException {
String s;
String t = null;
if (xDate.endsWith("Z")) {
s = xDate.substring(0, xDate.length()-1);
timezone = false;
} else if (xDate.lastIndexOf("-") > 8) {
s = xDate.substring(0, xDate.lastIndexOf("-"));
t = xDate.substring(xDate.lastIndexOf("-"));
setTzSign(false);
} else if (xDate.lastIndexOf("+") > 8) {
s = xDate.substring(0, xDate.lastIndexOf("+"));
t = xDate.substring(xDate.lastIndexOf("+"));
setTzSign(true);
} else { // no timezone
s = xDate;
t = null;
timezone = null;
}
int offset = 0;
try {
int yearlength = s.startsWith("-") ? s.substring(1).indexOf("-") + 1 : s.indexOf("-");
if (yearlength == -1) {
yearlength = 4;
}
setYear(readField(s, 0, yearlength));
offset = yearlength;
if (s.length() >= yearlength + 3)
setMonth(readField(s, yearlength + 1, 2));
offset = yearlength + 4;
if (s.length() >= yearlength + 6)
setDay(readField(s, yearlength + 4, 2));
offset = yearlength + 7;
if (s.length() >= yearlength + 9)
setHour(readField(s, yearlength + 7, 2));
offset = yearlength + 10;
if (s.length() >= yearlength + 12)
setMinute(readField(s, yearlength + 10, 2));
offset = yearlength + 13;
if (s.length() >= yearlength + 15)
setSecond(readField(s, yearlength + 13, 2));
offset = yearlength + 16;
if (s.length() >= yearlength + 17) {
setFractions(s.length() - (yearlength + 16));
setFraction(readField(s, yearlength + 16, fractions));
}
if (t != null) {
setTzHour(readField(t, 1, 2));
setTzMin(readField(t, 4, 2));
}
} catch (Exception e) {
throw new ParseException("The date '"+xDate+"' is not a valid Date Time Format at character "+java.lang.Integer.toString(offset), offset);
}
}
private static int readField(String date, int i, int j) {
String s = date.substring(i, i+j);
if (s.startsWith("+"))
s = s.substring(1);
return java.lang.Integer.parseInt(s);
}
public DateAndTime(Calendar date) {
setCalendar(date);
}
private void setCalendar(Calendar date) {
setYear(date.get(Calendar.YEAR));
setMonth(date.get(Calendar.MONTH)+1);
setDay(date.get(Calendar.DAY_OF_MONTH));
setHour(date.get(Calendar.HOUR_OF_DAY));
setMinute(date.get(Calendar.MINUTE));
setSecond(date.get(Calendar.SECOND));
if (date.get(Calendar.MILLISECOND) > 0) {
setFractions(3);
try {
setFraction(date.get(Calendar.MILLISECOND));
} catch (Exception e) {
// can't happen
}
}
if (date.getTimeZone() != null) {
int offset = date.getTimeZone().getOffset(date.getTime().getTime());
setOffsetMinutes(offset / 1000 / 60);
}
}
public DateAndTime(java.util.Date date) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
setCalendar(cal);
}
private DateAndTime() {
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append(Utilities.padLeft(java.lang.Integer.toString(year), '0', 4));
if (month != 0) {
b.append("-");
b.append(Utilities.padLeft(java.lang.Integer.toString(month), '0', 2));
if (day != 0) {
b.append("-");
b.append(Utilities.padLeft(java.lang.Integer.toString(day), '0', 2));
if (time) {
b.append("T");
b.append(Utilities.padLeft(java.lang.Integer.toString(hour), '0', 2));
b.append(":");
b.append(Utilities.padLeft(java.lang.Integer.toString(minute), '0', 2));
if (seconds) {
b.append(":");
b.append(Utilities.padLeft(java.lang.Integer.toString(second), '0', 2));
if (fractions > 0) {
b.append(".");
b.append(Utilities.padLeft(java.lang.Integer.toString(fraction), '0', fractions));
}
}
}
if (timezone != null) {
if (!timezone) {
b.append("Z");
} else {
if (positiveOffset) {
b.append("+");
} else {
b.append("-");
}
b.append(Utilities.padLeft(java.lang.Integer.toString(tzHour), '0', 2));
b.append(":");
b.append(Utilities.padLeft(java.lang.Integer.toString(tzMin), '0', 2));
}
}
}
}
return b.toString();
}
public Calendar toCalendar() {
Calendar cal = null;
if (timezone == null) {
cal = Calendar.getInstance();
} else {
TimeZone tz;
if (!timezone) {
tz = TimeZone.getTimeZone("GMT+00:00");
} else {
tz = TimeZone.getTimeZone("GMT"+(positiveOffset ? "+" : "-")+Utilities.padLeft(java.lang.Integer.toString(tzHour), '0', 2)+":"+Utilities.padLeft(java.lang.Integer.toString(tzMin), '0', 2));
}
cal = Calendar.getInstance(tz);
}
//default to 0 if unset
cal.set(Calendar.MONTH, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.set(Calendar.YEAR, year);
if (month > 0) {
cal.set(Calendar.MONTH, month - 1);
if (day > 0) {
cal.set(Calendar.DAY_OF_MONTH, day);
if (time) {
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
if (seconds) {
cal.set(Calendar.SECOND, second);
if (fractions > 0) {
cal.set(Calendar.MILLISECOND, (int)((double) fraction / Math.pow(10, fractions) * 1000.0));
}
}
}
}
}
return cal;
}
public DateType toDate() {
return null;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public boolean isTime() {
return time;
}
public void setTime(boolean time) {
this.time = time;
if (!time)
setSeconds(false);
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.time = true;
this.hour = hour;
}
public int getMinute() {
return minute;
}
public void setMinute(int minute) {
this.time = true;
this.minute = minute;
}
public boolean isSeconds() {
return seconds;
}
public void setSeconds(boolean seconds) {
this.seconds = seconds;
if (!seconds)
setFractions(0);
}
public int getSecond() {
return second;
}
public void setSecond(int second) {
this.time = true;
this.seconds = true;
this.second = second;
}
public int getFractions() {
return fractions;
}
public void setFractions(int fractions) {
this.fractions = fractions;
}
public int getFraction() {
return fraction;
}
public void setFraction(int fraction) throws Exception {
if (this.fractions == 0)
throw new Exception("set 'fractions' before setting 'fraction'");
this.fraction = fraction;
}
public java.lang.Boolean getTimezone() {
return timezone;
}
public void setTimezone(java.lang.Boolean timezone) {
this.timezone = timezone;
}
public int getTzHour() {
return tzHour;
}
public void setTzHour(int tzHour) {
this.tzHour = Math.abs(tzHour);
this.timezone = true;
}
/**
* @param isPositiveOffset - true if the tz offset is positive (i.e. +06:00), false if the tz offset is negative (-06:00)
*/
public void setTzSign(boolean isPositiveOffset) {
positiveOffset = isPositiveOffset;
this.timezone = true;
}
/**
* @return true if the tz offset is positive (i.e. +06:00), false if the tz offset is negative (-06:00)
*/
public boolean getTzSign() {
return positiveOffset;
}
/**
* @param offset in minutes
*/
public void setOffsetMinutes(int offset) {
boolean positive = (offset >= 0);
offset = Math.abs(offset);
setTzHour(offset / 60);
setTzMin(offset % 60);
setTzSign(positive);
}
/**
* @return offset in minutes
*/
public int getOffsetMinutes() {
if(timezone == null || !timezone) {
return 0;
} else {
return (positiveOffset ? 1 : -1) * (tzHour * 60 + tzMin);
}
}
public int getTzMin() {
return tzMin;
}
public void setTzMin(int tzMin) {
this.tzMin = Math.abs(tzMin);
this.timezone = true;
}
public static DateAndTime now() {
return new DateAndTime(Calendar.getInstance());
}
public static DateAndTime today() {
DateAndTime dt = new DateAndTime(Calendar.getInstance());
dt.setTime(false);
return dt;
}
public static DateAndTime parseV3(String xDate) throws ParseException {
DateAndTime res = new DateAndTime();
String s;
String t = null;
if (xDate.endsWith("Z")) {
s = xDate.substring(0, xDate.length()-1);
res.timezone = false;
} else if (xDate.lastIndexOf("-") > 0) {
s = xDate.substring(0, xDate.lastIndexOf("-"));
t = xDate.substring(xDate.lastIndexOf("-"));
res.setTzSign(false);
} else if (xDate.lastIndexOf("+") > 0) {
s = xDate.substring(0, xDate.lastIndexOf("+"));
t = xDate.substring(xDate.lastIndexOf("+"));
res.setTzSign(true);
} else { // no timezone
s = xDate;
t = null;
res.timezone = null;
}
int offset = 0;
try {
res.setYear(readField(s, 0, 4));
offset = 4;
if (s.length() >= 6)
res.setMonth(readField(s, 4, 2));
offset = 6;
if (s.length() >= 8)
res.setDay(readField(s, 6, 2));
offset = 8;
if (s.length() >= 10)
res.setHour(readField(s, 8, 2));
offset = 10;
if (s.length() >= 12)
res.setMinute(readField(s, 10, 2));
offset = 12;
if (s.length() >= 14)
res.setSecond(readField(s, 12, 2));
offset = 15;
if (s.length() >= 16) {
res.setFractions(s.length() - (15));
res.setFraction(readField(s, 15, res.fractions));
}
if (t != null) {
res.setTzHour(readField(t, 1, 2));
res.setTzMin(readField(t, 3, 2));
}
} catch (Exception e) {
throw new ParseException("The date '"+xDate+"' is not a valid Date Time Format at character "+java.lang.Integer.toString(offset), offset);
}
return res;
}
public DateAndTime expandTime() {
time = true;
seconds = true;
timezone = true;
TimeZone tz = TimeZone.getDefault();
int offset = tz.getOffset(new java.util.Date().getTime());
setOffsetMinutes(offset / (60 * 1000));
return this;
}
public String toHumanDisplay() {
if (isTime())
return java.lang.Integer.toString(this.day)+"-"+this.getMonthCode()+" "+java.lang.Integer.toString(this.getYear()) +" "+java.lang.Integer.toString(this.hour)+":"+java.lang.Integer.toString(this.minute);
else
return java.lang.Integer.toString(this.day)+"-"+this.getMonthCode()+" "+java.lang.Integer.toString(this.getYear());
}
private String getMonthCode() {
switch (month) {
case 1: return "Jan";
case 2: return "Feb";
case 3: return "Mar";
case 4: return "Apr";
case 5: return "May";
case 6: return "Jun";
case 7: return "Jul";
case 8: return "Aug";
case 9: return "Sep";
case 10: return "Oct";
case 11: return "Nov";
case 12: return "Dec";
}
return null;
}
/**
* Add a duration to the DateAndTime. See documentation for Calendar.add
*
* @param field - Calendar constants for field
* @param value - value to add - can be positive or negative
* @throws Exception
*/
public void add(int field, int value) throws Exception {
switch (field) {
case Calendar.YEAR:
year = year + value;
break;
case Calendar.MONTH:
month = month + (value == 0 ? 1 : value);
while (month <= 0) {
add(Calendar.YEAR, -1);
month = month + 12;
}
while (month > 12) {
add(Calendar.YEAR, 1);
month = month - 12;
}
break;
case Calendar.DAY_OF_YEAR:
day = day + (value == 0 ? 1 : value);
while (day <= 0) {
add(Calendar.MONTH, -1);
day = day + daysInMonth(year, month);
}
int days = daysInMonth(year, month);
while (day > days) {
add(Calendar.MONTH, 1);
day = day - days;
days = daysInMonth(year, month);
}
break;
case Calendar.HOUR:
hour = hour + value;
time = true;
while (hour < 0) {
add(Calendar.DAY_OF_YEAR, -1);
hour = hour + 24;
}
while (hour >= 24) {
add(Calendar.DAY_OF_YEAR, 1);
hour = hour - 24;
}
break;
case Calendar.MINUTE:
minute = minute + value;
time = true;
while (minute < 0) {
add(Calendar.HOUR, -1);
minute = minute + 60;
}
while (minute >= 60) {
add(Calendar.HOUR, 1);
minute = minute - 60;
}
break;
case Calendar.SECOND:
second = second + value;
seconds = true;
while (second < 0) {
add(Calendar.MINUTE, -1);
second = second + 60;
}
while (second >= 60) {
add(Calendar.MINUTE, 1);
second = second - 60;
}
break;
default:
throw new Exception("Unknown field");
}
}
private int daysInMonth(int aYear, int aMonth) {
switch (aMonth) {
case 1: return 31;
case 2: return isleapYear(aYear) ? 29 : 28;
case 3: return 31;
case 4: return 30;
case 5: return 31;
case 6: return 30;
case 7: return 31;
case 8: return 31;
case 9: return 30;
case 10: return 31;
case 11: return 30;
case 12: return 31;
default:
throw new Error("illegal month "+java.lang.Integer.toString(aMonth));
}
}
private boolean isleapYear(int aYear) {
return (aYear % 4 == 0) && !((aYear % 100 == 0) && (aYear % 400 != 0));
}
public boolean before(DateAndTime other) {
if(this.time && other.time) {
return toCalendar().getTimeInMillis() < other.toCalendar().getTimeInMillis();
} else if (this.year != other.year) {
return this.year < other.year;
} else if (this.month != other.month) {
return this.month < other.month;
} else if (this.day != other.day) {
return this.day < other.day;
} else
return false;
}
}

View File

@ -1,213 +1,192 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import java.util.Calendar;
* #%L import java.util.Date;
* HAPI FHIR Structures - HL7.org DSTU2 import java.util.TimeZone;
* %% import java.util.zip.DataFormatException;
* Copyright (C) 2014 - 2015 University Health Network
* %% import org.apache.commons.lang3.time.DateUtils;
* Licensed under the Apache License, Version 2.0 (the "License"); import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at /**
* * Represents a FHIR dateTime datatype. Valid precisions values for this type are:
* http://www.apache.org/licenses/LICENSE-2.0 * <ul>
* * <li>{@link TemporalPrecisionEnum#YEAR}
* Unless required by applicable law or agreed to in writing, software * <li>{@link TemporalPrecisionEnum#MONTH}
* distributed under the License is distributed on an "AS IS" BASIS, * <li>{@link TemporalPrecisionEnum#DAY}
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * <li>{@link TemporalPrecisionEnum#SECOND}
* See the License for the specific language governing permissions and * <li>{@link TemporalPrecisionEnum#MILLI}
* limitations under the License. * </ul>
* #L% */
*/ @DatatypeDef(name = "dateTime")
public class DateTimeType extends BaseDateTimeType {
import java.util.Calendar; private static final long serialVersionUID = 3L;
import java.util.Date;
import java.util.TimeZone; /**
import java.util.zip.DataFormatException; * The default precision for this type
*/
import org.apache.commons.lang3.time.DateUtils; public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
/**
/** * Constructor
* Represents a FHIR dateTime datatype. Valid precisions values for this type are: */
* <ul> public DateTimeType() {
* <li>{@link TemporalPrecisionEnum#YEAR} super();
* <li>{@link TemporalPrecisionEnum#MONTH} }
* <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND} /**
* <li>{@link TemporalPrecisionEnum#MILLI} * Create a new DateTimeDt with seconds precision and the local time zone
* </ul> */
*/ public DateTimeType(Date theDate) {
@DatatypeDef(name = "dateTime") super(theDate, DEFAULT_PRECISION, TimeZone.getDefault());
public class DateTimeType extends BaseDateTimeType { }
private static final long serialVersionUID = 3L; /**
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
/** * <ul>
* The default precision for this type * <li>{@link TemporalPrecisionEnum#YEAR}
*/ * <li>{@link TemporalPrecisionEnum#MONTH}
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND; * <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND}
/** * <li>{@link TemporalPrecisionEnum#MILLI}
* Constructor * </ul>
*/ *
public DateTimeType() { * @throws DataFormatException
super(); * If the specified precision is not allowed for this type
} */
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) {
/** super(theDate, thePrecision, TimeZone.getDefault());
* Create a new DateTimeDt with seconds precision and the local time zone }
*/
public DateTimeType(Date theDate) { /**
super(theDate, DEFAULT_PRECISION, TimeZone.getDefault()); * Create a new instance using a string date/time
} *
* @throws DataFormatException
/** * If the specified precision is not allowed for this type
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are: */
* <ul> public DateTimeType(String theValue) {
* <li>{@link TemporalPrecisionEnum#YEAR} super(theValue);
* <li>{@link TemporalPrecisionEnum#MONTH} }
* <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND} /**
* <li>{@link TemporalPrecisionEnum#MILLI} * Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type
* </ul> * are:
* * <ul>
* @throws DataFormatException * <li>{@link TemporalPrecisionEnum#YEAR}
* If the specified precision is not allowed for this type * <li>{@link TemporalPrecisionEnum#MONTH}
*/ * <li>{@link TemporalPrecisionEnum#DAY}
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) { * <li>{@link TemporalPrecisionEnum#SECOND}
super(theDate, thePrecision, TimeZone.getDefault()); * <li>{@link TemporalPrecisionEnum#MILLI}
} * </ul>
*/
/** public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) {
* Create a new instance using a string date/time super(theDate, thePrecision, theTimezone);
* }
* @throws DataFormatException
* If the specified precision is not allowed for this type /**
*/ * Constructor
public DateTimeType(String theValue) { */
super(theValue); public DateTimeType(Calendar theCalendar) {
} if (theCalendar != null) {
setValue(theCalendar.getTime());
/** setPrecision(DEFAULT_PRECISION);
* Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type setTimeZone(theCalendar.getTimeZone());
* are: }
* <ul> }
* <li>{@link TemporalPrecisionEnum#YEAR}
* <li>{@link TemporalPrecisionEnum#MONTH} @Override
* <li>{@link TemporalPrecisionEnum#DAY} boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
* <li>{@link TemporalPrecisionEnum#SECOND} switch (thePrecision) {
* <li>{@link TemporalPrecisionEnum#MILLI} case YEAR:
* </ul> case MONTH:
*/ case DAY:
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) { case SECOND:
super(theDate, thePrecision, theTimezone); case MILLI:
} return true;
default:
/** return false;
* Constructor }
*/ }
public DateTimeType(Calendar theCalendar) {
if (theCalendar != null) { /**
setValue(theCalendar.getTime()); * Returns a new instance of DateTimeType with the current system time and SECOND precision and the system local time
setPrecision(DEFAULT_PRECISION); * zone
setTimeZone(theCalendar.getTimeZone()); */
} public static DateTimeType now() {
} return new DateTimeType(new Date(), TemporalPrecisionEnum.SECOND, TimeZone.getDefault());
}
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) { /**
switch (thePrecision) { * Returns the default precision for this datatype
case YEAR: *
case MONTH: * @see #DEFAULT_PRECISION
case DAY: */
case SECOND: @Override
case MILLI: protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
return true; return DEFAULT_PRECISION;
default: }
return false;
} @Override
} public DateTimeType copy() {
return new DateTimeType(getValueAsString());
/** }
* Returns a new instance of DateTimeType with the current system time and SECOND precision and the system local time
* zone /**
*/ * Creates a new instance by parsing an HL7 v3 format date time string
public static DateTimeType now() { */
return new DateTimeType(new Date(), TemporalPrecisionEnum.SECOND, TimeZone.getDefault()); public static DateTimeType parseV3(String theV3String) {
} DateTimeType retVal = new DateTimeType();
retVal.setValueAsV3String(theV3String);
/** return retVal;
* Returns the default precision for this datatype }
*
* @see #DEFAULT_PRECISION public static DateTimeType today() {
*/ DateTimeType retVal = now();
@Override retVal.setPrecision(TemporalPrecisionEnum.DAY);
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() { return retVal;
return DEFAULT_PRECISION; }
}
public boolean getTzSign() {
@Override return getTimeZone().getRawOffset() >= 0;
public DateTimeType copy() { }
return new DateTimeType(getValueAsString());
} public int getTzHour() {
return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) / 60;
/** }
* Creates a new instance by parsing an HL7 v3 format date time string
*/ public int getTzMin() {
public static DateTimeType parseV3(String theV3String) { return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) % 60;
DateTimeType retVal = new DateTimeType(); }
retVal.setValueAsV3String(theV3String);
return retVal;
} }
public static DateTimeType today() {
DateTimeType retVal = now();
retVal.setPrecision(TemporalPrecisionEnum.DAY);
return retVal;
}
public boolean getTzSign() {
return getTimeZone().getRawOffset() >= 0;
}
public int getTzHour() {
return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) / 60;
}
public int getTzMin() {
return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) % 60;
}
}

View File

@ -1,159 +1,138 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /**
* #%L * Primitive type "date" in FHIR: any day in a gregorian calendar
* HAPI FHIR Structures - HL7.org DSTU2 */
* %%
* Copyright (C) 2014 - 2015 University Health Network import java.util.Date;
* %% import java.util.TimeZone;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* You may obtain a copy of the License at
* /**
* http://www.apache.org/licenses/LICENSE-2.0 * Represents a FHIR date datatype. Valid precisions values for this type are:
* * <ul>
* Unless required by applicable law or agreed to in writing, software * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
* distributed under the License is distributed on an "AS IS" BASIS, * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH}
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY}
* See the License for the specific language governing permissions and * </ul>
* limitations under the License. */
* #L% @DatatypeDef(name = "date")
*/ public class DateType extends BaseDateTimeType {
private static final long serialVersionUID = 3L;
/**
* Primitive type "date" in FHIR: any day in a gregorian calendar /**
*/ * The default precision for this type
*/
import java.util.Date; public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY;
import java.util.TimeZone;
/**
import org.hl7.fhir.instance.model.annotations.DatatypeDef; * Constructor
*/
/** public DateType() {
* Represents a FHIR date datatype. Valid precisions values for this type are: super();
* <ul> }
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH} /**
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY} * Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type
* </ul> */
*/ public DateType(Date theDate) {
@DatatypeDef(name = "date") super(theDate, DEFAULT_PRECISION);
public class DateType extends BaseDateTimeType { }
private static final long serialVersionUID = 3L; /**
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
/** * <ul>
* The default precision for this type * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
*/ * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH}
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY; * <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY}
* </ul>
/** *
* Constructor * @throws ca.uhn.fhir.parser.DataFormatException
*/ * If the specified precision is not allowed for this type
public DateType() { */
super(); public DateType(Date theDate, TemporalPrecisionEnum thePrecision) {
} super(theDate, thePrecision);
}
/**
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type /**
*/ * Constructor which accepts a date as a string in FHIR format
public DateType(Date theDate) { *
super(theDate, DEFAULT_PRECISION); * @throws ca.uhn.fhir.parser.DataFormatException
} * If the precision in the date string is not allowed for this type
*/
/** public DateType(String theDate) {
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are: super(theDate);
* <ul> }
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH} @Override
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY} boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
* </ul> switch (thePrecision) {
* case YEAR:
* @throws ca.uhn.fhir.parser.DataFormatException case MONTH:
* If the specified precision is not allowed for this type case DAY:
*/ return true;
public DateType(Date theDate, TemporalPrecisionEnum thePrecision) { default:
super(theDate, thePrecision); return false;
} }
}
/**
* Constructor which accepts a date as a string in FHIR format /**
* * Returns the default precision for this datatype
* @throws ca.uhn.fhir.parser.DataFormatException *
* If the precision in the date string is not allowed for this type * @see #DEFAULT_PRECISION
*/ */
public DateType(String theDate) { @Override
super(theDate); protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
} return DEFAULT_PRECISION;
}
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) { @Override
switch (thePrecision) { public DateType copy() {
case YEAR: return new DateType(getValue());
case MONTH: }
case DAY:
return true; public static InstantType today() {
default: return new InstantType(new Date(), TemporalPrecisionEnum.DAY, TimeZone.getDefault());
return false; }
}
} /**
* Creates a new instance by parsing an HL7 v3 format date time string
/** */
* Returns the default precision for this datatype public static DateType parseV3(String theV3String) {
* DateType retVal = new DateType();
* @see #DEFAULT_PRECISION retVal.setValueAsV3String(theV3String);
*/ return retVal;
@Override }
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
return DEFAULT_PRECISION; }
}
@Override
public DateType copy() {
return new DateType(getValue());
}
public static InstantType today() {
return new InstantType(new Date(), TemporalPrecisionEnum.DAY, TimeZone.getDefault());
}
/**
* Creates a new instance by parsing an HL7 v3 format date time string
*/
public static DateType parseV3(String theV3String) {
DateType retVal = new DateType();
retVal.setValueAsV3String(theV3String);
return retVal;
}
}

View File

@ -1,179 +1,158 @@
/* /*
Copyright (c) 2011+, HL7, Inc Copyright (c) 2011+, HL7, Inc
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/** /**
* *
*/ */
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import java.math.BigDecimal;
* #%L import java.math.MathContext;
* HAPI FHIR Structures - HL7.org DSTU2 import java.math.RoundingMode;
* %%
* Copyright (C) 2014 - 2015 University Health Network import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* %% import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. /**
* You may obtain a copy of the License at * Primitive type "decimal" in FHIR: A rational number
* */
* http://www.apache.org/licenses/LICENSE-2.0 @DatatypeDef(name = "decimal")
* public class DecimalType extends PrimitiveType<BigDecimal> implements Comparable<DecimalType>, IBaseDecimalDatatype {
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, private static final long serialVersionUID = 3L;
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and /**
* limitations under the License. * Constructor
* #L% */
*/ public DecimalType() {
super();
}
import java.math.BigDecimal;
import java.math.MathContext; /**
import java.math.RoundingMode; * Constructor
*/
import org.hl7.fhir.instance.model.annotations.DatatypeDef; public DecimalType(BigDecimal theValue) {
import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype; setValue(theValue);
}
/**
* Primitive type "decimal" in FHIR: A rational number /**
*/ * Constructor
@DatatypeDef(name = "decimal") */
public class DecimalType extends PrimitiveType<BigDecimal> implements Comparable<DecimalType>, IBaseDecimalDatatype { public DecimalType(double theValue) {
// Use the valueOf here because the constructor gives wacky precision
private static final long serialVersionUID = 3L; // changes due to the floating point conversion
setValue(BigDecimal.valueOf(theValue));
/** }
* Constructor
*/ /**
public DecimalType() { * Constructor
super(); */
} public DecimalType(long theValue) {
setValue(new BigDecimal(theValue));
/** }
* Constructor
*/ /**
public DecimalType(BigDecimal theValue) { * Constructor
setValue(theValue); */
} public DecimalType(String theValue) {
setValue(new BigDecimal(theValue));
/** }
* Constructor
*/ @Override
public DecimalType(double theValue) { public int compareTo(DecimalType theObj) {
// Use the valueOf here because the constructor gives wacky precision if (getValue() == null && theObj.getValue() == null) {
// changes due to the floating point conversion return 0;
setValue(BigDecimal.valueOf(theValue)); }
} if (getValue() != null && theObj.getValue() == null) {
return 1;
/** }
* Constructor if (getValue() == null && theObj.getValue() != null) {
*/ return -1;
public DecimalType(long theValue) { }
setValue(new BigDecimal(theValue)); return getValue().compareTo(theObj.getValue());
} }
/** @Override
* Constructor protected String encode(BigDecimal theValue) {
*/ return getValue().toPlainString();
public DecimalType(String theValue) { }
setValue(new BigDecimal(theValue));
} /**
* Gets the value as an integer, using {@link BigDecimal#intValue()}
@Override */
public int compareTo(DecimalType theObj) { public int getValueAsInteger() {
if (getValue() == null && theObj.getValue() == null) { return getValue().intValue();
return 0; }
}
if (getValue() != null && theObj.getValue() == null) { public Number getValueAsNumber() {
return 1; return getValue();
} }
if (getValue() == null && theObj.getValue() != null) {
return -1; @Override
} protected BigDecimal parse(String theValue) {
return getValue().compareTo(theObj.getValue()); return new BigDecimal(theValue);
} }
@Override /**
protected String encode(BigDecimal theValue) { * Rounds the value to the given prevision
return getValue().toPlainString(); *
} * @see MathContext#getPrecision()
*/
/** public void round(int thePrecision) {
* Gets the value as an integer, using {@link BigDecimal#intValue()} if (getValue() != null) {
*/ BigDecimal newValue = getValue().round(new MathContext(thePrecision));
public int getValueAsInteger() { setValue(newValue);
return getValue().intValue(); }
} }
public Number getValueAsNumber() { /**
return getValue(); * Rounds the value to the given prevision
} *
* @see MathContext#getPrecision()
@Override * @see MathContext#getRoundingMode()
protected BigDecimal parse(String theValue) { */
return new BigDecimal(theValue); public void round(int thePrecision, RoundingMode theRoundingMode) {
} if (getValue() != null) {
BigDecimal newValue = getValue().round(new MathContext(thePrecision, theRoundingMode));
/** setValue(newValue);
* Rounds the value to the given prevision }
* }
* @see MathContext#getPrecision()
*/ /**
public void round(int thePrecision) { * Sets a new value using an integer
if (getValue() != null) { */
BigDecimal newValue = getValue().round(new MathContext(thePrecision)); public void setValueAsInteger(int theValue) {
setValue(newValue); setValue(new BigDecimal(theValue));
} }
}
@Override
/** public DecimalType copy() {
* Rounds the value to the given prevision return new DecimalType(getValue());
* }
* @see MathContext#getPrecision()
* @see MathContext#getRoundingMode() }
*/
public void round(int thePrecision, RoundingMode theRoundingMode) {
if (getValue() != null) {
BigDecimal newValue = getValue().round(new MathContext(thePrecision, theRoundingMode));
setValue(newValue);
}
}
/**
* Sets a new value using an integer
*/
public void setValueAsInteger(int theValue) {
setValue(new BigDecimal(theValue));
}
@Override
public DecimalType copy() {
return new DecimalType(getValue());
}
}

View File

@ -1,111 +1,90 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import org.hl7.fhir.instance.model.annotations.DatatypeDef;
and/or other materials provided with the distribution. import org.hl7.fhir.instance.model.annotations.Block;
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.api.*;
endorse or promote products derived from this software without specific /**
prior written permission. * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND @DatatypeDef(name="Distance")
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED public class Distance extends Quantity {
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, private static final long serialVersionUID = -483422721L;
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public Distance copy() {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, Distance dst = new Distance();
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) copyValues(dst);
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dst.value = value == null ? null : value.copy();
POSSIBILITY OF SUCH DAMAGE. dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy();
*/ dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 return dst;
}
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block; protected Distance typedCopy() {
import org.hl7.fhir.instance.model.api.*; return copy();
/** }
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/ @Override
@DatatypeDef(name="Distance") public boolean equalsDeep(Base other) {
public class Distance extends Quantity { if (!super.equalsDeep(other))
return false;
private static final long serialVersionUID = -483422721L; if (!(other instanceof Distance))
return false;
public Distance copy() { Distance o = (Distance) other;
Distance dst = new Distance(); return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
copyValues(dst); && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
dst.value = value == null ? null : value.copy(); }
dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy(); @Override
dst.system = system == null ? null : system.copy(); public boolean equalsShallow(Base other) {
dst.code = code == null ? null : code.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Distance))
return false;
protected Distance typedCopy() { Distance o = (Distance) other;
return copy(); return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
} && compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
return false; && (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
if (!(other instanceof Distance)) ;
return false; }
Distance o = (Distance) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true); }
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Distance))
return false;
Distance o = (Distance) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -1,287 +1,266 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.annotations.ResourceDef;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
prior written permission. import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * A resource that includes narrative, extensions, and contained resources.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public abstract class DomainResource extends Resource implements IBaseHasExtensions, IBaseHasModifierExtensions, IDomainResource {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) /**
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.
POSSIBILITY OF SUCH DAMAGE. */
@Child(name = "text", type = {Narrative.class}, order=0, min=0, max=1)
*/ @Description(shortDefinition="Text summary of the resource, for human interpretation", formalDefinition="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." )
protected Narrative text;
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
/**
import java.util.*; * These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
*/
import org.hl7.fhir.instance.model.annotations.ResourceDef; @Child(name = "contained", type = {Resource.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; @Description(shortDefinition="Contained, inline Resources", formalDefinition="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." )
import org.hl7.fhir.instance.model.annotations.Child; protected List<Resource> contained;
import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.Block; /**
import org.hl7.fhir.instance.model.api.*; * May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
/** */
* A resource that includes narrative, extensions, and contained resources. @Child(name = "extension", type = {Extension.class}, order=2, min=0, max=Child.MAX_UNLIMITED)
*/ @Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
public abstract class DomainResource extends Resource implements IBaseHasExtensions, IBaseHasModifierExtensions, IDomainResource { protected List<Extension> extension;
/** /**
* A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety. * May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.
*/ */
@Child(name = "text", type = {Narrative.class}, order=0, min=0, max=1) @Child(name = "modifierExtension", type = {Extension.class}, order=3, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Text summary of the resource, for human interpretation", formalDefinition="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." ) @Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." )
protected Narrative text; protected List<Extension> modifierExtension;
/** private static final long serialVersionUID = -970285559L;
* These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
*/ /*
@Child(name = "contained", type = {Resource.class}, order=1, min=0, max=Child.MAX_UNLIMITED) * Constructor
@Description(shortDefinition="Contained, inline Resources", formalDefinition="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." ) */
protected List<Resource> contained; public DomainResource() {
super();
/** }
* May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
*/ /**
@Child(name = "extension", type = {Extension.class}, order=2, min=0, max=Child.MAX_UNLIMITED) * @return {@link #text} (A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.)
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." ) */
protected List<Extension> extension; public Narrative getText() {
if (this.text == null)
/** if (Configuration.errorOnAutoCreate())
* May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. throw new Error("Attempt to auto-create DomainResource.text");
*/ else if (Configuration.doAutoCreate())
@Child(name = "modifierExtension", type = {Extension.class}, order=3, min=0, max=Child.MAX_UNLIMITED) this.text = new Narrative(); // cc
@Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions." ) return this.text;
protected List<Extension> modifierExtension; }
private static final long serialVersionUID = -970285559L; public boolean hasText() {
return this.text != null && !this.text.isEmpty();
/* }
* Constructor
*/ /**
public DomainResource() { * @param value {@link #text} (A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.)
super(); */
} public DomainResource setText(Narrative value) {
this.text = value;
/** return this;
* @return {@link #text} (A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.) }
*/
public Narrative getText() { /**
if (this.text == null) * @return {@link #contained} (These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create DomainResource.text"); public List<Resource> getContained() {
else if (Configuration.doAutoCreate()) if (this.contained == null)
this.text = new Narrative(); // cc this.contained = new ArrayList<Resource>();
return this.text; return this.contained;
} }
public boolean hasText() { public boolean hasContained() {
return this.text != null && !this.text.isEmpty(); if (this.contained == null)
} return false;
for (Resource item : this.contained)
/** if (!item.isEmpty())
* @param value {@link #text} (A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.) return true;
*/ return false;
public DomainResource setText(Narrative value) { }
this.text = value;
return this; /**
} * @return {@link #contained} (These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.)
*/
/** /**
* @return {@link #contained} (These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.) * @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
*/ */
public List<Resource> getContained() { public List<Extension> getExtension() {
if (this.contained == null) if (this.extension == null)
this.contained = new ArrayList<Resource>(); this.extension = new ArrayList<Extension>();
return this.contained; return this.extension;
} }
public boolean hasContained() { public boolean hasExtension() {
if (this.contained == null) if (this.extension == null)
return false; return false;
for (Resource item : this.contained) for (Extension item : this.extension)
if (!item.isEmpty()) if (!item.isEmpty())
return true; return true;
return false; return false;
} }
/** /**
* @return {@link #contained} (These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.) * @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
*/ */
/** // syntactic sugar
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.) public Extension addExtension() { //3
*/ Extension t = new Extension();
public List<Extension> getExtension() { if (this.extension == null)
if (this.extension == null) this.extension = new ArrayList<Extension>();
this.extension = new ArrayList<Extension>(); this.extension.add(t);
return this.extension; return t;
} }
public boolean hasExtension() { // syntactic sugar
if (this.extension == null) public DomainResource addExtension(Extension t) { //3
return false; if (t == null)
for (Extension item : this.extension) return this;
if (!item.isEmpty()) if (this.extension == null)
return true; this.extension = new ArrayList<Extension>();
return false; this.extension.add(t);
} return this;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.) /**
*/ * @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.)
// syntactic sugar */
public Extension addExtension() { //3 public List<Extension> getModifierExtension() {
Extension t = new Extension(); if (this.modifierExtension == null)
if (this.extension == null) this.modifierExtension = new ArrayList<Extension>();
this.extension = new ArrayList<Extension>(); return this.modifierExtension;
this.extension.add(t); }
return t;
} public boolean hasModifierExtension() {
if (this.modifierExtension == null)
// syntactic sugar return false;
public DomainResource addExtension(Extension t) { //3 for (Extension item : this.modifierExtension)
if (t == null) if (!item.isEmpty())
return this; return true;
if (this.extension == null) return false;
this.extension = new ArrayList<Extension>(); }
this.extension.add(t);
return this; /**
} * @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.)
*/
/** // syntactic sugar
* @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.) public Extension addModifierExtension() { //3
*/ Extension t = new Extension();
public List<Extension> getModifierExtension() { if (this.modifierExtension == null)
if (this.modifierExtension == null) this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension = new ArrayList<Extension>(); this.modifierExtension.add(t);
return this.modifierExtension; return t;
} }
public boolean hasModifierExtension() { // syntactic sugar
if (this.modifierExtension == null) public DomainResource addModifierExtension(Extension t) { //3
return false; if (t == null)
for (Extension item : this.modifierExtension) return this;
if (!item.isEmpty()) if (this.modifierExtension == null)
return true; this.modifierExtension = new ArrayList<Extension>();
return false; this.modifierExtension.add(t);
} return this;
}
/**
* @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.) protected void listChildren(List<Property> childrenList) {
*/ childrenList.add(new Property("text", "Narrative", "A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", 0, java.lang.Integer.MAX_VALUE, text));
// syntactic sugar childrenList.add(new Property("contained", "Resource", "These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.", 0, java.lang.Integer.MAX_VALUE, contained));
public Extension addModifierExtension() { //3 childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
Extension t = new Extension(); childrenList.add(new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", 0, java.lang.Integer.MAX_VALUE, modifierExtension));
if (this.modifierExtension == null) }
this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension.add(t); public abstract DomainResource copy();
return t;
} public void copyValues(DomainResource dst) {
dst.text = text == null ? null : text.copy();
// syntactic sugar if (contained != null) {
public DomainResource addModifierExtension(Extension t) { //3 dst.contained = new ArrayList<Resource>();
if (t == null) for (Resource i : contained)
return this; dst.contained.add(i.copy());
if (this.modifierExtension == null) };
this.modifierExtension = new ArrayList<Extension>(); if (extension != null) {
this.modifierExtension.add(t); dst.extension = new ArrayList<Extension>();
return this; for (Extension i : extension)
} dst.extension.add(i.copy());
};
protected void listChildren(List<Property> childrenList) { if (modifierExtension != null) {
childrenList.add(new Property("text", "Narrative", "A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.", 0, java.lang.Integer.MAX_VALUE, text)); dst.modifierExtension = new ArrayList<Extension>();
childrenList.add(new Property("contained", "Resource", "These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.", 0, java.lang.Integer.MAX_VALUE, contained)); for (Extension i : modifierExtension)
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension)); dst.modifierExtension.add(i.copy());
childrenList.add(new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.", 0, java.lang.Integer.MAX_VALUE, modifierExtension)); };
} }
public abstract DomainResource copy(); @Override
public boolean equalsDeep(Base other) {
public void copyValues(DomainResource dst) { if (!super.equalsDeep(other))
dst.text = text == null ? null : text.copy(); return false;
if (contained != null) { if (!(other instanceof DomainResource))
dst.contained = new ArrayList<Resource>(); return false;
for (Resource i : contained) DomainResource o = (DomainResource) other;
dst.contained.add(i.copy()); return compareDeep(text, o.text, true) && compareDeep(contained, o.contained, true) && compareDeep(extension, o.extension, true)
}; && compareDeep(modifierExtension, o.modifierExtension, true);
if (extension != null) { }
dst.extension = new ArrayList<Extension>();
for (Extension i : extension) @Override
dst.extension.add(i.copy()); public boolean equalsShallow(Base other) {
}; if (!super.equalsShallow(other))
if (modifierExtension != null) { return false;
dst.modifierExtension = new ArrayList<Extension>(); if (!(other instanceof DomainResource))
for (Extension i : modifierExtension) return false;
dst.modifierExtension.add(i.copy()); DomainResource o = (DomainResource) other;
}; return true;
} }
@Override public boolean isEmpty() {
public boolean equalsDeep(Base other) { return super.isEmpty() && (text == null || text.isEmpty()) && (contained == null || contained.isEmpty())
if (!super.equalsDeep(other)) && (extension == null || extension.isEmpty()) && (modifierExtension == null || modifierExtension.isEmpty())
return false; ;
if (!(other instanceof DomainResource)) }
return false;
DomainResource o = (DomainResource) other;
return compareDeep(text, o.text, true) && compareDeep(contained, o.contained, true) && compareDeep(extension, o.extension, true) }
&& compareDeep(modifierExtension, o.modifierExtension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof DomainResource))
return false;
DomainResource o = (DomainResource) other;
return true;
}
public boolean isEmpty() {
return super.isEmpty() && (text == null || text.isEmpty()) && (contained == null || contained.isEmpty())
&& (extension == null || extension.isEmpty()) && (modifierExtension == null || modifierExtension.isEmpty())
;
}
}

View File

@ -1,111 +1,90 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import org.hl7.fhir.instance.model.annotations.DatatypeDef;
and/or other materials provided with the distribution. import org.hl7.fhir.instance.model.annotations.Block;
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.api.*;
endorse or promote products derived from this software without specific /**
prior written permission. * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND @DatatypeDef(name="Duration")
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED public class Duration extends Quantity {
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, private static final long serialVersionUID = -483422721L;
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public Duration copy() {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, Duration dst = new Duration();
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) copyValues(dst);
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dst.value = value == null ? null : value.copy();
POSSIBILITY OF SUCH DAMAGE. dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy();
*/ dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 return dst;
}
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block; protected Duration typedCopy() {
import org.hl7.fhir.instance.model.api.*; return copy();
/** }
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/ @Override
@DatatypeDef(name="Duration") public boolean equalsDeep(Base other) {
public class Duration extends Quantity { if (!super.equalsDeep(other))
return false;
private static final long serialVersionUID = -483422721L; if (!(other instanceof Duration))
return false;
public Duration copy() { Duration o = (Duration) other;
Duration dst = new Duration(); return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
copyValues(dst); && compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
dst.value = value == null ? null : value.copy(); }
dst.comparator = comparator == null ? null : comparator.copy();
dst.units = units == null ? null : units.copy(); @Override
dst.system = system == null ? null : system.copy(); public boolean equalsShallow(Base other) {
dst.code = code == null ? null : code.copy(); if (!super.equalsShallow(other))
return dst; return false;
} if (!(other instanceof Duration))
return false;
protected Duration typedCopy() { Duration o = (Duration) other;
return copy(); return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
} && compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
return false; && (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
if (!(other instanceof Duration)) ;
return false; }
Duration o = (Duration) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true); }
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Duration))
return false;
Duration o = (Duration) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -1,223 +1,202 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.Child;
prior written permission. import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * Base definition for all elements in a resource.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public abstract class Element extends Base implements IBaseHasExtensions {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) /**
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * unique id for the element within a resource (for internal references).
POSSIBILITY OF SUCH DAMAGE. */
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1)
*/ @Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
protected IdType id;
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
/**
import java.util.*; * May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
*/
import org.hl7.fhir.utilities.Utilities; @Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
import org.hl7.fhir.instance.model.annotations.Child; @Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
import org.hl7.fhir.instance.model.annotations.Description; protected List<Extension> extension;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block; private static final long serialVersionUID = -158027598L;
import org.hl7.fhir.instance.model.api.*;
/** /*
* Base definition for all elements in a resource. * Constructor
*/ */
public abstract class Element extends Base implements IBaseHasExtensions { public Element() {
super();
/** }
* unique id for the element within a resource (for internal references).
*/ /**
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1) * @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." ) */
protected IdType id; public IdType getIdElement() {
if (this.id == null)
/** if (Configuration.errorOnAutoCreate())
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. throw new Error("Attempt to auto-create Element.id");
*/ else if (Configuration.doAutoCreate())
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED) this.id = new IdType(); // bb
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." ) return this.id;
protected List<Extension> extension; }
private static final long serialVersionUID = -158027598L; public boolean hasIdElement() {
return this.id != null && !this.id.isEmpty();
/* }
* Constructor
*/ public boolean hasId() {
public Element() { return this.id != null && !this.id.isEmpty();
super(); }
}
/**
/** * @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value */
*/ public Element setIdElement(IdType value) {
public IdType getIdElement() { this.id = value;
if (this.id == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Element.id");
else if (Configuration.doAutoCreate()) /**
this.id = new IdType(); // bb * @return unique id for the element within a resource (for internal references).
return this.id; */
} public String getId() {
return this.id == null ? null : this.id.getValue();
public boolean hasIdElement() { }
return this.id != null && !this.id.isEmpty();
} /**
* @param value unique id for the element within a resource (for internal references).
public boolean hasId() { */
return this.id != null && !this.id.isEmpty(); public Element setId(String value) {
} if (Utilities.noString(value))
this.id = null;
/** else {
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value if (this.id == null)
*/ this.id = new IdType();
public Element setIdElement(IdType value) { this.id.setValue(value);
this.id = value; }
return this; return this;
} }
/** /**
* @return unique id for the element within a resource (for internal references). * @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
*/ */
public String getId() { public List<Extension> getExtension() {
return this.id == null ? null : this.id.getValue(); if (this.extension == null)
} this.extension = new ArrayList<Extension>();
return this.extension;
/** }
* @param value unique id for the element within a resource (for internal references).
*/ public boolean hasExtension() {
public Element setId(String value) { if (this.extension == null)
if (Utilities.noString(value)) return false;
this.id = null; for (Extension item : this.extension)
else { if (!item.isEmpty())
if (this.id == null) return true;
this.id = new IdType(); return false;
this.id.setValue(value); }
}
return this; /**
} * @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
*/
/** // syntactic sugar
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.) public Extension addExtension() { //3
*/ Extension t = new Extension();
public List<Extension> getExtension() { if (this.extension == null)
if (this.extension == null) this.extension = new ArrayList<Extension>();
this.extension = new ArrayList<Extension>(); this.extension.add(t);
return this.extension; return t;
} }
public boolean hasExtension() { // syntactic sugar
if (this.extension == null) public Element addExtension(Extension t) { //3
return false; if (t == null)
for (Extension item : this.extension) return this;
if (!item.isEmpty()) if (this.extension == null)
return true; this.extension = new ArrayList<Extension>();
return false; this.extension.add(t);
} return this;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.) protected void listChildren(List<Property> childrenList) {
*/ childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
// syntactic sugar childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
public Extension addExtension() { //3 }
Extension t = new Extension();
if (this.extension == null) public abstract Element copy();
this.extension = new ArrayList<Extension>();
this.extension.add(t); public void copyValues(Element dst) {
return t; dst.id = id == null ? null : id.copy();
} if (extension != null) {
dst.extension = new ArrayList<Extension>();
// syntactic sugar for (Extension i : extension)
public Element addExtension(Extension t) { //3 dst.extension.add(i.copy());
if (t == null) };
return this; }
if (this.extension == null)
this.extension = new ArrayList<Extension>(); @Override
this.extension.add(t); public boolean equalsDeep(Base other) {
return this; if (!super.equalsDeep(other))
} return false;
if (!(other instanceof Element))
protected void listChildren(List<Property> childrenList) { return false;
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id)); Element o = (Element) other;
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension)); return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
} }
public abstract Element copy(); @Override
public boolean equalsShallow(Base other) {
public void copyValues(Element dst) { if (!super.equalsShallow(other))
dst.id = id == null ? null : id.copy(); return false;
if (extension != null) { if (!(other instanceof Element))
dst.extension = new ArrayList<Extension>(); return false;
for (Extension i : extension) Element o = (Element) other;
dst.extension.add(i.copy()); return compareValues(id, o.id, true);
}; }
}
public boolean isEmpty() {
@Override return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
public boolean equalsDeep(Base other) { ;
if (!super.equalsDeep(other)) }
return false;
if (!(other instanceof Element))
return false; }
Element o = (Element) other;
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Element))
return false;
Element o = (Element) other;
return compareValues(id, o.id, true);
}
public boolean isEmpty() {
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
;
}
}

View File

@ -1,481 +1,460 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.instance.model.annotations.ResourceDef;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
prior written permission. import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest")
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, public class EligibilityRequest extends DomainResource {
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE /**
POSSIBILITY OF SUCH DAMAGE. * The Response Business Identifier.
*/
*/ @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response Business Identifier." )
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 protected List<Identifier> identifier;
import java.util.*; /**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
import org.hl7.fhir.instance.model.annotations.ResourceDef; */
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; @Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1)
import org.hl7.fhir.instance.model.annotations.Child; @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
import org.hl7.fhir.instance.model.annotations.Description; protected Coding ruleset;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; /**
/** * The style (standard) and version of the original material which was converted into this resource.
* This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service. */
*/ @Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1)
@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest") @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
public class EligibilityRequest extends DomainResource { protected Coding originalRuleset;
/** /**
* The Response Business Identifier. * The date when this resource was created.
*/ */
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED) @Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response Business Identifier." ) @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
protected List<Identifier> identifier; protected DateTimeType created;
/** /**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources. * The Insurer who is target of the request.
*/ */
@Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1) @Child(name = "target", type = {Organization.class}, order=4, min=0, max=1)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." ) @Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." )
protected Coding ruleset; protected Reference target;
/** /**
* The style (standard) and version of the original material which was converted into this resource. * The actual object that is the target of the reference (The Insurer who is target of the request.)
*/ */
@Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1) protected Organization targetTarget;
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset; /**
* The practitioner who is responsible for the services rendered to the patient.
/** */
* The date when this resource was created. @Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1)
*/ @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
@Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1) protected Reference provider;
@Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
protected DateTimeType created; /**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
/** */
* The Insurer who is target of the request. protected Practitioner providerTarget;
*/
@Child(name = "target", type = {Organization.class}, order=4, min=0, max=1) /**
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." ) * The organization which is responsible for the services rendered to the patient.
protected Reference target; */
@Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1)
/** @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
* The actual object that is the target of the reference (The Insurer who is target of the request.) protected Reference organization;
*/
protected Organization targetTarget; /**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
/** */
* The practitioner who is responsible for the services rendered to the patient. protected Organization organizationTarget;
*/
@Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1) private static final long serialVersionUID = 1836339504L;
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference provider; /*
* Constructor
/** */
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.) public EligibilityRequest() {
*/ super();
protected Practitioner providerTarget; }
/** /**
* The organization which is responsible for the services rendered to the patient. * @return {@link #identifier} (The Response Business Identifier.)
*/ */
@Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1) public List<Identifier> getIdentifier() {
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." ) if (this.identifier == null)
protected Reference organization; this.identifier = new ArrayList<Identifier>();
return this.identifier;
/** }
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/ public boolean hasIdentifier() {
protected Organization organizationTarget; if (this.identifier == null)
return false;
private static final long serialVersionUID = 1836339504L; for (Identifier item : this.identifier)
if (!item.isEmpty())
/* return true;
* Constructor return false;
*/ }
public EligibilityRequest() {
super(); /**
} * @return {@link #identifier} (The Response Business Identifier.)
*/
/** // syntactic sugar
* @return {@link #identifier} (The Response Business Identifier.) public Identifier addIdentifier() { //3
*/ Identifier t = new Identifier();
public List<Identifier> getIdentifier() { if (this.identifier == null)
if (this.identifier == null) this.identifier = new ArrayList<Identifier>();
this.identifier = new ArrayList<Identifier>(); this.identifier.add(t);
return this.identifier; return t;
} }
public boolean hasIdentifier() { // syntactic sugar
if (this.identifier == null) public EligibilityRequest addIdentifier(Identifier t) { //3
return false; if (t == null)
for (Identifier item : this.identifier) return this;
if (!item.isEmpty()) if (this.identifier == null)
return true; this.identifier = new ArrayList<Identifier>();
return false; this.identifier.add(t);
} return this;
}
/**
* @return {@link #identifier} (The Response Business Identifier.) /**
*/ * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
// syntactic sugar */
public Identifier addIdentifier() { //3 public Coding getRuleset() {
Identifier t = new Identifier(); if (this.ruleset == null)
if (this.identifier == null) if (Configuration.errorOnAutoCreate())
this.identifier = new ArrayList<Identifier>(); throw new Error("Attempt to auto-create EligibilityRequest.ruleset");
this.identifier.add(t); else if (Configuration.doAutoCreate())
return t; this.ruleset = new Coding(); // cc
} return this.ruleset;
}
// syntactic sugar
public EligibilityRequest addIdentifier(Identifier t) { //3 public boolean hasRuleset() {
if (t == null) return this.ruleset != null && !this.ruleset.isEmpty();
return this; }
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>(); /**
this.identifier.add(t); * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
return this; */
} public EligibilityRequest setRuleset(Coding value) {
this.ruleset = value;
/** return this;
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.) }
*/
public Coding getRuleset() { /**
if (this.ruleset == null) * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create EligibilityRequest.ruleset"); public Coding getOriginalRuleset() {
else if (Configuration.doAutoCreate()) if (this.originalRuleset == null)
this.ruleset = new Coding(); // cc if (Configuration.errorOnAutoCreate())
return this.ruleset; throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset");
} else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
public boolean hasRuleset() { return this.originalRuleset;
return this.ruleset != null && !this.ruleset.isEmpty(); }
}
public boolean hasOriginalRuleset() {
/** return this.originalRuleset != null && !this.originalRuleset.isEmpty();
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.) }
*/
public EligibilityRequest setRuleset(Coding value) { /**
this.ruleset = value; * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
return this; */
} public EligibilityRequest setOriginalRuleset(Coding value) {
this.originalRuleset = value;
/** return this;
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.) }
*/
public Coding getOriginalRuleset() { /**
if (this.originalRuleset == null) * @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset"); public DateTimeType getCreatedElement() {
else if (Configuration.doAutoCreate()) if (this.created == null)
this.originalRuleset = new Coding(); // cc if (Configuration.errorOnAutoCreate())
return this.originalRuleset; throw new Error("Attempt to auto-create EligibilityRequest.created");
} else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
public boolean hasOriginalRuleset() { return this.created;
return this.originalRuleset != null && !this.originalRuleset.isEmpty(); }
}
public boolean hasCreatedElement() {
/** return this.created != null && !this.created.isEmpty();
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.) }
*/
public EligibilityRequest setOriginalRuleset(Coding value) { public boolean hasCreated() {
this.originalRuleset = value; return this.created != null && !this.created.isEmpty();
return this; }
}
/**
/** * @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
* @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value */
*/ public EligibilityRequest setCreatedElement(DateTimeType value) {
public DateTimeType getCreatedElement() { this.created = value;
if (this.created == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create EligibilityRequest.created");
else if (Configuration.doAutoCreate()) /**
this.created = new DateTimeType(); // bb * @return The date when this resource was created.
return this.created; */
} public Date getCreated() {
return this.created == null ? null : this.created.getValue();
public boolean hasCreatedElement() { }
return this.created != null && !this.created.isEmpty();
} /**
* @param value The date when this resource was created.
public boolean hasCreated() { */
return this.created != null && !this.created.isEmpty(); public EligibilityRequest setCreated(Date value) {
} if (value == null)
this.created = null;
/** else {
* @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value if (this.created == null)
*/ this.created = new DateTimeType();
public EligibilityRequest setCreatedElement(DateTimeType value) { this.created.setValue(value);
this.created = value; }
return this; return this;
} }
/** /**
* @return The date when this resource was created. * @return {@link #target} (The Insurer who is target of the request.)
*/ */
public Date getCreated() { public Reference getTarget() {
return this.created == null ? null : this.created.getValue(); if (this.target == null)
} if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.target");
/** else if (Configuration.doAutoCreate())
* @param value The date when this resource was created. this.target = new Reference(); // cc
*/ return this.target;
public EligibilityRequest setCreated(Date value) { }
if (value == null)
this.created = null; public boolean hasTarget() {
else { return this.target != null && !this.target.isEmpty();
if (this.created == null) }
this.created = new DateTimeType();
this.created.setValue(value); /**
} * @param value {@link #target} (The Insurer who is target of the request.)
return this; */
} public EligibilityRequest setTarget(Reference value) {
this.target = value;
/** return this;
* @return {@link #target} (The Insurer who is target of the request.) }
*/
public Reference getTarget() { /**
if (this.target == null) * @return {@link #target} 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. (The Insurer who is target of the request.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create EligibilityRequest.target"); public Organization getTargetTarget() {
else if (Configuration.doAutoCreate()) if (this.targetTarget == null)
this.target = new Reference(); // cc if (Configuration.errorOnAutoCreate())
return this.target; throw new Error("Attempt to auto-create EligibilityRequest.target");
} else if (Configuration.doAutoCreate())
this.targetTarget = new Organization(); // aa
public boolean hasTarget() { return this.targetTarget;
return this.target != null && !this.target.isEmpty(); }
}
/**
/** * @param value {@link #target} 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. (The Insurer who is target of the request.)
* @param value {@link #target} (The Insurer who is target of the request.) */
*/ public EligibilityRequest setTargetTarget(Organization value) {
public EligibilityRequest setTarget(Reference value) { this.targetTarget = value;
this.target = value; return this;
return this; }
}
/**
/** * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
* @return {@link #target} 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. (The Insurer who is target of the request.) */
*/ public Reference getProvider() {
public Organization getTargetTarget() { if (this.provider == null)
if (this.targetTarget == null) if (Configuration.errorOnAutoCreate())
if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create EligibilityRequest.provider");
throw new Error("Attempt to auto-create EligibilityRequest.target"); else if (Configuration.doAutoCreate())
else if (Configuration.doAutoCreate()) this.provider = new Reference(); // cc
this.targetTarget = new Organization(); // aa return this.provider;
return this.targetTarget; }
}
public boolean hasProvider() {
/** return this.provider != null && !this.provider.isEmpty();
* @param value {@link #target} 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. (The Insurer who is target of the request.) }
*/
public EligibilityRequest setTargetTarget(Organization value) { /**
this.targetTarget = value; * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
return this; */
} public EligibilityRequest setProvider(Reference value) {
this.provider = value;
/** return this;
* @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.) }
*/
public Reference getProvider() { /**
if (this.provider == null) * @return {@link #provider} 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. (The practitioner who is responsible for the services rendered to the patient.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create EligibilityRequest.provider"); public Practitioner getProviderTarget() {
else if (Configuration.doAutoCreate()) if (this.providerTarget == null)
this.provider = new Reference(); // cc if (Configuration.errorOnAutoCreate())
return this.provider; throw new Error("Attempt to auto-create EligibilityRequest.provider");
} else if (Configuration.doAutoCreate())
this.providerTarget = new Practitioner(); // aa
public boolean hasProvider() { return this.providerTarget;
return this.provider != null && !this.provider.isEmpty(); }
}
/**
/** * @param value {@link #provider} 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. (The practitioner who is responsible for the services rendered to the patient.)
* @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.) */
*/ public EligibilityRequest setProviderTarget(Practitioner value) {
public EligibilityRequest setProvider(Reference value) { this.providerTarget = value;
this.provider = value; return this;
return this; }
}
/**
/** * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
* @return {@link #provider} 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. (The practitioner who is responsible for the services rendered to the patient.) */
*/ public Reference getOrganization() {
public Practitioner getProviderTarget() { if (this.organization == null)
if (this.providerTarget == null) if (Configuration.errorOnAutoCreate())
if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create EligibilityRequest.organization");
throw new Error("Attempt to auto-create EligibilityRequest.provider"); else if (Configuration.doAutoCreate())
else if (Configuration.doAutoCreate()) this.organization = new Reference(); // cc
this.providerTarget = new Practitioner(); // aa return this.organization;
return this.providerTarget; }
}
public boolean hasOrganization() {
/** return this.organization != null && !this.organization.isEmpty();
* @param value {@link #provider} 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. (The practitioner who is responsible for the services rendered to the patient.) }
*/
public EligibilityRequest setProviderTarget(Practitioner value) { /**
this.providerTarget = value; * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
return this; */
} public EligibilityRequest setOrganization(Reference value) {
this.organization = value;
/** return this;
* @return {@link #organization} (The organization which is responsible for the services rendered to the patient.) }
*/
public Reference getOrganization() { /**
if (this.organization == null) * @return {@link #organization} 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. (The organization which is responsible for the services rendered to the patient.)
if (Configuration.errorOnAutoCreate()) */
throw new Error("Attempt to auto-create EligibilityRequest.organization"); public Organization getOrganizationTarget() {
else if (Configuration.doAutoCreate()) if (this.organizationTarget == null)
this.organization = new Reference(); // cc if (Configuration.errorOnAutoCreate())
return this.organization; throw new Error("Attempt to auto-create EligibilityRequest.organization");
} else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
public boolean hasOrganization() { return this.organizationTarget;
return this.organization != null && !this.organization.isEmpty(); }
}
/**
/** * @param value {@link #organization} 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. (The organization which is responsible for the services rendered to the patient.)
* @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.) */
*/ public EligibilityRequest setOrganizationTarget(Organization value) {
public EligibilityRequest setOrganization(Reference value) { this.organizationTarget = value;
this.organization = value; return this;
return this; }
}
protected void listChildren(List<Property> childrenList) {
/** super.listChildren(childrenList);
* @return {@link #organization} 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. (The organization which is responsible for the services rendered to the patient.) childrenList.add(new Property("identifier", "Identifier", "The Response Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
*/ childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
public Organization getOrganizationTarget() { childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
if (this.organizationTarget == null) childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
if (Configuration.errorOnAutoCreate()) childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target of the request.", 0, java.lang.Integer.MAX_VALUE, target));
throw new Error("Attempt to auto-create EligibilityRequest.organization"); childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
else if (Configuration.doAutoCreate()) childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
this.organizationTarget = new Organization(); // aa }
return this.organizationTarget;
} public EligibilityRequest copy() {
EligibilityRequest dst = new EligibilityRequest();
/** copyValues(dst);
* @param value {@link #organization} 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. (The organization which is responsible for the services rendered to the patient.) if (identifier != null) {
*/ dst.identifier = new ArrayList<Identifier>();
public EligibilityRequest setOrganizationTarget(Organization value) { for (Identifier i : identifier)
this.organizationTarget = value; dst.identifier.add(i.copy());
return this; };
} dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
protected void listChildren(List<Property> childrenList) { dst.created = created == null ? null : created.copy();
super.listChildren(childrenList); dst.target = target == null ? null : target.copy();
childrenList.add(new Property("identifier", "Identifier", "The Response Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier)); dst.provider = provider == null ? null : provider.copy();
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset)); dst.organization = organization == null ? null : organization.copy();
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset)); return dst;
childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created)); }
childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target of the request.", 0, java.lang.Integer.MAX_VALUE, target));
childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider)); protected EligibilityRequest typedCopy() {
childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization)); return copy();
} }
public EligibilityRequest copy() { @Override
EligibilityRequest dst = new EligibilityRequest(); public boolean equalsDeep(Base other) {
copyValues(dst); if (!super.equalsDeep(other))
if (identifier != null) { return false;
dst.identifier = new ArrayList<Identifier>(); if (!(other instanceof EligibilityRequest))
for (Identifier i : identifier) return false;
dst.identifier.add(i.copy()); EligibilityRequest o = (EligibilityRequest) other;
}; return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
dst.ruleset = ruleset == null ? null : ruleset.copy(); && compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true)
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy(); && compareDeep(organization, o.organization, true);
dst.created = created == null ? null : created.copy(); }
dst.target = target == null ? null : target.copy();
dst.provider = provider == null ? null : provider.copy(); @Override
dst.organization = organization == null ? null : organization.copy(); public boolean equalsShallow(Base other) {
return dst; if (!super.equalsShallow(other))
} return false;
if (!(other instanceof EligibilityRequest))
protected EligibilityRequest typedCopy() { return false;
return copy(); EligibilityRequest o = (EligibilityRequest) other;
} return compareValues(created, o.created, true);
}
@Override
public boolean equalsDeep(Base other) { public boolean isEmpty() {
if (!super.equalsDeep(other)) return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty())
return false; && (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty())
if (!(other instanceof EligibilityRequest)) && (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty())
return false; ;
EligibilityRequest o = (EligibilityRequest) other; }
return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true) @Override
&& compareDeep(organization, o.organization, true); public ResourceType getResourceType() {
} return ResourceType.EligibilityRequest;
}
@Override
public boolean equalsShallow(Base other) { @SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
if (!super.equalsShallow(other)) public static final String SP_IDENTIFIER = "identifier";
return false;
if (!(other instanceof EligibilityRequest)) }
return false;
EligibilityRequest o = (EligibilityRequest) other;
return compareValues(created, o.created, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty())
&& (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty())
&& (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.EligibilityRequest;
}
@SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
public static final String SP_IDENTIFIER = "identifier";
}

View File

@ -1,77 +1,56 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
* #%L
* HAPI FHIR Structures - HL7.org DSTU2
* %% /*
* Copyright (C) 2014 - 2015 University Health Network Copyright (c) 2011+, HL7, Inc
* %% All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. Redistribution and use in source and binary forms, with or without modification,
* You may obtain a copy of the License at are permitted provided that the following conditions are met:
*
* http://www.apache.org/licenses/LICENSE-2.0 * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Unless required by applicable law or agreed to in writing, software * Redistributions in binary form must reproduce the above copyright notice,
* distributed under the License is distributed on an "AS IS" BASIS, this list of conditions and the following disclaimer in the documentation
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. and/or other materials provided with the distribution.
* See the License for the specific language governing permissions and * Neither the name of HL7 nor the names of its contributors may be used to
* limitations under the License. endorse or promote products derived from this software without specific
* #L% prior written permission.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
import org.hl7.fhir.instance.model.api.IBaseEnumFactory; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. /**
* Redistributions in binary form must reproduce the above copyright notice, * Helper class to help manage generic enumerated types
this list of conditions and the following disclaimer in the documentation */
and/or other materials provided with the distribution. public interface EnumFactory<T extends Enum<?>> extends IBaseEnumFactory<T> {
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific /**
prior written permission. * Read an enumeration value from the string that represents it on the XML or JSON
* @param codeString the value found in the XML or JSON
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * @return the enumeration value
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * @throws Exception is the value is not known
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. */
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, public T fromCode(String codeString) throws IllegalArgumentException;
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR /**
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * Get the XML/JSON representation for an enumerated value
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * @param code - the enumeration value
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * @return the XML/JSON representation
POSSIBILITY OF SUCH DAMAGE. * @throws Exception if the enumeration is not valid (would usually indicate a code generation bug)
*/
*/ public String toCode(T code);
/** }
* Helper class to help manage generic enumerated types
*/
public interface EnumFactory<T extends Enum<?>> extends IBaseEnumFactory<T> {
/**
* Read an enumeration value from the string that represents it on the XML or JSON
* @param codeString the value found in the XML or JSON
* @return the enumeration value
* @throws Exception is the value is not known
*/
public T fromCode(String codeString) throws IllegalArgumentException;
/**
* Get the XML/JSON representation for an enumerated value
* @param code - the enumeration value
* @return the XML/JSON representation
* @throws Exception if the enumeration is not valid (would usually indicate a code generation bug)
*/
public String toCode(T code);
}

View File

@ -1,114 +1,93 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import org.hl7.fhir.instance.model.annotations.DatatypeDef;
* #%L import org.hl7.fhir.instance.model.api.IBaseEnumeration;
* HAPI FHIR Structures - HL7.org DSTU2
* %% /*
* Copyright (C) 2014 - 2015 University Health Network Copyright (c) 2011+, HL7, Inc
* %% All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. Redistribution and use in source and binary forms, with or without modification,
* You may obtain a copy of the License at are permitted provided that the following conditions are met:
*
* http://www.apache.org/licenses/LICENSE-2.0 * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Unless required by applicable law or agreed to in writing, software * Redistributions in binary form must reproduce the above copyright notice,
* distributed under the License is distributed on an "AS IS" BASIS, this list of conditions and the following disclaimer in the documentation
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. and/or other materials provided with the distribution.
* See the License for the specific language governing permissions and * Neither the name of HL7 nor the names of its contributors may be used to
* limitations under the License. endorse or promote products derived from this software without specific
* #L% prior written permission.
*/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
import org.hl7.fhir.instance.model.annotations.DatatypeDef; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
import org.hl7.fhir.instance.model.api.IBaseEnumeration; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. /**
* Redistributions in binary form must reproduce the above copyright notice, * Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values
this list of conditions and the following disclaimer in the documentation *
and/or other materials provided with the distribution. */
* Neither the name of HL7 nor the names of its contributors may be used to @DatatypeDef(name="code", isSpecialization=true)
endorse or promote products derived from this software without specific public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> {
prior written permission.
private static final long serialVersionUID = 1L;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND private EnumFactory<T> myEnumFactory;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * Constructor
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR public Enumeration(EnumFactory<T> theEnumFactory) {
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, if (theEnumFactory == null)
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) throw new IllegalArgumentException("An enumeration factory must be provided");
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE myEnumFactory = theEnumFactory;
POSSIBILITY OF SUCH DAMAGE. }
*/ /**
* Constructor
/** */
* Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values public Enumeration(EnumFactory<T> theEnumFactory, T theValue) {
* if (theEnumFactory == null)
*/ throw new IllegalArgumentException("An enumeration factory must be provided");
@DatatypeDef(name="code", isSpecialization=true) myEnumFactory = theEnumFactory;
public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> { setValue(theValue);
}
private static final long serialVersionUID = 1L;
private EnumFactory<T> myEnumFactory; /**
* Constructor
/** */
* Constructor public Enumeration(EnumFactory<T> theEnumFactory, String theValue) {
*/ if (theEnumFactory == null)
public Enumeration(EnumFactory<T> theEnumFactory) { throw new IllegalArgumentException("An enumeration factory must be provided");
if (theEnumFactory == null) myEnumFactory = theEnumFactory;
throw new IllegalArgumentException("An enumeration factory must be provided"); setValueAsString(theValue);
myEnumFactory = theEnumFactory; }
}
@Override
/** protected T parse(String theValue) {
* Constructor if (myEnumFactory != null) {
*/ return myEnumFactory.fromCode(theValue);
public Enumeration(EnumFactory<T> theEnumFactory, T theValue) { }
if (theEnumFactory == null) return null;
throw new IllegalArgumentException("An enumeration factory must be provided"); }
myEnumFactory = theEnumFactory;
setValue(theValue); @Override
} protected String encode(T theValue) {
return myEnumFactory.toCode(theValue);
/** }
* Constructor
*/ @Override
public Enumeration(EnumFactory<T> theEnumFactory, String theValue) { public Enumeration<T> copy() {
if (theEnumFactory == null) return new Enumeration<T>(myEnumFactory, getValue());
throw new IllegalArgumentException("An enumeration factory must be provided"); }
myEnumFactory = theEnumFactory;
setValueAsString(theValue);
} }
@Override
protected T parse(String theValue) {
if (myEnumFactory != null) {
return myEnumFactory.fromCode(theValue);
}
return null;
}
@Override
protected String encode(T theValue) {
return myEnumFactory.toCode(theValue);
}
@Override
public Enumeration<T> copy() {
return new Enumeration<T>(myEnumFactory, getValue());
}
}

View File

@ -1,112 +1,91 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* public class Enumerations {
* #%L
* HAPI FHIR Structures - HL7.org DSTU2 public enum ConformanceResourceStatus {
* %% /**
* Copyright (C) 2014 - 2015 University Health Network * This resource is still under development
* %% */
* Licensed under the Apache License, Version 2.0 (the "License"); DRAFT,
* you may not use this file except in compliance with the License. /**
* You may obtain a copy of the License at * This resource is ready for normal use
* */
* http://www.apache.org/licenses/LICENSE-2.0 ACTIVE,
* /**
* Unless required by applicable law or agreed to in writing, software * This resource has been withdrawn or superceded and should no longer be used
* distributed under the License is distributed on an "AS IS" BASIS, */
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. RETIRED,
* See the License for the specific language governing permissions and /**
* limitations under the License. * added to help the parsers
* #L% */
*/ NULL;
public static ConformanceResourceStatus fromCode(String codeString) throws Exception {
if (codeString == null || "".equals(codeString))
public class Enumerations { return null;
if ("draft".equals(codeString))
public enum ConformanceResourceStatus { return DRAFT;
/** if ("active".equals(codeString))
* This resource is still under development return ACTIVE;
*/ if ("retired".equals(codeString))
DRAFT, return RETIRED;
/** throw new Exception("Unknown ConformanceResourceStatus code '"+codeString+"'");
* This resource is ready for normal use }
*/ public String toCode() {
ACTIVE, switch (this) {
/** case DRAFT: return "draft";
* This resource has been withdrawn or superceded and should no longer be used case ACTIVE: return "active";
*/ case RETIRED: return "retired";
RETIRED, default: return "?";
/** }
* added to help the parsers }
*/ public String getSystem() {
NULL; switch (this) {
public static ConformanceResourceStatus fromCode(String codeString) throws Exception { case DRAFT: return "";
if (codeString == null || "".equals(codeString)) case ACTIVE: return "";
return null; case RETIRED: return "";
if ("draft".equals(codeString)) default: return "?";
return DRAFT; }
if ("active".equals(codeString)) }
return ACTIVE; public String getDefinition() {
if ("retired".equals(codeString)) switch (this) {
return RETIRED; case DRAFT: return "This resource is still under development";
throw new Exception("Unknown ConformanceResourceStatus code '"+codeString+"'"); case ACTIVE: return "This resource is ready for normal use";
} case RETIRED: return "This resource has been withdrawn or superceded and should no longer be used";
public String toCode() { default: return "?";
switch (this) { }
case DRAFT: return "draft"; }
case ACTIVE: return "active"; public String getDisplay() {
case RETIRED: return "retired"; switch (this) {
default: return "?"; case DRAFT: return "Draft";
} case ACTIVE: return "Active";
} case RETIRED: return "Retired";
public String getSystem() { default: return "?";
switch (this) { }
case DRAFT: return ""; }
case ACTIVE: return ""; }
case RETIRED: return "";
default: return "?"; public static class ConformanceResourceStatusEnumFactory implements EnumFactory<ConformanceResourceStatus> {
} public ConformanceResourceStatus fromCode(String codeString) throws IllegalArgumentException {
} if (codeString == null || "".equals(codeString))
public String getDefinition() { if (codeString == null || "".equals(codeString))
switch (this) { return null;
case DRAFT: return "This resource is still under development"; if ("draft".equals(codeString))
case ACTIVE: return "This resource is ready for normal use"; return ConformanceResourceStatus.DRAFT;
case RETIRED: return "This resource has been withdrawn or superceded and should no longer be used"; if ("active".equals(codeString))
default: return "?"; return ConformanceResourceStatus.ACTIVE;
} if ("retired".equals(codeString))
} return ConformanceResourceStatus.RETIRED;
public String getDisplay() { throw new IllegalArgumentException("Unknown ConformanceResourceStatus code '"+codeString+"'");
switch (this) { }
case DRAFT: return "Draft"; public String toCode(ConformanceResourceStatus code) {
case ACTIVE: return "Active"; if (code == ConformanceResourceStatus.DRAFT)
case RETIRED: return "Retired"; return "draft";
default: return "?"; if (code == ConformanceResourceStatus.ACTIVE)
} return "active";
} if (code == ConformanceResourceStatus.RETIRED)
} return "retired";
return "?";
public static class ConformanceResourceStatusEnumFactory implements EnumFactory<ConformanceResourceStatus> { }
public ConformanceResourceStatus fromCode(String codeString) throws IllegalArgumentException { }
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString)) }
return null;
if ("draft".equals(codeString))
return ConformanceResourceStatus.DRAFT;
if ("active".equals(codeString))
return ConformanceResourceStatus.ACTIVE;
if ("retired".equals(codeString))
return ConformanceResourceStatus.RETIRED;
throw new IllegalArgumentException("Unknown ConformanceResourceStatus code '"+codeString+"'");
}
public String toCode(ConformanceResourceStatus code) {
if (code == ConformanceResourceStatus.DRAFT)
return "draft";
if (code == ConformanceResourceStatus.ACTIVE)
return "active";
if (code == ConformanceResourceStatus.RETIRED)
return "retired";
return "?";
}
}
}

View File

@ -1,209 +1,188 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /*
* #%L Copyright (c) 2011+, HL7, Inc.
* HAPI FHIR Structures - HL7.org DSTU2 All rights reserved.
* %%
* Copyright (C) 2014 - 2015 University Health Network Redistribution and use in source and binary forms, with or without modification,
* %% are permitted provided that the following conditions are met:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * Redistributions of source code must retain the above copyright notice, this
* You may obtain a copy of the License at list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* http://www.apache.org/licenses/LICENSE-2.0 this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Unless required by applicable law or agreed to in writing, software * Neither the name of HL7 nor the names of its contributors may be used to
* distributed under the License is distributed on an "AS IS" BASIS, endorse or promote products derived from this software without specific
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. prior written permission.
* See the License for the specific language governing permissions and
* limitations under the License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* #L% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*/ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. // Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation import java.util.*;
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to import org.hl7.fhir.utilities.Utilities;
endorse or promote products derived from this software without specific import org.hl7.fhir.instance.model.annotations.Child;
prior written permission. import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND import org.hl7.fhir.instance.model.annotations.Block;
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED import org.hl7.fhir.instance.model.api.*;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. /**
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * Optional Extensions Element - found in all resources.
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @DatatypeDef(name="Extension")
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, public class Extension extends BaseExtension implements IBaseExtension<Extension, Type>, IBaseHasExtensions {
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE /**
POSSIBILITY OF SUCH DAMAGE. * Source of the definition for the extension code - a logical name or a URL.
*/
*/ @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1)
@Description(shortDefinition="identifies the meaning of the extension", formalDefinition="Source of the definition for the extension code - a logical name or a URL." )
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0 protected UriType url;
import java.util.*; /**
* Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).
import org.hl7.fhir.utilities.Utilities; */
import org.hl7.fhir.instance.model.annotations.Child; @Child(name = "value", type = {}, order=1, min=0, max=1)
import org.hl7.fhir.instance.model.annotations.Description; @Description(shortDefinition="Value of extension", formalDefinition="Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list)." )
import org.hl7.fhir.instance.model.annotations.DatatypeDef; protected org.hl7.fhir.instance.model.Type value;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.api.*; private static final long serialVersionUID = 86382982L;
/**
* Optional Extensions Element - found in all resources. /*
*/ * Constructor
@DatatypeDef(name="Extension") */
public class Extension extends BaseExtension implements IBaseExtension<Extension, Type>, IBaseHasExtensions { public Extension() {
super();
/** }
* Source of the definition for the extension code - a logical name or a URL.
*/ /*
@Child(name = "url", type = {UriType.class}, order=0, min=1, max=1) * Constructor
@Description(shortDefinition="identifies the meaning of the extension", formalDefinition="Source of the definition for the extension code - a logical name or a URL." ) */
protected UriType url; public Extension(UriType url) {
super();
/** this.url = url;
* Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list). }
*/
@Child(name = "value", type = {}, order=1, min=0, max=1) /**
@Description(shortDefinition="Value of extension", formalDefinition="Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list)." ) * @return {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
protected org.hl7.fhir.instance.model.Type value; */
public UriType getUrlElement() {
private static final long serialVersionUID = 86382982L; if (this.url == null)
if (Configuration.errorOnAutoCreate())
/* throw new Error("Attempt to auto-create Extension.url");
* Constructor else if (Configuration.doAutoCreate())
*/ this.url = new UriType(); // bb
public Extension() { return this.url;
super(); }
}
public boolean hasUrlElement() {
/* return this.url != null && !this.url.isEmpty();
* Constructor }
*/
public Extension(UriType url) { public boolean hasUrl() {
super(); return this.url != null && !this.url.isEmpty();
this.url = url; }
}
/**
/** * @param value {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
* @return {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value */
*/ public Extension setUrlElement(UriType value) {
public UriType getUrlElement() { this.url = value;
if (this.url == null) return this;
if (Configuration.errorOnAutoCreate()) }
throw new Error("Attempt to auto-create Extension.url");
else if (Configuration.doAutoCreate()) /**
this.url = new UriType(); // bb * @return Source of the definition for the extension code - a logical name or a URL.
return this.url; */
} public String getUrl() {
return this.url == null ? null : this.url.getValue();
public boolean hasUrlElement() { }
return this.url != null && !this.url.isEmpty();
} /**
* @param value Source of the definition for the extension code - a logical name or a URL.
public boolean hasUrl() { */
return this.url != null && !this.url.isEmpty(); public Extension setUrl(String value) {
} if (this.url == null)
this.url = new UriType();
/** this.url.setValue(value);
* @param value {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value return this;
*/ }
public Extension setUrlElement(UriType value) {
this.url = value; /**
return this; * @return {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).)
} */
public org.hl7.fhir.instance.model.Type getValue() {
/** return this.value;
* @return Source of the definition for the extension code - a logical name or a URL. }
*/
public String getUrl() { public boolean hasValue() {
return this.url == null ? null : this.url.getValue(); return this.value != null && !this.value.isEmpty();
} }
/** /**
* @param value Source of the definition for the extension code - a logical name or a URL. * @param value {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).)
*/ */
public Extension setUrl(String value) { public Extension setValue(org.hl7.fhir.instance.model.Type value) {
if (this.url == null) this.value = value;
this.url = new UriType(); return this;
this.url.setValue(value); }
return this;
} protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
/** childrenList.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, java.lang.Integer.MAX_VALUE, url));
* @return {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).) childrenList.add(new Property("value[x]", "*", "Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).", 0, java.lang.Integer.MAX_VALUE, value));
*/ }
public org.hl7.fhir.instance.model.Type getValue() {
return this.value; public Extension copy() {
} Extension dst = new Extension();
copyValues(dst);
public boolean hasValue() { dst.url = url == null ? null : url.copy();
return this.value != null && !this.value.isEmpty(); dst.value = value == null ? null : value.copy();
} return dst;
}
/**
* @param value {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).) protected Extension typedCopy() {
*/ return copy();
public Extension setValue(org.hl7.fhir.instance.model.Type value) { }
this.value = value;
return this; @Override
} public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
protected void listChildren(List<Property> childrenList) { return false;
super.listChildren(childrenList); if (!(other instanceof Extension))
childrenList.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, java.lang.Integer.MAX_VALUE, url)); return false;
childrenList.add(new Property("value[x]", "*", "Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).", 0, java.lang.Integer.MAX_VALUE, value)); Extension o = (Extension) other;
} return compareDeep(url, o.url, true) && compareDeep(value, o.value, true);
}
public Extension copy() {
Extension dst = new Extension(); @Override
copyValues(dst); public boolean equalsShallow(Base other) {
dst.url = url == null ? null : url.copy(); if (!super.equalsShallow(other))
dst.value = value == null ? null : value.copy(); return false;
return dst; if (!(other instanceof Extension))
} return false;
Extension o = (Extension) other;
protected Extension typedCopy() { return compareValues(url, o.url, true);
return copy(); }
}
public boolean isEmpty() {
@Override return super.isEmpty() && (url == null || url.isEmpty()) && (value == null || value.isEmpty())
public boolean equalsDeep(Base other) { ;
if (!super.equalsDeep(other)) }
return false;
if (!(other instanceof Extension))
return false; }
Extension o = (Extension) other;
return compareDeep(url, o.url, true) && compareDeep(value, o.value, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Extension))
return false;
Extension o = (Extension) other;
return compareValues(url, o.url, true);
}
public boolean isEmpty() {
return super.isEmpty() && (url == null || url.isEmpty()) && (value == null || value.isEmpty())
;
}
}

View File

@ -1,167 +1,146 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* /**
* #%L * in a language with helper classes, this would be a helper class (at least, the base exgtension helpers would be)
* HAPI FHIR Structures - HL7.org DSTU2 * @author Grahame
* %% *
* Copyright (C) 2014 - 2015 University Health Network */
* %% public class ExtensionHelper {
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at /**
* * @param name the identity of the extension of interest
* http://www.apache.org/licenses/LICENSE-2.0 * @return true if the named extension is on this element. Will check modifier extensions too if appropriate
* */
* Unless required by applicable law or agreed to in writing, software public static boolean hasExtension(Element element, String name) {
* distributed under the License is distributed on an "AS IS" BASIS, if (element != null && element instanceof BackboneElement)
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. return hasExtension((BackboneElement) element, name);
* See the License for the specific language governing permissions and
* limitations under the License. if (name == null || element == null || !element.hasExtension())
* #L% return false;
*/ for (Extension e : element.getExtension()) {
if (name.equals(e.getUrl()))
return true;
/** }
* in a language with helper classes, this would be a helper class (at least, the base exgtension helpers would be) return false;
* @author Grahame }
*
*/ /**
public class ExtensionHelper { * @param name the identity of the extension of interest
* @return true if the named extension is on this element. Will check modifier extensions
*/
/** public static boolean hasExtension(BackboneElement element, String name) {
* @param name the identity of the extension of interest if (name == null || element == null || !(element.hasExtension() || element.hasModifierExtension()))
* @return true if the named extension is on this element. Will check modifier extensions too if appropriate return false;
*/ for (Extension e : element.getModifierExtension()) {
public static boolean hasExtension(Element element, String name) { if (name.equals(e.getUrl()))
if (element != null && element instanceof BackboneElement) return true;
return hasExtension((BackboneElement) element, name); }
for (Extension e : element.getExtension()) {
if (name == null || element == null || !element.hasExtension()) if (name.equals(e.getUrl()))
return false; return true;
for (Extension e : element.getExtension()) { }
if (name.equals(e.getUrl())) return false;
return true; }
}
return false;
} /**
* @param name the identity of the extension of interest
/** * @return The extension, if on this element, else null. will check modifier extensions too, if appropriate
* @param name the identity of the extension of interest */
* @return true if the named extension is on this element. Will check modifier extensions public static Extension getExtension(Element element, String name) {
*/ if (element != null && element instanceof BackboneElement)
public static boolean hasExtension(BackboneElement element, String name) { return getExtension((BackboneElement) element, name);
if (name == null || element == null || !(element.hasExtension() || element.hasModifierExtension()))
return false; if (name == null || element == null || !element.hasExtension())
for (Extension e : element.getModifierExtension()) { return null;
if (name.equals(e.getUrl())) for (Extension e : element.getExtension()) {
return true; if (name.equals(e.getUrl()))
} return e;
for (Extension e : element.getExtension()) { }
if (name.equals(e.getUrl())) return null;
return true; }
}
return false; /**
} * @param name the identity of the extension of interest
* @return The extension, if on this element, else null. will check modifier extensions too
*/
/** public static Extension getExtension(BackboneElement element, String name) {
* @param name the identity of the extension of interest if (name == null || element == null || !element.hasExtension())
* @return The extension, if on this element, else null. will check modifier extensions too, if appropriate return null;
*/ for (Extension e : element.getModifierExtension()) {
public static Extension getExtension(Element element, String name) { if (name.equals(e.getUrl()))
if (element != null && element instanceof BackboneElement) return e;
return getExtension((BackboneElement) element, name); }
for (Extension e : element.getExtension()) {
if (name == null || element == null || !element.hasExtension()) if (name.equals(e.getUrl()))
return null; return e;
for (Extension e : element.getExtension()) { }
if (name.equals(e.getUrl())) return null;
return e; }
}
return null; /**
} * set the value of an extension on the element. if value == null, make sure it doesn't exist
*
/** * @param element - the element to act on. Can also be a backbone element
* @param name the identity of the extension of interest * @param modifier - whether this is a modifier. Note that this is a definitional property of the extension; don't alternate
* @return The extension, if on this element, else null. will check modifier extensions too * @param uri - the identifier for the extension
*/ * @param value - the value of the extension. Delete if this is null
public static Extension getExtension(BackboneElement element, String name) { * @throws Exception - if the modifier logic is incorrect
if (name == null || element == null || !element.hasExtension()) */
return null; public static void setExtension(Element element, boolean modifier, String uri, Type value) throws Exception {
for (Extension e : element.getModifierExtension()) { if (value == null) {
if (name.equals(e.getUrl())) // deleting the extension
return e; if (element instanceof BackboneElement)
} for (Extension e : ((BackboneElement) element).getModifierExtension()) {
for (Extension e : element.getExtension()) { if (uri.equals(e.getUrl()))
if (name.equals(e.getUrl())) ((BackboneElement) element).getModifierExtension().remove(e);
return e; }
} for (Extension e : element.getExtension()) {
return null; if (uri.equals(e.getUrl()))
} element.getExtension().remove(e);
}
/** } else {
* set the value of an extension on the element. if value == null, make sure it doesn't exist // it would probably be easier to delete and then create, but this would re-order the extensions
* // not that order matters, but we'll preserve it anyway
* @param element - the element to act on. Can also be a backbone element boolean found = false;
* @param modifier - whether this is a modifier. Note that this is a definitional property of the extension; don't alternate if (element instanceof BackboneElement)
* @param uri - the identifier for the extension for (Extension e : ((BackboneElement) element).getModifierExtension()) {
* @param value - the value of the extension. Delete if this is null if (uri.equals(e.getUrl())) {
* @throws Exception - if the modifier logic is incorrect if (!modifier)
*/ throw new Exception("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws Exception { e.setValue(value);
if (value == null) { found = true;
// deleting the extension }
if (element instanceof BackboneElement) }
for (Extension e : ((BackboneElement) element).getModifierExtension()) { for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl())) if (uri.equals(e.getUrl())) {
((BackboneElement) element).getModifierExtension().remove(e); if (modifier)
} throw new Exception("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
for (Extension e : element.getExtension()) { e.setValue(value);
if (uri.equals(e.getUrl())) found = true;
element.getExtension().remove(e); }
} }
} else { if (!found) {
// it would probably be easier to delete and then create, but this would re-order the extensions Extension ex = new Extension().setUrl(uri).setValue(value);
// not that order matters, but we'll preserve it anyway if (modifier) {
boolean found = false; if (!(element instanceof BackboneElement))
if (element instanceof BackboneElement) throw new Exception("Error adding extension \""+uri+"\": extension is marked as a modifier, but element is not a backbone element");
for (Extension e : ((BackboneElement) element).getModifierExtension()) { ((BackboneElement) element).getModifierExtension().add(ex);
if (uri.equals(e.getUrl())) {
if (!modifier) } else {
throw new Exception("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier"); element.getExtension().add(ex);
e.setValue(value); }
found = true; }
} }
} }
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl())) { public static boolean hasExtensions(Element element) {
if (modifier) if (element instanceof BackboneElement)
throw new Exception("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier"); return element.hasExtension() || ((BackboneElement) element).hasModifierExtension();
e.setValue(value); else
found = true; return element.hasExtension();
} }
}
if (!found) {
Extension ex = new Extension().setUrl(uri).setValue(value); }
if (modifier) {
if (!(element instanceof BackboneElement))
throw new Exception("Error adding extension \""+uri+"\": extension is marked as a modifier, but element is not a backbone element");
((BackboneElement) element).getModifierExtension().add(ex);
} else {
element.getExtension().add(ex);
}
}
}
}
public static boolean hasExtensions(Element element) {
if (element instanceof BackboneElement)
return element.hasExtension() || ((BackboneElement) element).hasModifierExtension();
else
return element.hasExtension();
}
}

View File

@ -1,196 +1,175 @@
package org.hl7.fhir.instance.model; package org.hl7.fhir.instance.model;
/* import java.net.URISyntaxException;
* #%L import java.text.ParseException;
* HAPI FHIR Structures - HL7.org DSTU2 import java.util.UUID;
* %%
* Copyright (C) 2014 - 2015 University Health Network import org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem;
* %% import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
* Licensed under the Apache License, Version 2.0 (the "License"); import org.hl7.fhir.utilities.Utilities;
* you may not use this file except in compliance with the License. import org.hl7.fhir.utilities.xhtml.XhtmlParser;
* You may obtain a copy of the License at
* /*
* http://www.apache.org/licenses/LICENSE-2.0 Copyright (c) 2011+, HL7, Inc
* All rights reserved.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, Redistribution and use in source and binary forms, with or without modification,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. are permitted provided that the following conditions are met:
* See the License for the specific language governing permissions and
* limitations under the License. * Redistributions of source code must retain the above copyright notice, this
* #L% list of conditions and the following disclaimer.
*/ * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
import java.net.URISyntaxException; * Neither the name of HL7 nor the names of its contributors may be used to
import java.text.ParseException; endorse or promote products derived from this software without specific
import java.util.UUID; prior written permission.
import org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
import org.hl7.fhir.utilities.Utilities; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
import org.hl7.fhir.utilities.xhtml.XhtmlParser; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Copyright (c) 2011+, HL7, Inc PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
All rights reserved. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Redistribution and use in source and binary forms, with or without modification, POSSIBILITY OF SUCH DAMAGE.
are permitted provided that the following conditions are met:
*/
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation public class Factory {
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to public static IdType newId(String value) {
endorse or promote products derived from this software without specific if (value == null)
prior written permission. return null;
IdType res = new IdType();
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND res.setValue(value);
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED return res;
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. }
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT public static StringType newString_(String value) {
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR if (value == null)
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, return null;
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) StringType res = new StringType();
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE res.setValue(value);
POSSIBILITY OF SUCH DAMAGE. return res;
}
*/
public static UriType newUri(String value) throws URISyntaxException {
if (value == null)
return null;
public class Factory { UriType res = new UriType();
res.setValue(value);
public static IdType newId(String value) { return res;
if (value == null) }
return null;
IdType res = new IdType(); public static DateTimeType newDateTime(String value) throws ParseException {
res.setValue(value); if (value == null)
return res; return null;
} return new DateTimeType(value);
}
public static StringType newString_(String value) {
if (value == null) public static DateType newDate(String value) throws ParseException {
return null; if (value == null)
StringType res = new StringType(); return null;
res.setValue(value); return new DateType(value);
return res; }
}
public static CodeType newCode(String value) {
public static UriType newUri(String value) throws URISyntaxException { if (value == null)
if (value == null) return null;
return null; CodeType res = new CodeType();
UriType res = new UriType(); res.setValue(value);
res.setValue(value); return res;
return res; }
}
public static IntegerType newInteger(int value) {
public static DateTimeType newDateTime(String value) throws ParseException { IntegerType res = new IntegerType();
if (value == null) res.setValue(value);
return null; return res;
return new DateTimeType(value); }
}
public static IntegerType newInteger(java.lang.Integer value) {
public static DateType newDate(String value) throws ParseException { if (value == null)
if (value == null) return null;
return null; IntegerType res = new IntegerType();
return new DateType(value); res.setValue(value);
} return res;
}
public static CodeType newCode(String value) {
if (value == null) public static BooleanType newBoolean(boolean value) {
return null; BooleanType res = new BooleanType();
CodeType res = new CodeType(); res.setValue(value);
res.setValue(value); return res;
return res; }
}
public static ContactPoint newContactPoint(ContactPointSystem system, String value) {
public static IntegerType newInteger(int value) { ContactPoint res = new ContactPoint();
IntegerType res = new IntegerType(); res.setSystem(system);
res.setValue(value); res.setValue(value);
return res; return res;
} }
public static IntegerType newInteger(java.lang.Integer value) { public static Extension newExtension(String uri, Type value, boolean evenIfNull) throws Exception {
if (value == null) if (!evenIfNull && value == null)
return null; return null;
IntegerType res = new IntegerType(); Extension e = new Extension();
res.setValue(value); e.setUrl(uri);
return res; e.setValue(value);
} return e;
}
public static BooleanType newBoolean(boolean value) {
BooleanType res = new BooleanType(); public static CodeableConcept newCodeableConcept(String code, String system, String display) throws Exception {
res.setValue(value); CodeableConcept cc = new CodeableConcept();
return res; Coding c = new Coding();
} c.setCode(code);
c.setSystem(system);
public static ContactPoint newContactPoint(ContactPointSystem system, String value) { c.setDisplay(display);
ContactPoint res = new ContactPoint(); cc.getCoding().add(c);
res.setSystem(system); return cc;
res.setValue(value); }
return res;
} public static Reference makeReference(String url) throws Exception {
Reference rr = new Reference();
public static Extension newExtension(String uri, Type value, boolean evenIfNull) throws Exception { rr.setReference(url);
if (!evenIfNull && value == null) return rr;
return null; }
Extension e = new Extension();
e.setUrl(uri); public static Narrative newNarrative(NarrativeStatus status, String html) throws Exception {
e.setValue(value); Narrative n = new Narrative();
return e; n.setStatus(status);
} n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>"));
return n;
public static CodeableConcept newCodeableConcept(String code, String system, String display) throws Exception { }
CodeableConcept cc = new CodeableConcept();
Coding c = new Coding(); public static Coding makeCoding(String code) throws Exception {
c.setCode(code); String[] parts = code.split("\\|");
c.setSystem(system); Coding c = new Coding();
c.setDisplay(display); if (parts.length == 2) {
cc.getCoding().add(c); c.setSystem(parts[0]);
return cc; c.setCode(parts[1]);
} } else if (parts.length == 3) {
c.setSystem(parts[0]);
public static Reference makeReference(String url) throws Exception { c.setCode(parts[1]);
Reference rr = new Reference(); c.setDisplay(parts[2]);
rr.setReference(url); } else
return rr; throw new Exception("Unable to understand the code '"+code+"'. Use the format system|code(|display)");
} return c;
}
public static Narrative newNarrative(NarrativeStatus status, String html) throws Exception {
Narrative n = new Narrative(); public static Reference makeReference(String url, String text) {
n.setStatus(status); Reference rr = new Reference();
n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>")); rr.setReference(url);
return n; if (!Utilities.noString(text))
} rr.setDisplay(text);
return rr;
public static Coding makeCoding(String code) throws Exception { }
String[] parts = code.split("\\|");
Coding c = new Coding(); public static String createUUID() {
if (parts.length == 2) { return "urn:uuid:"+UUID.randomUUID().toString().toLowerCase();
c.setSystem(parts[0]); }
c.setCode(parts[1]);
} else if (parts.length == 3) { }
c.setSystem(parts[0]);
c.setCode(parts[1]);
c.setDisplay(parts[2]);
} else
throw new Exception("Unable to understand the code '"+code+"'. Use the format system|code(|display)");
return c;
}
public static Reference makeReference(String url, String text) {
Reference rr = new Reference();
rr.setReference(url);
if (!Utilities.noString(text))
rr.setDisplay(text);
return rr;
}
public static String createUUID() {
return "urn:uuid:"+UUID.randomUUID().toString().toLowerCase();
}
}

View File

@ -0,0 +1,66 @@
package org.hl7.fhir.instance.model;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Interface to be implemented by all built-in FHIR enumerations (i.e. the
* actual FHIR-defined Java Enum will implement this interface)
*/
public interface FhirEnum {
/**
* Get the XML/JSON representation for an enumerated value
* @return the XML/JSON representation
*/
public String toCode();
}

View File

@ -0,0 +1,36 @@
package org.hl7.fhir.instance.model;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface IPrimitiveType<T> extends IBaseDatatype {
void setValueAsString(String theValue) throws IllegalArgumentException;
String getValueAsString();
T getValue();
IPrimitiveType<T> setValue(T theValue) throws IllegalArgumentException;
}

Some files were not shown because too many files have changed in this diff Show More