Update RI structures
This commit is contained in:
parent
b89ee3d2a7
commit
ec3c94a823
|
@ -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.ICompositeType;
|
||||
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.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
@ -510,7 +510,7 @@ class ModelScanner {
|
|||
RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName);
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
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.annotation.ResourceDef;
|
||||
|
@ -58,7 +58,7 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
|||
|
||||
try {
|
||||
IBaseResource instance = theClass.newInstance();
|
||||
if (instance instanceof IRefImplResource) {
|
||||
if (instance instanceof IAnyResource) {
|
||||
myStructureVersion = FhirVersionEnum.DSTU2_HL7ORG;
|
||||
} else {
|
||||
myStructureVersion = ((IResource)instance).getStructureFhirVersionEnum();
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
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.base.composite.BaseResourceReferenceDt;
|
||||
|
@ -56,7 +56,7 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini
|
|||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>();
|
||||
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;
|
||||
}
|
||||
RuntimeResourceDefinition definition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
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 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");
|
||||
} else if (theResouce instanceof IResource) {
|
||||
((IResource) theResouce).setId(new IdDt(getValue()));
|
||||
} else if (theResouce instanceof IRefImplResource) {
|
||||
((IRefImplResource) theResouce).setId(getValue());
|
||||
} else if (theResouce instanceof IAnyResource) {
|
||||
((IAnyResource) theResouce).setId(getValue());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource");
|
||||
}
|
||||
|
|
|
@ -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.IBaseResource;
|
||||
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.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
@ -95,8 +95,8 @@ public abstract class BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
} else if (theTarget instanceof IDomainResource) {
|
||||
List<? extends IRefImplResource> containedResources = ((IDomainResource) theTarget).getContained();
|
||||
for (IRefImplResource next : containedResources) {
|
||||
List<? extends IAnyResource> containedResources = ((IDomainResource) theTarget).getContained();
|
||||
for (IAnyResource next : containedResources) {
|
||||
String nextId = next.getIdElement().getValue();
|
||||
if (StringUtils.isNotBlank(nextId)) {
|
||||
if (!nextId.startsWith("#")) {
|
||||
|
|
|
@ -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.IBaseResource;
|
||||
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.IBaseBooleanDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
|
@ -676,8 +676,8 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
resourceId = res.getId().getIdPart();
|
||||
}
|
||||
}
|
||||
} else if (theResource instanceof IRefImplResource) {
|
||||
IRefImplResource res = (IRefImplResource) theResource;
|
||||
} else if (theResource instanceof IAnyResource) {
|
||||
IAnyResource res = (IAnyResource) theResource;
|
||||
if (/*theContainedResource && */ StringUtils.isNotBlank(res.getIdElement().getIdPart())) {
|
||||
resourceId = res.getIdElement().getIdPart();
|
||||
}
|
||||
|
|
|
@ -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.IBaseResource;
|
||||
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.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
|
@ -751,7 +751,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
} else {
|
||||
// HL7 structs
|
||||
IRefImplResource resource = (IRefImplResource) theResource;
|
||||
IAnyResource resource = (IAnyResource) theResource;
|
||||
if (StringUtils.isNotBlank(resource.getIdElement().getIdPart())) {
|
||||
resourceId = resource.getIdElement().getIdPart();
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
theEventWriter.writeStartElement(resDef.getName());
|
||||
theEventWriter.writeDefaultNamespace(FHIR_NS);
|
||||
|
||||
if (theResource instanceof IRefImplResource) {
|
||||
if (theResource instanceof IAnyResource) {
|
||||
|
||||
// HL7.org Structures
|
||||
writeOptionalTagWithValue(theEventWriter, "id", theResourceId);
|
||||
|
|
|
@ -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.IBaseResource;
|
||||
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.FhirContext;
|
||||
|
@ -460,8 +460,8 @@ public class MethodUtil {
|
|||
if (resource instanceof IResource) {
|
||||
InstantDt lmValue = new InstantDt(headerDateValue);
|
||||
((IResource) resource).getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
|
||||
} else if (resource instanceof IRefImplResource) {
|
||||
((IRefImplResource) resource).getMeta().setLastUpdated(headerDateValue);
|
||||
} else if (resource instanceof IAnyResource) {
|
||||
((IAnyResource) resource).getMeta().setLastUpdated(headerDateValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ourLog.warn("Unable to parse date string '{}'. Error is: {}", headerValue, e.toString());
|
||||
|
@ -505,8 +505,8 @@ public class MethodUtil {
|
|||
}
|
||||
if (resource instanceof IResource) {
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put((IResource) resource, tagList);
|
||||
} else if (resource instanceof IRefImplResource) {
|
||||
IBaseMetaType meta = ((IRefImplResource) resource).getMeta();
|
||||
} else if (resource instanceof IAnyResource) {
|
||||
IBaseMetaType meta = ((IAnyResource) resource).getMeta();
|
||||
for (Tag next : tagList) {
|
||||
meta.addTag().setSystem(next.getScheme()).setCode(next.getTerm()).setDisplay(next.getLabel());
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.utils.DateUtils;
|
||||
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.IIdType;
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class RestfulServerUtils {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Date lastUpdated = ((IRefImplResource)theResource).getMeta().getLastUpdated();
|
||||
Date lastUpdated = ((IAnyResource)theResource).getMeta().getLastUpdated();
|
||||
if (lastUpdated != null) {
|
||||
theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated));
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ package org.hl7.fhir.instance.model.api;
|
|||
*/
|
||||
|
||||
|
||||
public interface IRefImplResource extends IBaseResource {
|
||||
public interface IAnyResource extends IBaseResource {
|
||||
|
||||
String getId();
|
||||
|
||||
IRefImplResource setId(String theId);
|
||||
IAnyResource setId(String theId);
|
||||
|
||||
IIdType getIdElement();
|
||||
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -43,5 +43,5 @@ public interface IBaseBundle extends IBaseResource {
|
|||
* this bundle.
|
||||
*/
|
||||
public static final String LINK_SELF = "self";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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 {
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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> {
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ package org.hl7.fhir.instance.model.api;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDomainResource extends IRefImplResource {
|
||||
public interface IDomainResource extends IAnyResource {
|
||||
|
||||
List<? extends IRefImplResource> getContained();
|
||||
List<? extends IAnyResource> getContained();
|
||||
|
||||
INarrative getText();
|
||||
|
||||
|
|
|
@ -27,26 +27,21 @@
|
|||
<version>${servlet_api_version}</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>saxon</artifactId>
|
||||
<version>8.7</version>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
<version>9.6.0-4</version>
|
||||
</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 -->
|
||||
<dependency>
|
||||
|
@ -192,6 +187,15 @@
|
|||
|
||||
<build>
|
||||
<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>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.hl7.fhir.instance.model.InstantType;
|
|||
import org.hl7.fhir.instance.model.OperationOutcome;
|
||||
import org.hl7.fhir.instance.model.Resource;
|
||||
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.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
@ -93,7 +93,7 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
|
|||
IDomainResource next = (IDomainResource) nextBaseRes;
|
||||
|
||||
Set<String> containedIds = new HashSet<String>();
|
||||
for (IRefImplResource nextContained : next.getContained()) {
|
||||
for (IAnyResource nextContained : next.getContained()) {
|
||||
if (nextContained.getId().isEmpty() == false) {
|
||||
containedIds.add(nextContained.getIdElement().getValue());
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,111 +1,90 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Age")
|
||||
public class Age extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Age copy() {
|
||||
Age dst = new Age();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Age typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Age")
|
||||
public class Age extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Age copy() {
|
||||
Age dst = new Age();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Age typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,164 +1,143 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
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.
|
||||
*/
|
||||
@DatatypeDef(name="BackboneElement")
|
||||
public abstract class BackboneElement extends Element implements IBaseBackboneElement {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@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;
|
||||
|
||||
private static final long serialVersionUID = -1431673179L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
return this.modifierExtension;
|
||||
}
|
||||
|
||||
public boolean hasModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
return false;
|
||||
for (Extension item : this.modifierExtension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addModifierExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BackboneElement addModifierExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public abstract BackboneElement copy();
|
||||
|
||||
public void copyValues(BackboneElement dst) {
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
dst.modifierExtension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
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.
|
||||
*/
|
||||
@DatatypeDef(name="BackboneElement")
|
||||
public abstract class BackboneElement extends Element implements IBaseBackboneElement {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@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;
|
||||
|
||||
private static final long serialVersionUID = -1431673179L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
return this.modifierExtension;
|
||||
}
|
||||
|
||||
public boolean hasModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
return false;
|
||||
for (Extension item : this.modifierExtension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addModifierExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BackboneElement addModifierExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public abstract BackboneElement copy();
|
||||
|
||||
public void copyValues(BackboneElement dst) {
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
dst.modifierExtension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,178 +1,157 @@
|
|||
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 java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public abstract class Base implements Serializable, IBase {
|
||||
|
||||
/**
|
||||
* User appended data items - allow users to add extra information to the class
|
||||
*/
|
||||
private Map<String, Object> userData;
|
||||
|
||||
/**
|
||||
* Round tracking xml comments for testing convenience
|
||||
*/
|
||||
private List<String> formatComments;
|
||||
|
||||
|
||||
public Object getUserData(String name) {
|
||||
if (userData == null)
|
||||
return null;
|
||||
return userData.get(name);
|
||||
}
|
||||
|
||||
public void setUserData(String name, Object value) {
|
||||
if (userData == null)
|
||||
userData = new HashMap<String, Object>();
|
||||
userData.put(name, value);
|
||||
}
|
||||
|
||||
public boolean hasUserData(String name) {
|
||||
if (userData == null)
|
||||
return false;
|
||||
else
|
||||
return userData.containsKey(name);
|
||||
}
|
||||
|
||||
public String getUserString(String name) {
|
||||
return (String) getUserData(name);
|
||||
}
|
||||
|
||||
public boolean hasFormatComment() {
|
||||
return (formatComments != null && !formatComments.isEmpty());
|
||||
}
|
||||
|
||||
public List<String> getFormatComments() {
|
||||
if (formatComments == null)
|
||||
formatComments = new ArrayList<String>();
|
||||
return formatComments;
|
||||
}
|
||||
|
||||
protected abstract void listChildren(List<Property> result) ;
|
||||
|
||||
/**
|
||||
* Supports iterating the children elements in some generic processor or browser
|
||||
* 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.
|
||||
* To find these, the processing code must recognise the element as a primitive, typecast
|
||||
* the value to a {@link Type}, and examine the value
|
||||
*
|
||||
* @return a list of all the children defined for this element
|
||||
*/
|
||||
public List<Property> children() {
|
||||
List<Property> result = new ArrayList<Property>();
|
||||
listChildren(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Property getChildByName(String name) {
|
||||
List<Property> children = new ArrayList<Property>();
|
||||
listChildren(children);
|
||||
for (Property c : children)
|
||||
if (c.getName().equals(name))
|
||||
return c;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Base> listChildrenByName(String name) {
|
||||
List<Property> children = new ArrayList<Property>();
|
||||
listChildren(children);
|
||||
for (Property c : children)
|
||||
if (c.getName().equals(name) || (c.getName().endsWith("[x]") && name.startsWith(c.getName())))
|
||||
return c.getValues();
|
||||
return new ArrayList<Base>();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return true; // userData does not count
|
||||
}
|
||||
|
||||
public boolean equalsDeep(Base other) {
|
||||
return other != null;
|
||||
}
|
||||
|
||||
public boolean equalsShallow(Base other) {
|
||||
return other != null;
|
||||
}
|
||||
|
||||
public static boolean compareDeep(List<? extends Base> e1, List<? extends Base> 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 (!compareDeep(e1.get(i), e2.get(i), allowNull))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static boolean compareDeep(Base e1, Base e2, boolean allowNull) {
|
||||
if (e1 == null && e2 == null && allowNull)
|
||||
return true;
|
||||
if (e1 == null || e2 == null)
|
||||
return false;
|
||||
return e1.equalsDeep(e2);
|
||||
}
|
||||
|
||||
public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) {
|
||||
if (div1 == null && div2 == null && allowNull)
|
||||
return true;
|
||||
if (div1 == null || div2 == null)
|
||||
return false;
|
||||
return div1.equalsDeep(div2);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public abstract class Base implements Serializable, IBase {
|
||||
|
||||
/**
|
||||
* User appended data items - allow users to add extra information to the class
|
||||
*/
|
||||
private Map<String, Object> userData;
|
||||
|
||||
/**
|
||||
* Round tracking xml comments for testing convenience
|
||||
*/
|
||||
private List<String> formatComments;
|
||||
|
||||
|
||||
public Object getUserData(String name) {
|
||||
if (userData == null)
|
||||
return null;
|
||||
return userData.get(name);
|
||||
}
|
||||
|
||||
public void setUserData(String name, Object value) {
|
||||
if (userData == null)
|
||||
userData = new HashMap<String, Object>();
|
||||
userData.put(name, value);
|
||||
}
|
||||
|
||||
public boolean hasUserData(String name) {
|
||||
if (userData == null)
|
||||
return false;
|
||||
else
|
||||
return userData.containsKey(name);
|
||||
}
|
||||
|
||||
public String getUserString(String name) {
|
||||
return (String) getUserData(name);
|
||||
}
|
||||
|
||||
public boolean hasFormatComment() {
|
||||
return (formatComments != null && !formatComments.isEmpty());
|
||||
}
|
||||
|
||||
public List<String> getFormatComments() {
|
||||
if (formatComments == null)
|
||||
formatComments = new ArrayList<String>();
|
||||
return formatComments;
|
||||
}
|
||||
|
||||
protected abstract void listChildren(List<Property> result) ;
|
||||
|
||||
/**
|
||||
* Supports iterating the children elements in some generic processor or browser
|
||||
* 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.
|
||||
* To find these, the processing code must recognise the element as a primitive, typecast
|
||||
* the value to a {@link Type}, and examine the value
|
||||
*
|
||||
* @return a list of all the children defined for this element
|
||||
*/
|
||||
public List<Property> children() {
|
||||
List<Property> result = new ArrayList<Property>();
|
||||
listChildren(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Property getChildByName(String name) {
|
||||
List<Property> children = new ArrayList<Property>();
|
||||
listChildren(children);
|
||||
for (Property c : children)
|
||||
if (c.getName().equals(name))
|
||||
return c;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Base> listChildrenByName(String name) {
|
||||
List<Property> children = new ArrayList<Property>();
|
||||
listChildren(children);
|
||||
for (Property c : children)
|
||||
if (c.getName().equals(name) || (c.getName().endsWith("[x]") && name.startsWith(c.getName())))
|
||||
return c.getValues();
|
||||
return new ArrayList<Base>();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return true; // userData does not count
|
||||
}
|
||||
|
||||
public boolean equalsDeep(Base other) {
|
||||
return other != null;
|
||||
}
|
||||
|
||||
public boolean equalsShallow(Base other) {
|
||||
return other != null;
|
||||
}
|
||||
|
||||
public static boolean compareDeep(List<? extends Base> e1, List<? extends Base> 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 (!compareDeep(e1.get(i), e2.get(i), allowNull))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static boolean compareDeep(Base e1, Base e2, boolean allowNull) {
|
||||
if (e1 == null && e2 == null && allowNull)
|
||||
return true;
|
||||
if (e1 == null || e2 == null)
|
||||
return false;
|
||||
return e1.equalsDeep(e2);
|
||||
}
|
||||
|
||||
public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) {
|
||||
if (div1 == null && div2 == null && allowNull)
|
||||
return true;
|
||||
if (div1 == null || div2 == null)
|
||||
return false;
|
||||
return div1.equalsDeep(div2);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,93 +1,72 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
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.codec.binary.Base64;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64
|
||||
*/
|
||||
@DatatypeDef(name="base64binary")
|
||||
public class Base64BinaryType extends PrimitiveType<byte[]> {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Base64BinaryType() {
|
||||
super();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64
|
||||
*/
|
||||
@DatatypeDef(name="base64binary")
|
||||
public class Base64BinaryType extends PrimitiveType<byte[]> {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Base64BinaryType() {
|
||||
super();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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;
|
||||
|
||||
public abstract class BaseBinary extends Resource implements IBaseBinary {
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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.
|
||||
All rights reserved.
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
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.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
|
|
@ -1,30 +1,10 @@
|
|||
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.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
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 {
|
||||
|
||||
|
@ -45,7 +25,7 @@ public abstract class BaseReference extends Type implements IBaseReference, ICom
|
|||
}
|
||||
}
|
||||
|
||||
public BaseReference(IRefImplResource theResource) {
|
||||
public BaseReference(IAnyResource theResource) {
|
||||
resource = theResource;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,13 @@
|
|||
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.IAnyResource;
|
||||
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.
|
||||
*/
|
||||
public BaseResource setId(IIdType value) {
|
||||
|
|
|
@ -1,394 +1,373 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic")
|
||||
public class Basic extends DomainResource {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* Identifies the 'type' of resource - equivalent to the resource name for other resources.
|
||||
*/
|
||||
@Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
|
||||
protected CodeableConcept code;
|
||||
|
||||
/**
|
||||
* Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference subject;
|
||||
|
||||
/**
|
||||
* 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 Resource subjectTarget;
|
||||
|
||||
/**
|
||||
* Indicates who was responsible for creating the resource instance.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference author;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
protected Resource authorTarget;
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected DateType created;
|
||||
|
||||
private static final long serialVersionUID = 916539354L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Basic() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Basic(CodeableConcept code) {
|
||||
super();
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Basic addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeableConcept(); // cc
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.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;
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.subject");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.subject = new Reference(); // cc
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
public boolean hasSubject() {
|
||||
return this.subject != null && !this.subject.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
this.subject = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Resource getSubjectTarget() {
|
||||
return this.subjectTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #author} (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
public Reference getAuthor() {
|
||||
if (this.author == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.author");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.author = new Reference(); // cc
|
||||
return this.author;
|
||||
}
|
||||
|
||||
public boolean hasAuthor() {
|
||||
return this.author != null && !this.author.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
public Basic setAuthor(Reference value) {
|
||||
this.author = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Resource getAuthorTarget() {
|
||||
return this.authorTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
this.authorTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 DateType getCreatedElement() {
|
||||
if (this.created == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.created");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.created = new DateType(); // bb
|
||||
return this.created;
|
||||
}
|
||||
|
||||
public boolean hasCreatedElement() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCreated() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Basic setCreatedElement(DateType value) {
|
||||
this.created = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Identifies when the resource was first created.
|
||||
*/
|
||||
public Date getCreated() {
|
||||
return this.created == null ? null : this.created.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Identifies when the resource was first created.
|
||||
*/
|
||||
public Basic setCreated(Date value) {
|
||||
if (value == null)
|
||||
this.created = null;
|
||||
else {
|
||||
if (this.created == null)
|
||||
this.created = new DateType();
|
||||
this.created.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public Basic copy() {
|
||||
Basic dst = new Basic();
|
||||
copyValues(dst);
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.code = code == null ? null : code.copy();
|
||||
dst.subject = subject == null ? null : subject.copy();
|
||||
dst.author = author == null ? null : author.copy();
|
||||
dst.created = created == null ? null : created.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Basic typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Basic))
|
||||
return false;
|
||||
Basic o = (Basic) other;
|
||||
return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
|
||||
&& compareDeep(author, o.author, true) && compareDeep(created, o.created, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Basic))
|
||||
return false;
|
||||
Basic o = (Basic) other;
|
||||
return compareValues(created, o.created, true);
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic")
|
||||
public class Basic extends DomainResource {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* Identifies the 'type' of resource - equivalent to the resource name for other resources.
|
||||
*/
|
||||
@Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
|
||||
protected CodeableConcept code;
|
||||
|
||||
/**
|
||||
* Identifies the patient, practitioner, device or any other resource that is the "focus" of this resoruce.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference subject;
|
||||
|
||||
/**
|
||||
* 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 Resource subjectTarget;
|
||||
|
||||
/**
|
||||
* Indicates who was responsible for creating the resource instance.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference author;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
protected Resource authorTarget;
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected DateType created;
|
||||
|
||||
private static final long serialVersionUID = 916539354L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Basic() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Basic(CodeableConcept code) {
|
||||
super();
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Basic addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeableConcept(); // cc
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.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;
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.subject");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.subject = new Reference(); // cc
|
||||
return this.subject;
|
||||
}
|
||||
|
||||
public boolean hasSubject() {
|
||||
return this.subject != null && !this.subject.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
this.subject = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Resource getSubjectTarget() {
|
||||
return this.subjectTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #author} (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
public Reference getAuthor() {
|
||||
if (this.author == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.author");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.author = new Reference(); // cc
|
||||
return this.author;
|
||||
}
|
||||
|
||||
public boolean hasAuthor() {
|
||||
return this.author != null && !this.author.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
|
||||
*/
|
||||
public Basic setAuthor(Reference value) {
|
||||
this.author = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Resource getAuthorTarget() {
|
||||
return this.authorTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
this.authorTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 DateType getCreatedElement() {
|
||||
if (this.created == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Basic.created");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.created = new DateType(); // bb
|
||||
return this.created;
|
||||
}
|
||||
|
||||
public boolean hasCreatedElement() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCreated() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Basic setCreatedElement(DateType value) {
|
||||
this.created = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Identifies when the resource was first created.
|
||||
*/
|
||||
public Date getCreated() {
|
||||
return this.created == null ? null : this.created.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Identifies when the resource was first created.
|
||||
*/
|
||||
public Basic setCreated(Date value) {
|
||||
if (value == null)
|
||||
this.created = null;
|
||||
else {
|
||||
if (this.created == null)
|
||||
this.created = new DateType();
|
||||
this.created.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public Basic copy() {
|
||||
Basic dst = new Basic();
|
||||
copyValues(dst);
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.code = code == null ? null : code.copy();
|
||||
dst.subject = subject == null ? null : subject.copy();
|
||||
dst.author = author == null ? null : author.copy();
|
||||
dst.created = created == null ? null : created.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Basic typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Basic))
|
||||
return false;
|
||||
Basic o = (Basic) other;
|
||||
return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
|
||||
&& compareDeep(author, o.author, true) && compareDeep(created, o.created, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Basic))
|
||||
return false;
|
||||
Basic o = (Basic) other;
|
||||
return compareValues(created, o.created, true);
|
||||
}
|
||||
|
||||
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="code", path="Basic.code", description="Kind of Resource", type="token" )
|
||||
public static final String SP_CODE = "code";
|
||||
@SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the", type="reference" )
|
||||
public static final String SP_SUBJECT = "subject";
|
||||
@SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
|
||||
public static final String SP_CREATED = "created";
|
||||
@SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the", type="reference" )
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,244 +1,223 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
|
||||
*/
|
||||
@ResourceDef(name="Binary", profile="http://hl7.org/fhir/Profile/Binary")
|
||||
public class Binary extends BaseBinary implements IBaseBinary {
|
||||
|
||||
/**
|
||||
* MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
@Child(name = "contentType", type = {CodeType.class}, order=0, min=1, max=1)
|
||||
@Description(shortDefinition="MimeType of the binary content", formalDefinition="MimeType of the binary content represented as a standard MimeType (BCP 13)." )
|
||||
protected CodeType contentType;
|
||||
|
||||
/**
|
||||
* The actual content, base64 encoded.
|
||||
*/
|
||||
@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;
|
||||
|
||||
private static final long serialVersionUID = 974764407L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Binary() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Binary(CodeType contentType, Base64BinaryType content) {
|
||||
super();
|
||||
this.contentType = contentType;
|
||||
this.content = 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
|
||||
*/
|
||||
public CodeType getContentTypeElement() {
|
||||
if (this.contentType == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Binary.contentType");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.contentType = new CodeType(); // bb
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
public boolean hasContentTypeElement() {
|
||||
return this.contentType != null && !this.contentType.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasContentType() {
|
||||
return this.contentType != null && !this.contentType.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Binary setContentTypeElement(CodeType value) {
|
||||
this.contentType = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
public String getContentType() {
|
||||
return this.contentType == null ? null : this.contentType.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
public Binary setContentType(String value) {
|
||||
if (this.contentType == null)
|
||||
this.contentType = new CodeType();
|
||||
this.contentType.setValue(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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Binary.content");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.content = new Base64BinaryType(); // bb
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public boolean hasContentElement() {
|
||||
return this.content != null && !this.content.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
return this.content != null && !this.content.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Binary setContentElement(Base64BinaryType value) {
|
||||
this.content = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The actual content, base64 encoded.
|
||||
*/
|
||||
public byte[] getContent() {
|
||||
return this.content == null ? null : this.content.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The actual content, base64 encoded.
|
||||
*/
|
||||
public Binary setContent(byte[] value) {
|
||||
if (this.content == null)
|
||||
this.content = new Base64BinaryType();
|
||||
this.content.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
}
|
||||
|
||||
public Binary copy() {
|
||||
Binary dst = new Binary();
|
||||
copyValues(dst);
|
||||
dst.contentType = contentType == null ? null : contentType.copy();
|
||||
dst.content = content == null ? null : content.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Binary typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Binary))
|
||||
return false;
|
||||
Binary o = (Binary) other;
|
||||
return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
|
||||
*/
|
||||
@ResourceDef(name="Binary", profile="http://hl7.org/fhir/Profile/Binary")
|
||||
public class Binary extends BaseBinary implements IBaseBinary {
|
||||
|
||||
/**
|
||||
* MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
@Child(name = "contentType", type = {CodeType.class}, order=0, min=1, max=1)
|
||||
@Description(shortDefinition="MimeType of the binary content", formalDefinition="MimeType of the binary content represented as a standard MimeType (BCP 13)." )
|
||||
protected CodeType contentType;
|
||||
|
||||
/**
|
||||
* The actual content, base64 encoded.
|
||||
*/
|
||||
@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;
|
||||
|
||||
private static final long serialVersionUID = 974764407L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Binary() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Binary(CodeType contentType, Base64BinaryType content) {
|
||||
super();
|
||||
this.contentType = contentType;
|
||||
this.content = 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
|
||||
*/
|
||||
public CodeType getContentTypeElement() {
|
||||
if (this.contentType == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Binary.contentType");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.contentType = new CodeType(); // bb
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
public boolean hasContentTypeElement() {
|
||||
return this.contentType != null && !this.contentType.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasContentType() {
|
||||
return this.contentType != null && !this.contentType.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Binary setContentTypeElement(CodeType value) {
|
||||
this.contentType = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
public String getContentType() {
|
||||
return this.contentType == null ? null : this.contentType.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value MimeType of the binary content represented as a standard MimeType (BCP 13).
|
||||
*/
|
||||
public Binary setContentType(String value) {
|
||||
if (this.contentType == null)
|
||||
this.contentType = new CodeType();
|
||||
this.contentType.setValue(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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Binary.content");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.content = new Base64BinaryType(); // bb
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public boolean hasContentElement() {
|
||||
return this.content != null && !this.content.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
return this.content != null && !this.content.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Binary setContentElement(Base64BinaryType value) {
|
||||
this.content = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The actual content, base64 encoded.
|
||||
*/
|
||||
public byte[] getContent() {
|
||||
return this.content == null ? null : this.content.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The actual content, base64 encoded.
|
||||
*/
|
||||
public Binary setContent(byte[] value) {
|
||||
if (this.content == null)
|
||||
this.content = new Base64BinaryType();
|
||||
this.content.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
}
|
||||
|
||||
public Binary copy() {
|
||||
Binary dst = new Binary();
|
||||
copyValues(dst);
|
||||
dst.contentType = contentType == null ? null : contentType.copy();
|
||||
dst.content = content == null ? null : content.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Binary typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Binary))
|
||||
return false;
|
||||
Binary o = (Binary) other;
|
||||
return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,448 +1,427 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ResourceDef(name="BodySite", profile="http://hl7.org/fhir/Profile/BodySite")
|
||||
public class BodySite extends DomainResource {
|
||||
|
||||
/**
|
||||
* The person to which the body site belongs.
|
||||
*/
|
||||
@Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1)
|
||||
@Description(shortDefinition="Patient", formalDefinition="The person to which the body site belongs." )
|
||||
protected Reference patient;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The person to which the body site belongs.)
|
||||
*/
|
||||
protected Patient patientTarget;
|
||||
|
||||
/**
|
||||
* Identifier for this instance of the anatomical location.
|
||||
*/
|
||||
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Bodysite identifier", formalDefinition="Identifier for this instance of the anatomical location." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* Named anatomical location - ideally would be coded where possible.
|
||||
*/
|
||||
@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." )
|
||||
protected CodeableConcept code;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* Description of anatomical location.
|
||||
*/
|
||||
@Child(name = "description", type = {StringType.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="The Description of anatomical location", formalDefinition="Description of anatomical location." )
|
||||
protected StringType description;
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Attachment> image;
|
||||
|
||||
private static final long serialVersionUID = 1568109920L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public BodySite() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public BodySite(Reference patient) {
|
||||
super();
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #patient} (The person to which the body site belongs.)
|
||||
*/
|
||||
public Reference getPatient() {
|
||||
if (this.patient == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.patient");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.patient = new Reference(); // cc
|
||||
return this.patient;
|
||||
}
|
||||
|
||||
public boolean hasPatient() {
|
||||
return this.patient != null && !this.patient.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #patient} (The person to which the body site belongs.)
|
||||
*/
|
||||
public BodySite setPatient(Reference value) {
|
||||
this.patient = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Patient getPatientTarget() {
|
||||
if (this.patientTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.patient");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.patientTarget = new Patient(); // aa
|
||||
return this.patientTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public BodySite setPatientTarget(Patient value) {
|
||||
this.patientTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #code} (Named anatomical location - ideally would be coded where possible.)
|
||||
*/
|
||||
public CodeableConcept getCode() {
|
||||
if (this.code == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeableConcept(); // cc
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #code} (Named anatomical location - ideally would be coded where possible.)
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<CodeableConcept> getModifier() {
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
return this.modifier;
|
||||
}
|
||||
|
||||
public boolean hasModifier() {
|
||||
if (this.modifier == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.modifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addModifier() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
this.modifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addModifier(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
this.modifier.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getDescriptionElement() {
|
||||
if (this.description == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.description");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.description = new StringType(); // bb
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean hasDescriptionElement() {
|
||||
return this.description != null && !this.description.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return this.description != null && !this.description.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public BodySite setDescriptionElement(StringType value) {
|
||||
this.description = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Description of anatomical location.
|
||||
*/
|
||||
public String getDescription() {
|
||||
return this.description == null ? null : this.description.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Description of anatomical location.
|
||||
*/
|
||||
public BodySite setDescription(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.description = null;
|
||||
else {
|
||||
if (this.description == null)
|
||||
this.description = new StringType();
|
||||
this.description.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
public List<Attachment> getImage() {
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
return this.image;
|
||||
}
|
||||
|
||||
public boolean hasImage() {
|
||||
if (this.image == null)
|
||||
return false;
|
||||
for (Attachment item : this.image)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addImage() { //3
|
||||
Attachment t = new Attachment();
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addImage(Attachment t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, java.lang.Integer.MAX_VALUE, patient));
|
||||
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));
|
||||
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));
|
||||
childrenList.add(new Property("description", "string", "Description of anatomical location.", 0, java.lang.Integer.MAX_VALUE, description));
|
||||
childrenList.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
|
||||
}
|
||||
|
||||
public BodySite copy() {
|
||||
BodySite dst = new BodySite();
|
||||
copyValues(dst);
|
||||
dst.patient = patient == null ? null : patient.copy();
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.code = code == null ? null : code.copy();
|
||||
if (modifier != null) {
|
||||
dst.modifier = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : modifier)
|
||||
dst.modifier.add(i.copy());
|
||||
};
|
||||
dst.description = description == null ? null : description.copy();
|
||||
if (image != null) {
|
||||
dst.image = new ArrayList<Attachment>();
|
||||
for (Attachment i : image)
|
||||
dst.image.add(i.copy());
|
||||
};
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected BodySite typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof BodySite))
|
||||
return false;
|
||||
BodySite o = (BodySite) other;
|
||||
return compareDeep(patient, o.patient, true) && compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
|
||||
&& compareDeep(modifier, o.modifier, true) && compareDeep(description, o.description, true) && compareDeep(image, o.image, true)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ResourceDef(name="BodySite", profile="http://hl7.org/fhir/Profile/BodySite")
|
||||
public class BodySite extends DomainResource {
|
||||
|
||||
/**
|
||||
* The person to which the body site belongs.
|
||||
*/
|
||||
@Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1)
|
||||
@Description(shortDefinition="Patient", formalDefinition="The person to which the body site belongs." )
|
||||
protected Reference patient;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The person to which the body site belongs.)
|
||||
*/
|
||||
protected Patient patientTarget;
|
||||
|
||||
/**
|
||||
* Identifier for this instance of the anatomical location.
|
||||
*/
|
||||
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Bodysite identifier", formalDefinition="Identifier for this instance of the anatomical location." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* Named anatomical location - ideally would be coded where possible.
|
||||
*/
|
||||
@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." )
|
||||
protected CodeableConcept code;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* Description of anatomical location.
|
||||
*/
|
||||
@Child(name = "description", type = {StringType.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="The Description of anatomical location", formalDefinition="Description of anatomical location." )
|
||||
protected StringType description;
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Attachment> image;
|
||||
|
||||
private static final long serialVersionUID = 1568109920L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public BodySite() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public BodySite(Reference patient) {
|
||||
super();
|
||||
this.patient = patient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #patient} (The person to which the body site belongs.)
|
||||
*/
|
||||
public Reference getPatient() {
|
||||
if (this.patient == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.patient");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.patient = new Reference(); // cc
|
||||
return this.patient;
|
||||
}
|
||||
|
||||
public boolean hasPatient() {
|
||||
return this.patient != null && !this.patient.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #patient} (The person to which the body site belongs.)
|
||||
*/
|
||||
public BodySite setPatient(Reference value) {
|
||||
this.patient = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Patient getPatientTarget() {
|
||||
if (this.patientTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.patient");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.patientTarget = new Patient(); // aa
|
||||
return this.patientTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public BodySite setPatientTarget(Patient value) {
|
||||
this.patientTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #code} (Named anatomical location - ideally would be coded where possible.)
|
||||
*/
|
||||
public CodeableConcept getCode() {
|
||||
if (this.code == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeableConcept(); // cc
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #code} (Named anatomical location - ideally would be coded where possible.)
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<CodeableConcept> getModifier() {
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
return this.modifier;
|
||||
}
|
||||
|
||||
public boolean hasModifier() {
|
||||
if (this.modifier == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.modifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addModifier() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
this.modifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addModifier(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifier == null)
|
||||
this.modifier = new ArrayList<CodeableConcept>();
|
||||
this.modifier.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getDescriptionElement() {
|
||||
if (this.description == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create BodySite.description");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.description = new StringType(); // bb
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean hasDescriptionElement() {
|
||||
return this.description != null && !this.description.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return this.description != null && !this.description.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public BodySite setDescriptionElement(StringType value) {
|
||||
this.description = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Description of anatomical location.
|
||||
*/
|
||||
public String getDescription() {
|
||||
return this.description == null ? null : this.description.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Description of anatomical location.
|
||||
*/
|
||||
public BodySite setDescription(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.description = null;
|
||||
else {
|
||||
if (this.description == null)
|
||||
this.description = new StringType();
|
||||
this.description.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
public List<Attachment> getImage() {
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
return this.image;
|
||||
}
|
||||
|
||||
public boolean hasImage() {
|
||||
if (this.image == null)
|
||||
return false;
|
||||
for (Attachment item : this.image)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addImage() { //3
|
||||
Attachment t = new Attachment();
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public BodySite addImage(Attachment t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, java.lang.Integer.MAX_VALUE, patient));
|
||||
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));
|
||||
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));
|
||||
childrenList.add(new Property("description", "string", "Description of anatomical location.", 0, java.lang.Integer.MAX_VALUE, description));
|
||||
childrenList.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
|
||||
}
|
||||
|
||||
public BodySite copy() {
|
||||
BodySite dst = new BodySite();
|
||||
copyValues(dst);
|
||||
dst.patient = patient == null ? null : patient.copy();
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.code = code == null ? null : code.copy();
|
||||
if (modifier != null) {
|
||||
dst.modifier = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : modifier)
|
||||
dst.modifier.add(i.copy());
|
||||
};
|
||||
dst.description = description == null ? null : description.copy();
|
||||
if (image != null) {
|
||||
dst.image = new ArrayList<Attachment>();
|
||||
for (Attachment i : image)
|
||||
dst.image.add(i.copy());
|
||||
};
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected BodySite typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof BodySite))
|
||||
return false;
|
||||
BodySite o = (BodySite) other;
|
||||
return compareDeep(patient, o.patient, true) && compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
|
||||
&& compareDeep(modifier, o.modifier, true) && compareDeep(description, o.description, true) && compareDeep(image, o.image, true)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
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="code", path="BodySite.code", description="Named anatomical location", type="token" )
|
||||
public static final String SP_CODE = "code";
|
||||
@SearchParamDefinition(name="patient", path="BodySite.patient", description="Patient to whom bodysite belongs", type="reference" )
|
||||
public static final String SP_PATIENT = "patient";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,107 +1,86 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
|
||||
|
||||
/**
|
||||
* Primitive type "boolean" in FHIR "true" or "false"
|
||||
*/
|
||||
@DatatypeDef(name="boolean")
|
||||
public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanDatatype {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
public BooleanType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BooleanType(boolean theBoolean) {
|
||||
super();
|
||||
setValue(theBoolean);
|
||||
}
|
||||
|
||||
public BooleanType(Boolean theBoolean) {
|
||||
super();
|
||||
setValue(theBoolean);
|
||||
}
|
||||
|
||||
public BooleanType(String value) {
|
||||
super();
|
||||
setValueAsString(value);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
|
||||
|
||||
/**
|
||||
* Primitive type "boolean" in FHIR "true" or "false"
|
||||
*/
|
||||
@DatatypeDef(name="boolean")
|
||||
public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanDatatype {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
public BooleanType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BooleanType(boolean theBoolean) {
|
||||
super();
|
||||
setValue(theBoolean);
|
||||
}
|
||||
|
||||
public BooleanType(Boolean theBoolean) {
|
||||
super();
|
||||
setValue(theBoolean);
|
||||
}
|
||||
|
||||
public BooleanType(String value) {
|
||||
super();
|
||||
setValueAsString(value);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,94 +1,73 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
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 static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Primitive type "code" in FHIR, when not bound to an enumerated list of codes
|
||||
*/
|
||||
@DatatypeDef(name="code")
|
||||
public class CodeType extends PrimitiveType<String> implements Comparable<CodeType> {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
public CodeType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CodeType(String theCode) {
|
||||
setValue(theCode);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Primitive type "code" in FHIR, when not bound to an enumerated list of codes
|
||||
*/
|
||||
@DatatypeDef(name="code")
|
||||
public class CodeType extends PrimitiveType<String> implements Comparable<CodeType> {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
public CodeType() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CodeType(String theCode) {
|
||||
setValue(theCode);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,230 +1,209 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
|
||||
*/
|
||||
@DatatypeDef(name="CodeableConcept")
|
||||
public class CodeableConcept extends Type implements ICompositeType {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Coding> 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.
|
||||
*/
|
||||
@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." )
|
||||
protected StringType text;
|
||||
|
||||
private static final long serialVersionUID = 760353246L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public CodeableConcept() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #coding} (A reference to a code defined by a terminology system.)
|
||||
*/
|
||||
public List<Coding> getCoding() {
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
return this.coding;
|
||||
}
|
||||
|
||||
public boolean hasCoding() {
|
||||
if (this.coding == null)
|
||||
return false;
|
||||
for (Coding item : this.coding)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #coding} (A reference to a code defined by a terminology system.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Coding addCoding() { //3
|
||||
Coding t = new Coding();
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
this.coding.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public CodeableConcept addCoding(Coding t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
this.coding.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getTextElement() {
|
||||
if (this.text == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create CodeableConcept.text");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.text = new StringType(); // bb
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean hasTextElement() {
|
||||
return this.text != null && !this.text.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return this.text != null && !this.text.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public CodeableConcept setTextElement(StringType value) {
|
||||
this.text = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
public String getText() {
|
||||
return this.text == null ? null : this.text.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 CodeableConcept setText(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.text = null;
|
||||
else {
|
||||
if (this.text == null)
|
||||
this.text = new StringType();
|
||||
this.text.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public CodeableConcept copy() {
|
||||
CodeableConcept dst = new CodeableConcept();
|
||||
copyValues(dst);
|
||||
if (coding != null) {
|
||||
dst.coding = new ArrayList<Coding>();
|
||||
for (Coding i : coding)
|
||||
dst.coding.add(i.copy());
|
||||
};
|
||||
dst.text = text == null ? null : text.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected CodeableConcept typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
|
||||
*/
|
||||
@DatatypeDef(name="CodeableConcept")
|
||||
public class CodeableConcept extends Type implements ICompositeType {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Coding> 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.
|
||||
*/
|
||||
@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." )
|
||||
protected StringType text;
|
||||
|
||||
private static final long serialVersionUID = 760353246L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public CodeableConcept() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #coding} (A reference to a code defined by a terminology system.)
|
||||
*/
|
||||
public List<Coding> getCoding() {
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
return this.coding;
|
||||
}
|
||||
|
||||
public boolean hasCoding() {
|
||||
if (this.coding == null)
|
||||
return false;
|
||||
for (Coding item : this.coding)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #coding} (A reference to a code defined by a terminology system.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Coding addCoding() { //3
|
||||
Coding t = new Coding();
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
this.coding.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public CodeableConcept addCoding(Coding t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.coding == null)
|
||||
this.coding = new ArrayList<Coding>();
|
||||
this.coding.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getTextElement() {
|
||||
if (this.text == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create CodeableConcept.text");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.text = new StringType(); // bb
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean hasTextElement() {
|
||||
return this.text != null && !this.text.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return this.text != null && !this.text.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public CodeableConcept setTextElement(StringType value) {
|
||||
this.text = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
public String getText() {
|
||||
return this.text == null ? null : this.text.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 CodeableConcept setText(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.text = null;
|
||||
else {
|
||||
if (this.text == null)
|
||||
this.text = new StringType();
|
||||
this.text.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public CodeableConcept copy() {
|
||||
CodeableConcept dst = new CodeableConcept();
|
||||
copyValues(dst);
|
||||
if (coding != null) {
|
||||
dst.coding = new ArrayList<Coding>();
|
||||
for (Coding i : coding)
|
||||
dst.coding.add(i.copy());
|
||||
};
|
||||
dst.text = text == null ? null : text.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected CodeableConcept typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,408 +1,387 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A reference to a code defined by a terminology system.
|
||||
*/
|
||||
@DatatypeDef(name="Coding")
|
||||
public class Coding extends Type implements IBaseCoding, ICompositeType {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected UriType system;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Child(name = "version", type = {StringType.class}, order=1, 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." )
|
||||
protected StringType version;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
|
||||
*/
|
||||
@Child(name = "primary", type = {BooleanType.class}, order=4, min=0, max=1)
|
||||
@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 BooleanType primary;
|
||||
|
||||
private static final long serialVersionUID = 2019442517L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Coding() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 UriType getSystemElement() {
|
||||
if (this.system == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.system");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.system = new UriType(); // bb
|
||||
return this.system;
|
||||
}
|
||||
|
||||
public boolean hasSystemElement() {
|
||||
return this.system != null && !this.system.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasSystem() {
|
||||
return this.system != null && !this.system.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setSystemElement(UriType value) {
|
||||
this.system = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The identification of the code system that defines the meaning of the symbol in the code.
|
||||
*/
|
||||
public String getSystem() {
|
||||
return this.system == null ? null : this.system.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The identification of the code system that defines the meaning of the symbol in the code.
|
||||
*/
|
||||
public Coding setSystem(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.system = null;
|
||||
else {
|
||||
if (this.system == null)
|
||||
this.system = new UriType();
|
||||
this.system.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getVersionElement() {
|
||||
if (this.version == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.version");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.version = new StringType(); // bb
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean hasVersionElement() {
|
||||
return this.version != null && !this.version.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasVersion() {
|
||||
return this.version != null && !this.version.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setVersionElement(StringType value) {
|
||||
this.version = value;
|
||||
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.
|
||||
*/
|
||||
public String getVersion() {
|
||||
return this.version == null ? null : this.version.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setVersion(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.version = null;
|
||||
else {
|
||||
if (this.version == null)
|
||||
this.version = new StringType();
|
||||
this.version.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 CodeType getCodeElement() {
|
||||
if (this.code == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeType(); // bb
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCodeElement() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setCodeElement(CodeType value) {
|
||||
this.code = value;
|
||||
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).
|
||||
*/
|
||||
public String getCode() {
|
||||
return this.code == null ? null : this.code.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setCode(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.code = null;
|
||||
else {
|
||||
if (this.code == null)
|
||||
this.code = new CodeType();
|
||||
this.code.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getDisplayElement() {
|
||||
if (this.display == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.display");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.display = new StringType(); // bb
|
||||
return this.display;
|
||||
}
|
||||
|
||||
public boolean hasDisplayElement() {
|
||||
return this.display != null && !this.display.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDisplay() {
|
||||
return this.display != null && !this.display.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setDisplayElement(StringType value) {
|
||||
this.display = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A representation of the meaning of the code in the system, following the rules of the system.
|
||||
*/
|
||||
public String getDisplay() {
|
||||
return this.display == null ? null : this.display.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value A representation of the meaning of the code in the system, following the rules of the system.
|
||||
*/
|
||||
public Coding setDisplay(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.display = null;
|
||||
else {
|
||||
if (this.display == null)
|
||||
this.display = new StringType();
|
||||
this.display.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 BooleanType getPrimaryElement() {
|
||||
if (this.primary == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.primary");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.primary = new BooleanType(); // bb
|
||||
return this.primary;
|
||||
}
|
||||
|
||||
public boolean hasPrimaryElement() {
|
||||
return this.primary != null && !this.primary.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasPrimary() {
|
||||
return this.primary != null && !this.primary.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setPrimaryElement(BooleanType value) {
|
||||
this.primary = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
|
||||
*/
|
||||
public boolean getPrimary() {
|
||||
return this.primary == null || this.primary.isEmpty() ? false : this.primary.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setPrimary(boolean value) {
|
||||
if (this.primary == null)
|
||||
this.primary = new BooleanType();
|
||||
this.primary.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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 Coding copy() {
|
||||
Coding dst = new Coding();
|
||||
copyValues(dst);
|
||||
dst.system = system == null ? null : system.copy();
|
||||
dst.version = version == null ? null : version.copy();
|
||||
dst.code = code == null ? null : code.copy();
|
||||
dst.display = display == null ? null : display.copy();
|
||||
dst.primary = primary == null ? null : primary.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Coding typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A reference to a code defined by a terminology system.
|
||||
*/
|
||||
@DatatypeDef(name="Coding")
|
||||
public class Coding extends Type implements IBaseCoding, ICompositeType {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected UriType system;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Child(name = "version", type = {StringType.class}, order=1, 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." )
|
||||
protected StringType version;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
|
||||
*/
|
||||
@Child(name = "primary", type = {BooleanType.class}, order=4, min=0, max=1)
|
||||
@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 BooleanType primary;
|
||||
|
||||
private static final long serialVersionUID = 2019442517L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Coding() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 UriType getSystemElement() {
|
||||
if (this.system == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.system");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.system = new UriType(); // bb
|
||||
return this.system;
|
||||
}
|
||||
|
||||
public boolean hasSystemElement() {
|
||||
return this.system != null && !this.system.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasSystem() {
|
||||
return this.system != null && !this.system.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setSystemElement(UriType value) {
|
||||
this.system = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The identification of the code system that defines the meaning of the symbol in the code.
|
||||
*/
|
||||
public String getSystem() {
|
||||
return this.system == null ? null : this.system.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The identification of the code system that defines the meaning of the symbol in the code.
|
||||
*/
|
||||
public Coding setSystem(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.system = null;
|
||||
else {
|
||||
if (this.system == null)
|
||||
this.system = new UriType();
|
||||
this.system.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getVersionElement() {
|
||||
if (this.version == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.version");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.version = new StringType(); // bb
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean hasVersionElement() {
|
||||
return this.version != null && !this.version.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasVersion() {
|
||||
return this.version != null && !this.version.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setVersionElement(StringType value) {
|
||||
this.version = value;
|
||||
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.
|
||||
*/
|
||||
public String getVersion() {
|
||||
return this.version == null ? null : this.version.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setVersion(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.version = null;
|
||||
else {
|
||||
if (this.version == null)
|
||||
this.version = new StringType();
|
||||
this.version.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 CodeType getCodeElement() {
|
||||
if (this.code == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.code");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.code = new CodeType(); // bb
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public boolean hasCodeElement() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return this.code != null && !this.code.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setCodeElement(CodeType value) {
|
||||
this.code = value;
|
||||
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).
|
||||
*/
|
||||
public String getCode() {
|
||||
return this.code == null ? null : this.code.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setCode(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.code = null;
|
||||
else {
|
||||
if (this.code == null)
|
||||
this.code = new CodeType();
|
||||
this.code.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 StringType getDisplayElement() {
|
||||
if (this.display == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.display");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.display = new StringType(); // bb
|
||||
return this.display;
|
||||
}
|
||||
|
||||
public boolean hasDisplayElement() {
|
||||
return this.display != null && !this.display.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDisplay() {
|
||||
return this.display != null && !this.display.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setDisplayElement(StringType value) {
|
||||
this.display = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A representation of the meaning of the code in the system, following the rules of the system.
|
||||
*/
|
||||
public String getDisplay() {
|
||||
return this.display == null ? null : this.display.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value A representation of the meaning of the code in the system, following the rules of the system.
|
||||
*/
|
||||
public Coding setDisplay(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.display = null;
|
||||
else {
|
||||
if (this.display == null)
|
||||
this.display = new StringType();
|
||||
this.display.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 BooleanType getPrimaryElement() {
|
||||
if (this.primary == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Coding.primary");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.primary = new BooleanType(); // bb
|
||||
return this.primary;
|
||||
}
|
||||
|
||||
public boolean hasPrimaryElement() {
|
||||
return this.primary != null && !this.primary.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasPrimary() {
|
||||
return this.primary != null && !this.primary.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Coding setPrimaryElement(BooleanType value) {
|
||||
this.primary = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
|
||||
*/
|
||||
public boolean getPrimary() {
|
||||
return this.primary == null || this.primary.isEmpty() ? false : this.primary.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Coding setPrimary(boolean value) {
|
||||
if (this.primary == null)
|
||||
this.primary = new BooleanType();
|
||||
this.primary.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
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));
|
||||
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 Coding copy() {
|
||||
Coding dst = new Coding();
|
||||
copyValues(dst);
|
||||
dst.system = system == null ? null : system.copy();
|
||||
dst.version = version == null ? null : version.copy();
|
||||
dst.code = code == null ? null : code.copy();
|
||||
dst.display = display == null ? null : display.copy();
|
||||
dst.primary = primary == null ? null : primary.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Coding typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,129 +1,108 @@
|
|||
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 java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
/**
|
||||
* See http://www.healthintersections.com.au/?p=1941
|
||||
*
|
||||
* @author Grahame
|
||||
*
|
||||
*/
|
||||
public class Comparison {
|
||||
|
||||
public class MatchProfile {
|
||||
|
||||
}
|
||||
|
||||
public static boolean matches(String c1, String c2, MatchProfile profile) {
|
||||
if (Utilities.noString(c1) || Utilities.noString(c2))
|
||||
return false;
|
||||
c1 = Utilities.normalize(c1);
|
||||
c2 = Utilities.normalize(c2);
|
||||
return c1.equals(c2);
|
||||
}
|
||||
|
||||
public static <T extends Enum<?>> boolean matches(Enumeration<T> e1, Enumeration<T> e2, MatchProfile profile) {
|
||||
if (e1 == null || e2 == null)
|
||||
return false;
|
||||
return e1.getValue().equals(e2.getValue());
|
||||
}
|
||||
|
||||
public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) {
|
||||
return matches(c1.getText(), c2.getText(), null);
|
||||
} else {
|
||||
// in the absence of specific guidance, we just require that all codes match
|
||||
boolean ok = true;
|
||||
for (Coding c : c1.getCoding()) {
|
||||
ok = ok && inList(c2.getCoding(), c, null);
|
||||
}
|
||||
for (Coding c : c2.getCoding()) {
|
||||
ok = ok && inList(c1.getCoding(), c, null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
public static void merge(CodeableConcept dst, CodeableConcept src) {
|
||||
if (dst.getTextElement() == null && src.getTextElement() != null)
|
||||
dst.setTextElement(src.getTextElement());
|
||||
}
|
||||
|
||||
|
||||
public static boolean inList(List<Coding> list, Coding c, MatchProfile profile) throws Exception {
|
||||
for (Coding item : list) {
|
||||
if (matches(item, c, profile))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean matches(Coding c1, Coding c2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
// 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(Identifier i1, Identifier i2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
// 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(Identifier dst, Identifier src) {
|
||||
if (dst.getUseElement() == null && src.getUseElement() != null)
|
||||
dst.setUseElement(src.getUseElement());
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
/**
|
||||
* See http://www.healthintersections.com.au/?p=1941
|
||||
*
|
||||
* @author Grahame
|
||||
*
|
||||
*/
|
||||
public class Comparison {
|
||||
|
||||
public class MatchProfile {
|
||||
|
||||
}
|
||||
|
||||
public static boolean matches(String c1, String c2, MatchProfile profile) {
|
||||
if (Utilities.noString(c1) || Utilities.noString(c2))
|
||||
return false;
|
||||
c1 = Utilities.normalize(c1);
|
||||
c2 = Utilities.normalize(c2);
|
||||
return c1.equals(c2);
|
||||
}
|
||||
|
||||
public static <T extends Enum<?>> boolean matches(Enumeration<T> e1, Enumeration<T> e2, MatchProfile profile) {
|
||||
if (e1 == null || e2 == null)
|
||||
return false;
|
||||
return e1.getValue().equals(e2.getValue());
|
||||
}
|
||||
|
||||
public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) {
|
||||
return matches(c1.getText(), c2.getText(), null);
|
||||
} else {
|
||||
// in the absence of specific guidance, we just require that all codes match
|
||||
boolean ok = true;
|
||||
for (Coding c : c1.getCoding()) {
|
||||
ok = ok && inList(c2.getCoding(), c, null);
|
||||
}
|
||||
for (Coding c : c2.getCoding()) {
|
||||
ok = ok && inList(c1.getCoding(), c, null);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
public static void merge(CodeableConcept dst, CodeableConcept src) {
|
||||
if (dst.getTextElement() == null && src.getTextElement() != null)
|
||||
dst.setTextElement(src.getTextElement());
|
||||
}
|
||||
|
||||
|
||||
public static boolean inList(List<Coding> list, Coding c, MatchProfile profile) throws Exception {
|
||||
for (Coding item : list) {
|
||||
if (matches(item, c, profile))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean matches(Coding c1, Coding c2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
// 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(Identifier i1, Identifier i2, MatchProfile profile) throws Exception {
|
||||
if (profile != null)
|
||||
throw new Exception("Not Implemented Yet");
|
||||
|
||||
// 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(Identifier dst, Identifier src) {
|
||||
if (dst.getUseElement() == null && src.getUseElement() != null)
|
||||
dst.setUseElement(src.getUseElement());
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,127 +1,106 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is created to help implementers deal with a change to
|
||||
* the API that was made between versions 0.81 and 0.9
|
||||
*
|
||||
* The change is the behaviour of the .getX() where the cardinality of
|
||||
* x is 0..1 or 1..1. Before the change, these routines would return
|
||||
* null if the object had not previously been assigned, and after the '
|
||||
* change, they will automatically create the object if it had not
|
||||
* been assigned (unless the object is polymorphic, in which case,
|
||||
* only the type specific getters create the object)
|
||||
*
|
||||
* When making the transition from the old style to the new style,
|
||||
* the main change is that when testing for presence or abssense
|
||||
* of the element, instead of doing one of these two:
|
||||
*
|
||||
* if (obj.getProperty() == null)
|
||||
* if (obj.getProperty() != null)
|
||||
*
|
||||
* you instead do
|
||||
*
|
||||
* if (!obj.hasProperty())
|
||||
* if (obj.hasProperty())
|
||||
*
|
||||
* or else one of these two:
|
||||
*
|
||||
* if (obj.getProperty().isEmpty())
|
||||
* if (!obj.getProperty().isEmpty())
|
||||
*
|
||||
* The only way to sort this out is by finding all these things
|
||||
* in the code, and changing them.
|
||||
*
|
||||
* To help with that, you can set the status field of this class
|
||||
* to change how this API behaves. Note: the status value is tied
|
||||
* to the way that you program. The intent of this class is to
|
||||
* help make developers the transiition to status = 0. The old
|
||||
* 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
|
||||
* raised instead. The expected use of this is:
|
||||
* - set status = 1
|
||||
* - test your code (all paths)
|
||||
* - when an exception happens, change the code to use .hasX() or .isEmpty()
|
||||
* - when all execution paths don't raise an exception, set status = 0
|
||||
* - start programming to the new style.
|
||||
*
|
||||
* You can set status = 2 and leave it like that, but this is not
|
||||
* 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
|
||||
* 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
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class is created to help implementers deal with a change to
|
||||
* the API that was made between versions 0.81 and 0.9
|
||||
*
|
||||
* The change is the behaviour of the .getX() where the cardinality of
|
||||
* x is 0..1 or 1..1. Before the change, these routines would return
|
||||
* null if the object had not previously been assigned, and after the '
|
||||
* change, they will automatically create the object if it had not
|
||||
* been assigned (unless the object is polymorphic, in which case,
|
||||
* only the type specific getters create the object)
|
||||
*
|
||||
* When making the transition from the old style to the new style,
|
||||
* the main change is that when testing for presence or abssense
|
||||
* of the element, instead of doing one of these two:
|
||||
*
|
||||
* if (obj.getProperty() == null)
|
||||
* if (obj.getProperty() != null)
|
||||
*
|
||||
* you instead do
|
||||
*
|
||||
* if (!obj.hasProperty())
|
||||
* if (obj.hasProperty())
|
||||
*
|
||||
* or else one of these two:
|
||||
*
|
||||
* if (obj.getProperty().isEmpty())
|
||||
* if (!obj.getProperty().isEmpty())
|
||||
*
|
||||
* The only way to sort this out is by finding all these things
|
||||
* in the code, and changing them.
|
||||
*
|
||||
* To help with that, you can set the status field of this class
|
||||
* to change how this API behaves. Note: the status value is tied
|
||||
* to the way that you program. The intent of this class is to
|
||||
* help make developers the transiition to status = 0. The old
|
||||
* 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
|
||||
* raised instead. The expected use of this is:
|
||||
* - set status = 1
|
||||
* - test your code (all paths)
|
||||
* - when an exception happens, change the code to use .hasX() or .isEmpty()
|
||||
* - when all execution paths don't raise an exception, set status = 0
|
||||
* - start programming to the new style.
|
||||
*
|
||||
* You can set status = 2 and leave it like that, but this is not
|
||||
* 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
|
||||
* 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
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,61 +1,40 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// 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";
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
|
||||
public class Constants {
|
||||
|
||||
public final static String VERSION = "0.5.0";
|
||||
public final static String REVISION = "5283";
|
||||
public final static String DATE = "Fri May 22 17:15:32 EDT 2015";
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,111 +1,90 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Count")
|
||||
public class Count extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Count copy() {
|
||||
Count dst = new Count();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Count typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Count")
|
||||
public class Count extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Count copy() {
|
||||
Count dst = new Count();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Count typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,213 +1,192 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
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 java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.zip.DataFormatException;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Represents a FHIR dateTime datatype. Valid precisions values for this type are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*/
|
||||
@DatatypeDef(name = "dateTime")
|
||||
public class DateTimeType extends BaseDateTimeType {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* The default precision for this type
|
||||
*/
|
||||
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateTimeType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DateTimeDt with seconds precision and the local time zone
|
||||
*/
|
||||
public DateTimeType(Date theDate) {
|
||||
super(theDate, DEFAULT_PRECISION, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*
|
||||
* @throws DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) {
|
||||
super(theDate, thePrecision, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance using a string date/time
|
||||
*
|
||||
* @throws DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateTimeType(String theValue) {
|
||||
super(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type
|
||||
* are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*/
|
||||
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) {
|
||||
super(theDate, thePrecision, theTimezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateTimeType(Calendar theCalendar) {
|
||||
if (theCalendar != null) {
|
||||
setValue(theCalendar.getTime());
|
||||
setPrecision(DEFAULT_PRECISION);
|
||||
setTimeZone(theCalendar.getTimeZone());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
case YEAR:
|
||||
case MONTH:
|
||||
case DAY:
|
||||
case SECOND:
|
||||
case MILLI:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of DateTimeType with the current system time and SECOND precision and the system local time
|
||||
* zone
|
||||
*/
|
||||
public static DateTimeType now() {
|
||||
return new DateTimeType(new Date(), TemporalPrecisionEnum.SECOND, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@Override
|
||||
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
|
||||
return DEFAULT_PRECISION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DateTimeType copy() {
|
||||
return new DateTimeType(getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance by parsing an HL7 v3 format date time string
|
||||
*/
|
||||
public static DateTimeType parseV3(String theV3String) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.zip.DataFormatException;
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Represents a FHIR dateTime datatype. Valid precisions values for this type are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*/
|
||||
@DatatypeDef(name = "dateTime")
|
||||
public class DateTimeType extends BaseDateTimeType {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* The default precision for this type
|
||||
*/
|
||||
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateTimeType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DateTimeDt with seconds precision and the local time zone
|
||||
*/
|
||||
public DateTimeType(Date theDate) {
|
||||
super(theDate, DEFAULT_PRECISION, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*
|
||||
* @throws DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) {
|
||||
super(theDate, thePrecision, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance using a string date/time
|
||||
*
|
||||
* @throws DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateTimeType(String theValue) {
|
||||
super(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type
|
||||
* are:
|
||||
* <ul>
|
||||
* <li>{@link TemporalPrecisionEnum#YEAR}
|
||||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* <li>{@link TemporalPrecisionEnum#SECOND}
|
||||
* <li>{@link TemporalPrecisionEnum#MILLI}
|
||||
* </ul>
|
||||
*/
|
||||
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) {
|
||||
super(theDate, thePrecision, theTimezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateTimeType(Calendar theCalendar) {
|
||||
if (theCalendar != null) {
|
||||
setValue(theCalendar.getTime());
|
||||
setPrecision(DEFAULT_PRECISION);
|
||||
setTimeZone(theCalendar.getTimeZone());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
case YEAR:
|
||||
case MONTH:
|
||||
case DAY:
|
||||
case SECOND:
|
||||
case MILLI:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of DateTimeType with the current system time and SECOND precision and the system local time
|
||||
* zone
|
||||
*/
|
||||
public static DateTimeType now() {
|
||||
return new DateTimeType(new Date(), TemporalPrecisionEnum.SECOND, TimeZone.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@Override
|
||||
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
|
||||
return DEFAULT_PRECISION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DateTimeType copy() {
|
||||
return new DateTimeType(getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance by parsing an HL7 v3 format date time string
|
||||
*/
|
||||
public static DateTimeType parseV3(String theV3String) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,159 +1,138 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
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%
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Primitive type "date" in FHIR: any day in a gregorian calendar
|
||||
*/
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Represents a FHIR date datatype. Valid precisions values for this type are:
|
||||
* <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}
|
||||
* </ul>
|
||||
*/
|
||||
@DatatypeDef(name = "date")
|
||||
public class DateType extends BaseDateTimeType {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* The default precision for this type
|
||||
*/
|
||||
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type
|
||||
*/
|
||||
public DateType(Date theDate) {
|
||||
super(theDate, DEFAULT_PRECISION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
|
||||
* <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}
|
||||
* </ul>
|
||||
*
|
||||
* @throws ca.uhn.fhir.parser.DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateType(Date theDate, TemporalPrecisionEnum thePrecision) {
|
||||
super(theDate, thePrecision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date as a string in FHIR format
|
||||
*
|
||||
* @throws ca.uhn.fhir.parser.DataFormatException
|
||||
* If the precision in the date string is not allowed for this type
|
||||
*/
|
||||
public DateType(String theDate) {
|
||||
super(theDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
case YEAR:
|
||||
case MONTH:
|
||||
case DAY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/**
|
||||
* Primitive type "date" in FHIR: any day in a gregorian calendar
|
||||
*/
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Represents a FHIR date datatype. Valid precisions values for this type are:
|
||||
* <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}
|
||||
* </ul>
|
||||
*/
|
||||
@DatatypeDef(name = "date")
|
||||
public class DateType extends BaseDateTimeType {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* The default precision for this type
|
||||
*/
|
||||
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type
|
||||
*/
|
||||
public DateType(Date theDate) {
|
||||
super(theDate, DEFAULT_PRECISION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
|
||||
* <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}
|
||||
* </ul>
|
||||
*
|
||||
* @throws ca.uhn.fhir.parser.DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
*/
|
||||
public DateType(Date theDate, TemporalPrecisionEnum thePrecision) {
|
||||
super(theDate, thePrecision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date as a string in FHIR format
|
||||
*
|
||||
* @throws ca.uhn.fhir.parser.DataFormatException
|
||||
* If the precision in the date string is not allowed for this type
|
||||
*/
|
||||
public DateType(String theDate) {
|
||||
super(theDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
case YEAR:
|
||||
case MONTH:
|
||||
case DAY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,179 +1,158 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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 java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
|
||||
|
||||
/**
|
||||
* Primitive type "decimal" in FHIR: A rational number
|
||||
*/
|
||||
@DatatypeDef(name = "decimal")
|
||||
public class DecimalType extends PrimitiveType<BigDecimal> implements Comparable<DecimalType>, IBaseDecimalDatatype {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(BigDecimal theValue) {
|
||||
setValue(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(double theValue) {
|
||||
// Use the valueOf here because the constructor gives wacky precision
|
||||
// changes due to the floating point conversion
|
||||
setValue(BigDecimal.valueOf(theValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(long theValue) {
|
||||
setValue(new BigDecimal(theValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(String theValue) {
|
||||
setValue(new BigDecimal(theValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(DecimalType theObj) {
|
||||
if (getValue() == null && theObj.getValue() == null) {
|
||||
return 0;
|
||||
}
|
||||
if (getValue() != null && theObj.getValue() == null) {
|
||||
return 1;
|
||||
}
|
||||
if (getValue() == null && theObj.getValue() != null) {
|
||||
return -1;
|
||||
}
|
||||
return getValue().compareTo(theObj.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String encode(BigDecimal theValue) {
|
||||
return getValue().toPlainString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value as an integer, using {@link BigDecimal#intValue()}
|
||||
*/
|
||||
public int getValueAsInteger() {
|
||||
return getValue().intValue();
|
||||
}
|
||||
|
||||
public Number getValueAsNumber() {
|
||||
return getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BigDecimal parse(String theValue) {
|
||||
return new BigDecimal(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds the value to the given prevision
|
||||
*
|
||||
* @see MathContext#getPrecision()
|
||||
*/
|
||||
public void round(int thePrecision) {
|
||||
if (getValue() != null) {
|
||||
BigDecimal newValue = getValue().round(new MathContext(thePrecision));
|
||||
setValue(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds the value to the given prevision
|
||||
*
|
||||
* @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());
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
|
||||
|
||||
/**
|
||||
* Primitive type "decimal" in FHIR: A rational number
|
||||
*/
|
||||
@DatatypeDef(name = "decimal")
|
||||
public class DecimalType extends PrimitiveType<BigDecimal> implements Comparable<DecimalType>, IBaseDecimalDatatype {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(BigDecimal theValue) {
|
||||
setValue(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(double theValue) {
|
||||
// Use the valueOf here because the constructor gives wacky precision
|
||||
// changes due to the floating point conversion
|
||||
setValue(BigDecimal.valueOf(theValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(long theValue) {
|
||||
setValue(new BigDecimal(theValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DecimalType(String theValue) {
|
||||
setValue(new BigDecimal(theValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(DecimalType theObj) {
|
||||
if (getValue() == null && theObj.getValue() == null) {
|
||||
return 0;
|
||||
}
|
||||
if (getValue() != null && theObj.getValue() == null) {
|
||||
return 1;
|
||||
}
|
||||
if (getValue() == null && theObj.getValue() != null) {
|
||||
return -1;
|
||||
}
|
||||
return getValue().compareTo(theObj.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String encode(BigDecimal theValue) {
|
||||
return getValue().toPlainString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value as an integer, using {@link BigDecimal#intValue()}
|
||||
*/
|
||||
public int getValueAsInteger() {
|
||||
return getValue().intValue();
|
||||
}
|
||||
|
||||
public Number getValueAsNumber() {
|
||||
return getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BigDecimal parse(String theValue) {
|
||||
return new BigDecimal(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds the value to the given prevision
|
||||
*
|
||||
* @see MathContext#getPrecision()
|
||||
*/
|
||||
public void round(int thePrecision) {
|
||||
if (getValue() != null) {
|
||||
BigDecimal newValue = getValue().round(new MathContext(thePrecision));
|
||||
setValue(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds the value to the given prevision
|
||||
*
|
||||
* @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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,111 +1,90 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Distance")
|
||||
public class Distance extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Distance copy() {
|
||||
Distance dst = new Distance();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Distance typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Distance")
|
||||
public class Distance extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Distance copy() {
|
||||
Distance dst = new Distance();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Distance typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,287 +1,266 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A resource that includes narrative, extensions, and contained resources.
|
||||
*/
|
||||
public abstract class DomainResource extends Resource implements IBaseHasExtensions, IBaseHasModifierExtensions, IDomainResource {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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 = "modifierExtension", type = {Extension.class}, order=3, 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 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 List<Extension> modifierExtension;
|
||||
|
||||
private static final long serialVersionUID = -970285559L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public DomainResource() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DomainResource.text");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.text = new Narrative(); // cc
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return this.text != null && !this.text.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.)
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<Resource> getContained() {
|
||||
if (this.contained == null)
|
||||
this.contained = new ArrayList<Resource>();
|
||||
return this.contained;
|
||||
}
|
||||
|
||||
public boolean hasContained() {
|
||||
if (this.contained == null)
|
||||
return false;
|
||||
for (Resource item : this.contained)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DomainResource addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
return this.modifierExtension;
|
||||
}
|
||||
|
||||
public boolean hasModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
return false;
|
||||
for (Extension item : this.modifierExtension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 addModifierExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DomainResource addModifierExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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();
|
||||
|
||||
public void copyValues(DomainResource dst) {
|
||||
dst.text = text == null ? null : text.copy();
|
||||
if (contained != null) {
|
||||
dst.contained = new ArrayList<Resource>();
|
||||
for (Resource i : contained)
|
||||
dst.contained.add(i.copy());
|
||||
};
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
dst.modifierExtension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* A resource that includes narrative, extensions, and contained resources.
|
||||
*/
|
||||
public abstract class DomainResource extends Resource implements IBaseHasExtensions, IBaseHasModifierExtensions, IDomainResource {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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 = "modifierExtension", type = {Extension.class}, order=3, 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 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 List<Extension> modifierExtension;
|
||||
|
||||
private static final long serialVersionUID = -970285559L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public DomainResource() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DomainResource.text");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.text = new Narrative(); // cc
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return this.text != null && !this.text.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.)
|
||||
*/
|
||||
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.)
|
||||
*/
|
||||
public List<Resource> getContained() {
|
||||
if (this.contained == null)
|
||||
this.contained = new ArrayList<Resource>();
|
||||
return this.contained;
|
||||
}
|
||||
|
||||
public boolean hasContained() {
|
||||
if (this.contained == null)
|
||||
return false;
|
||||
for (Resource item : this.contained)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DomainResource addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
return this.modifierExtension;
|
||||
}
|
||||
|
||||
public boolean hasModifierExtension() {
|
||||
if (this.modifierExtension == null)
|
||||
return false;
|
||||
for (Extension item : this.modifierExtension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 addModifierExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DomainResource addModifierExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.modifierExtension == null)
|
||||
this.modifierExtension = new ArrayList<Extension>();
|
||||
this.modifierExtension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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();
|
||||
|
||||
public void copyValues(DomainResource dst) {
|
||||
dst.text = text == null ? null : text.copy();
|
||||
if (contained != null) {
|
||||
dst.contained = new ArrayList<Resource>();
|
||||
for (Resource i : contained)
|
||||
dst.contained.add(i.copy());
|
||||
};
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
dst.modifierExtension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,111 +1,90 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Duration")
|
||||
public class Duration extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Duration copy() {
|
||||
Duration dst = new Duration();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Duration typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@DatatypeDef(name="Duration")
|
||||
public class Duration extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
|
||||
public Duration copy() {
|
||||
Duration dst = new Duration();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
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();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Duration typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,223 +1,202 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* Base definition for all elements in a resource.
|
||||
*/
|
||||
public abstract class Element extends Base implements IBaseHasExtensions {
|
||||
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, 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 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 List<Extension> extension;
|
||||
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 IdType getIdElement() {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
this.id = new IdType();
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
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 abstract Element copy();
|
||||
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* Base definition for all elements in a resource.
|
||||
*/
|
||||
public abstract class Element extends Base implements IBaseHasExtensions {
|
||||
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, 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 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 List<Extension> extension;
|
||||
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 IdType getIdElement() {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
this.id = new IdType();
|
||||
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.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
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));
|
||||
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 abstract Element copy();
|
||||
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,481 +1,460 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service.
|
||||
*/
|
||||
@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest")
|
||||
public class EligibilityRequest extends DomainResource {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
|
||||
*/
|
||||
@Child(name = "ruleset", type = {Coding.class}, order=1, 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." )
|
||||
protected Coding ruleset;
|
||||
|
||||
/**
|
||||
* The style (standard) and version of the original material which was converted into this resource.
|
||||
*/
|
||||
@Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1)
|
||||
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
|
||||
protected Coding originalRuleset;
|
||||
|
||||
/**
|
||||
* The date when this resource was created.
|
||||
*/
|
||||
@Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
|
||||
protected DateTimeType created;
|
||||
|
||||
/**
|
||||
* The Insurer who is target of the request.
|
||||
*/
|
||||
@Child(name = "target", type = {Organization.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." )
|
||||
protected Reference target;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The Insurer who is target of the request.)
|
||||
*/
|
||||
protected Organization targetTarget;
|
||||
|
||||
/**
|
||||
* The practitioner who is responsible for the services rendered to the patient.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference provider;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
protected Practitioner providerTarget;
|
||||
|
||||
/**
|
||||
* The organization which is responsible for the services rendered to the patient.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference organization;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
protected Organization organizationTarget;
|
||||
|
||||
private static final long serialVersionUID = 1836339504L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public EligibilityRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (The Response Business Identifier.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (The Response Business Identifier.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public EligibilityRequest addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.ruleset");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.ruleset = new Coding(); // cc
|
||||
return this.ruleset;
|
||||
}
|
||||
|
||||
public boolean hasRuleset() {
|
||||
return this.ruleset != null && !this.ruleset.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;
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.originalRuleset = new Coding(); // cc
|
||||
return this.originalRuleset;
|
||||
}
|
||||
|
||||
public boolean hasOriginalRuleset() {
|
||||
return this.originalRuleset != null && !this.originalRuleset.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) {
|
||||
this.originalRuleset = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 DateTimeType getCreatedElement() {
|
||||
if (this.created == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.created");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.created = new DateTimeType(); // bb
|
||||
return this.created;
|
||||
}
|
||||
|
||||
public boolean hasCreatedElement() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCreated() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public EligibilityRequest setCreatedElement(DateTimeType value) {
|
||||
this.created = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date when this resource was created.
|
||||
*/
|
||||
public Date getCreated() {
|
||||
return this.created == null ? null : this.created.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date when this resource was created.
|
||||
*/
|
||||
public EligibilityRequest setCreated(Date value) {
|
||||
if (value == null)
|
||||
this.created = null;
|
||||
else {
|
||||
if (this.created == null)
|
||||
this.created = new DateTimeType();
|
||||
this.created.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #target} (The Insurer who is target of the request.)
|
||||
*/
|
||||
public Reference getTarget() {
|
||||
if (this.target == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.target");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.target = new Reference(); // cc
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public boolean hasTarget() {
|
||||
return this.target != null && !this.target.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #target} (The Insurer who is target of the request.)
|
||||
*/
|
||||
public EligibilityRequest setTarget(Reference value) {
|
||||
this.target = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Organization getTargetTarget() {
|
||||
if (this.targetTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.target");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.targetTarget = new Organization(); // aa
|
||||
return this.targetTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public Reference getProvider() {
|
||||
if (this.provider == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.provider");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.provider = new Reference(); // cc
|
||||
return this.provider;
|
||||
}
|
||||
|
||||
public boolean hasProvider() {
|
||||
return this.provider != null && !this.provider.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public EligibilityRequest setProvider(Reference value) {
|
||||
this.provider = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Practitioner getProviderTarget() {
|
||||
if (this.providerTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.provider");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.providerTarget = new Practitioner(); // aa
|
||||
return this.providerTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public Reference getOrganization() {
|
||||
if (this.organization == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.organization");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.organization = new Reference(); // cc
|
||||
return this.organization;
|
||||
}
|
||||
|
||||
public boolean hasOrganization() {
|
||||
return this.organization != null && !this.organization.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public EligibilityRequest setOrganization(Reference value) {
|
||||
this.organization = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Organization getOrganizationTarget() {
|
||||
if (this.organizationTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.organization");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.organizationTarget = new Organization(); // aa
|
||||
return this.organizationTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public EligibilityRequest setOrganizationTarget(Organization value) {
|
||||
this.organizationTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public EligibilityRequest copy() {
|
||||
EligibilityRequest dst = new EligibilityRequest();
|
||||
copyValues(dst);
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.ruleset = ruleset == null ? null : ruleset.copy();
|
||||
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
|
||||
dst.created = created == null ? null : created.copy();
|
||||
dst.target = target == null ? null : target.copy();
|
||||
dst.provider = provider == null ? null : provider.copy();
|
||||
dst.organization = organization == null ? null : organization.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected EligibilityRequest typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof EligibilityRequest))
|
||||
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)
|
||||
&& compareDeep(organization, o.organization, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service.
|
||||
*/
|
||||
@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest")
|
||||
public class EligibilityRequest extends DomainResource {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
|
||||
*/
|
||||
@Child(name = "ruleset", type = {Coding.class}, order=1, 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." )
|
||||
protected Coding ruleset;
|
||||
|
||||
/**
|
||||
* The style (standard) and version of the original material which was converted into this resource.
|
||||
*/
|
||||
@Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1)
|
||||
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
|
||||
protected Coding originalRuleset;
|
||||
|
||||
/**
|
||||
* The date when this resource was created.
|
||||
*/
|
||||
@Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
|
||||
protected DateTimeType created;
|
||||
|
||||
/**
|
||||
* The Insurer who is target of the request.
|
||||
*/
|
||||
@Child(name = "target", type = {Organization.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." )
|
||||
protected Reference target;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The Insurer who is target of the request.)
|
||||
*/
|
||||
protected Organization targetTarget;
|
||||
|
||||
/**
|
||||
* The practitioner who is responsible for the services rendered to the patient.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference provider;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
protected Practitioner providerTarget;
|
||||
|
||||
/**
|
||||
* The organization which is responsible for the services rendered to the patient.
|
||||
*/
|
||||
@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." )
|
||||
protected Reference organization;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
protected Organization organizationTarget;
|
||||
|
||||
private static final long serialVersionUID = 1836339504L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public EligibilityRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (The Response Business Identifier.)
|
||||
*/
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #identifier} (The Response Business Identifier.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public EligibilityRequest addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.ruleset");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.ruleset = new Coding(); // cc
|
||||
return this.ruleset;
|
||||
}
|
||||
|
||||
public boolean hasRuleset() {
|
||||
return this.ruleset != null && !this.ruleset.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;
|
||||
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)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.originalRuleset = new Coding(); // cc
|
||||
return this.originalRuleset;
|
||||
}
|
||||
|
||||
public boolean hasOriginalRuleset() {
|
||||
return this.originalRuleset != null && !this.originalRuleset.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) {
|
||||
this.originalRuleset = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 DateTimeType getCreatedElement() {
|
||||
if (this.created == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.created");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.created = new DateTimeType(); // bb
|
||||
return this.created;
|
||||
}
|
||||
|
||||
public boolean hasCreatedElement() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCreated() {
|
||||
return this.created != null && !this.created.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public EligibilityRequest setCreatedElement(DateTimeType value) {
|
||||
this.created = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date when this resource was created.
|
||||
*/
|
||||
public Date getCreated() {
|
||||
return this.created == null ? null : this.created.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date when this resource was created.
|
||||
*/
|
||||
public EligibilityRequest setCreated(Date value) {
|
||||
if (value == null)
|
||||
this.created = null;
|
||||
else {
|
||||
if (this.created == null)
|
||||
this.created = new DateTimeType();
|
||||
this.created.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #target} (The Insurer who is target of the request.)
|
||||
*/
|
||||
public Reference getTarget() {
|
||||
if (this.target == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.target");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.target = new Reference(); // cc
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public boolean hasTarget() {
|
||||
return this.target != null && !this.target.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #target} (The Insurer who is target of the request.)
|
||||
*/
|
||||
public EligibilityRequest setTarget(Reference value) {
|
||||
this.target = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Organization getTargetTarget() {
|
||||
if (this.targetTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.target");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.targetTarget = new Organization(); // aa
|
||||
return this.targetTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public Reference getProvider() {
|
||||
if (this.provider == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.provider");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.provider = new Reference(); // cc
|
||||
return this.provider;
|
||||
}
|
||||
|
||||
public boolean hasProvider() {
|
||||
return this.provider != null && !this.provider.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public EligibilityRequest setProvider(Reference value) {
|
||||
this.provider = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 Practitioner getProviderTarget() {
|
||||
if (this.providerTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.provider");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.providerTarget = new Practitioner(); // aa
|
||||
return this.providerTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public Reference getOrganization() {
|
||||
if (this.organization == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.organization");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.organization = new Reference(); // cc
|
||||
return this.organization;
|
||||
}
|
||||
|
||||
public boolean hasOrganization() {
|
||||
return this.organization != null && !this.organization.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
|
||||
*/
|
||||
public EligibilityRequest setOrganization(Reference value) {
|
||||
this.organization = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public Organization getOrganizationTarget() {
|
||||
if (this.organizationTarget == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create EligibilityRequest.organization");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.organizationTarget = new Organization(); // aa
|
||||
return this.organizationTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.)
|
||||
*/
|
||||
public EligibilityRequest setOrganizationTarget(Organization value) {
|
||||
this.organizationTarget = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
public EligibilityRequest copy() {
|
||||
EligibilityRequest dst = new EligibilityRequest();
|
||||
copyValues(dst);
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.ruleset = ruleset == null ? null : ruleset.copy();
|
||||
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
|
||||
dst.created = created == null ? null : created.copy();
|
||||
dst.target = target == null ? null : target.copy();
|
||||
dst.provider = provider == null ? null : provider.copy();
|
||||
dst.organization = organization == null ? null : organization.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected EligibilityRequest typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof EligibilityRequest))
|
||||
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)
|
||||
&& compareDeep(organization, o.organization, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,77 +1,56 @@
|
|||
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.IBaseEnumFactory;
|
||||
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,114 +1,93 @@
|
|||
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.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values
|
||||
*
|
||||
*/
|
||||
@DatatypeDef(name="code", isSpecialization=true)
|
||||
public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private EnumFactory<T> myEnumFactory;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory) {
|
||||
if (theEnumFactory == null)
|
||||
throw new IllegalArgumentException("An enumeration factory must be provided");
|
||||
myEnumFactory = theEnumFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory, T theValue) {
|
||||
if (theEnumFactory == null)
|
||||
throw new IllegalArgumentException("An enumeration factory must be provided");
|
||||
myEnumFactory = theEnumFactory;
|
||||
setValue(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory, String theValue) {
|
||||
if (theEnumFactory == null)
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values
|
||||
*
|
||||
*/
|
||||
@DatatypeDef(name="code", isSpecialization=true)
|
||||
public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private EnumFactory<T> myEnumFactory;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory) {
|
||||
if (theEnumFactory == null)
|
||||
throw new IllegalArgumentException("An enumeration factory must be provided");
|
||||
myEnumFactory = theEnumFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory, T theValue) {
|
||||
if (theEnumFactory == null)
|
||||
throw new IllegalArgumentException("An enumeration factory must be provided");
|
||||
myEnumFactory = theEnumFactory;
|
||||
setValue(theValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Enumeration(EnumFactory<T> theEnumFactory, String theValue) {
|
||||
if (theEnumFactory == null)
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,112 +1,91 @@
|
|||
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%
|
||||
*/
|
||||
|
||||
|
||||
public class Enumerations {
|
||||
|
||||
public enum ConformanceResourceStatus {
|
||||
/**
|
||||
* This resource is still under development
|
||||
*/
|
||||
DRAFT,
|
||||
/**
|
||||
* This resource is ready for normal use
|
||||
*/
|
||||
ACTIVE,
|
||||
/**
|
||||
* This resource has been withdrawn or superceded and should no longer be used
|
||||
*/
|
||||
RETIRED,
|
||||
/**
|
||||
* added to help the parsers
|
||||
*/
|
||||
NULL;
|
||||
public static ConformanceResourceStatus fromCode(String codeString) throws Exception {
|
||||
if (codeString == null || "".equals(codeString))
|
||||
return null;
|
||||
if ("draft".equals(codeString))
|
||||
return DRAFT;
|
||||
if ("active".equals(codeString))
|
||||
return ACTIVE;
|
||||
if ("retired".equals(codeString))
|
||||
return RETIRED;
|
||||
throw new Exception("Unknown ConformanceResourceStatus code '"+codeString+"'");
|
||||
}
|
||||
public String toCode() {
|
||||
switch (this) {
|
||||
case DRAFT: return "draft";
|
||||
case ACTIVE: return "active";
|
||||
case RETIRED: return "retired";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getSystem() {
|
||||
switch (this) {
|
||||
case DRAFT: return "";
|
||||
case ACTIVE: return "";
|
||||
case RETIRED: return "";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getDefinition() {
|
||||
switch (this) {
|
||||
case DRAFT: return "This resource is still under development";
|
||||
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";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getDisplay() {
|
||||
switch (this) {
|
||||
case DRAFT: return "Draft";
|
||||
case ACTIVE: return "Active";
|
||||
case RETIRED: return "Retired";
|
||||
default: 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 "?";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
public class Enumerations {
|
||||
|
||||
public enum ConformanceResourceStatus {
|
||||
/**
|
||||
* This resource is still under development
|
||||
*/
|
||||
DRAFT,
|
||||
/**
|
||||
* This resource is ready for normal use
|
||||
*/
|
||||
ACTIVE,
|
||||
/**
|
||||
* This resource has been withdrawn or superceded and should no longer be used
|
||||
*/
|
||||
RETIRED,
|
||||
/**
|
||||
* added to help the parsers
|
||||
*/
|
||||
NULL;
|
||||
public static ConformanceResourceStatus fromCode(String codeString) throws Exception {
|
||||
if (codeString == null || "".equals(codeString))
|
||||
return null;
|
||||
if ("draft".equals(codeString))
|
||||
return DRAFT;
|
||||
if ("active".equals(codeString))
|
||||
return ACTIVE;
|
||||
if ("retired".equals(codeString))
|
||||
return RETIRED;
|
||||
throw new Exception("Unknown ConformanceResourceStatus code '"+codeString+"'");
|
||||
}
|
||||
public String toCode() {
|
||||
switch (this) {
|
||||
case DRAFT: return "draft";
|
||||
case ACTIVE: return "active";
|
||||
case RETIRED: return "retired";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getSystem() {
|
||||
switch (this) {
|
||||
case DRAFT: return "";
|
||||
case ACTIVE: return "";
|
||||
case RETIRED: return "";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getDefinition() {
|
||||
switch (this) {
|
||||
case DRAFT: return "This resource is still under development";
|
||||
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";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
public String getDisplay() {
|
||||
switch (this) {
|
||||
case DRAFT: return "Draft";
|
||||
case ACTIVE: return "Active";
|
||||
case RETIRED: return "Retired";
|
||||
default: 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 "?";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,209 +1,188 @@
|
|||
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.
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Tue, May 5, 2015 16:13-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* Optional Extensions Element - found in all resources.
|
||||
*/
|
||||
@DatatypeDef(name="Extension")
|
||||
public class Extension extends BaseExtension implements IBaseExtension<Extension, Type>, IBaseHasExtensions {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected UriType 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)." )
|
||||
protected org.hl7.fhir.instance.model.Type value;
|
||||
|
||||
private static final long serialVersionUID = 86382982L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Extension() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Extension(UriType url) {
|
||||
super();
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 UriType getUrlElement() {
|
||||
if (this.url == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Extension.url");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.url = new UriType(); // bb
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public boolean hasUrlElement() {
|
||||
return this.url != null && !this.url.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
return this.url != null && !this.url.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Extension setUrlElement(UriType value) {
|
||||
this.url = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Source of the definition for the extension code - a logical name or a URL.
|
||||
*/
|
||||
public String getUrl() {
|
||||
return this.url == null ? null : this.url.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Source of the definition for the extension code - a logical name or a URL.
|
||||
*/
|
||||
public Extension setUrl(String value) {
|
||||
if (this.url == null)
|
||||
this.url = new UriType();
|
||||
this.url.setValue(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;
|
||||
}
|
||||
|
||||
public boolean hasValue() {
|
||||
return this.value != null && !this.value.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 setValue(org.hl7.fhir.instance.model.Type value) {
|
||||
this.value = 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));
|
||||
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 Extension copy() {
|
||||
Extension dst = new Extension();
|
||||
copyValues(dst);
|
||||
dst.url = url == null ? null : url.copy();
|
||||
dst.value = value == null ? null : value.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Extension typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Generated on Fri, May 22, 2015 17:15-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.annotations.Description;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.api.*;
|
||||
/**
|
||||
* Optional Extensions Element - found in all resources.
|
||||
*/
|
||||
@DatatypeDef(name="Extension")
|
||||
public class Extension extends BaseExtension implements IBaseExtension<Extension, Type>, IBaseHasExtensions {
|
||||
|
||||
/**
|
||||
* 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." )
|
||||
protected UriType 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)." )
|
||||
protected org.hl7.fhir.instance.model.Type value;
|
||||
|
||||
private static final long serialVersionUID = 86382982L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Extension() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Extension(UriType url) {
|
||||
super();
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 UriType getUrlElement() {
|
||||
if (this.url == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Extension.url");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.url = new UriType(); // bb
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public boolean hasUrlElement() {
|
||||
return this.url != null && !this.url.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
return this.url != null && !this.url.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public Extension setUrlElement(UriType value) {
|
||||
this.url = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Source of the definition for the extension code - a logical name or a URL.
|
||||
*/
|
||||
public String getUrl() {
|
||||
return this.url == null ? null : this.url.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Source of the definition for the extension code - a logical name or a URL.
|
||||
*/
|
||||
public Extension setUrl(String value) {
|
||||
if (this.url == null)
|
||||
this.url = new UriType();
|
||||
this.url.setValue(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;
|
||||
}
|
||||
|
||||
public boolean hasValue() {
|
||||
return this.value != null && !this.value.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 setValue(org.hl7.fhir.instance.model.Type value) {
|
||||
this.value = 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));
|
||||
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 Extension copy() {
|
||||
Extension dst = new Extension();
|
||||
copyValues(dst);
|
||||
dst.url = url == null ? null : url.copy();
|
||||
dst.value = value == null ? null : value.copy();
|
||||
return dst;
|
||||
}
|
||||
|
||||
protected Extension typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
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())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,167 +1,146 @@
|
|||
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%
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* in a language with helper classes, this would be a helper class (at least, the base exgtension helpers would be)
|
||||
* @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 too if appropriate
|
||||
*/
|
||||
public static boolean hasExtension(Element element, String name) {
|
||||
if (element != null && element instanceof BackboneElement)
|
||||
return hasExtension((BackboneElement) element, name);
|
||||
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return false;
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
if (name == null || element == null || !(element.hasExtension() || element.hasModifierExtension()))
|
||||
return false;
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return true;
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
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
|
||||
*/
|
||||
public static Extension getExtension(Element element, String name) {
|
||||
if (element != null && element instanceof BackboneElement)
|
||||
return getExtension((BackboneElement) element, name);
|
||||
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return null;
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return null;
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
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 modifier - whether this is a modifier. Note that this is a definitional property of the extension; don't alternate
|
||||
* @param uri - the identifier for the extension
|
||||
* @param value - the value of the extension. Delete if this is null
|
||||
* @throws Exception - if the modifier logic is incorrect
|
||||
*/
|
||||
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws Exception {
|
||||
if (value == null) {
|
||||
// deleting the extension
|
||||
if (element instanceof BackboneElement)
|
||||
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
|
||||
if (uri.equals(e.getUrl()))
|
||||
((BackboneElement) element).getModifierExtension().remove(e);
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (uri.equals(e.getUrl()))
|
||||
element.getExtension().remove(e);
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
boolean found = false;
|
||||
if (element instanceof BackboneElement)
|
||||
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
|
||||
if (uri.equals(e.getUrl())) {
|
||||
if (!modifier)
|
||||
throw new Exception("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
|
||||
e.setValue(value);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (uri.equals(e.getUrl())) {
|
||||
if (modifier)
|
||||
throw new Exception("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
|
||||
e.setValue(value);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
/**
|
||||
* in a language with helper classes, this would be a helper class (at least, the base exgtension helpers would be)
|
||||
* @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 too if appropriate
|
||||
*/
|
||||
public static boolean hasExtension(Element element, String name) {
|
||||
if (element != null && element instanceof BackboneElement)
|
||||
return hasExtension((BackboneElement) element, name);
|
||||
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return false;
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
if (name == null || element == null || !(element.hasExtension() || element.hasModifierExtension()))
|
||||
return false;
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return true;
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
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
|
||||
*/
|
||||
public static Extension getExtension(Element element, String name) {
|
||||
if (element != null && element instanceof BackboneElement)
|
||||
return getExtension((BackboneElement) element, name);
|
||||
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return null;
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
if (name == null || element == null || !element.hasExtension())
|
||||
return null;
|
||||
for (Extension e : element.getModifierExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
return e;
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (name.equals(e.getUrl()))
|
||||
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 modifier - whether this is a modifier. Note that this is a definitional property of the extension; don't alternate
|
||||
* @param uri - the identifier for the extension
|
||||
* @param value - the value of the extension. Delete if this is null
|
||||
* @throws Exception - if the modifier logic is incorrect
|
||||
*/
|
||||
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws Exception {
|
||||
if (value == null) {
|
||||
// deleting the extension
|
||||
if (element instanceof BackboneElement)
|
||||
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
|
||||
if (uri.equals(e.getUrl()))
|
||||
((BackboneElement) element).getModifierExtension().remove(e);
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (uri.equals(e.getUrl()))
|
||||
element.getExtension().remove(e);
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
boolean found = false;
|
||||
if (element instanceof BackboneElement)
|
||||
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
|
||||
if (uri.equals(e.getUrl())) {
|
||||
if (!modifier)
|
||||
throw new Exception("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
|
||||
e.setValue(value);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
for (Extension e : element.getExtension()) {
|
||||
if (uri.equals(e.getUrl())) {
|
||||
if (modifier)
|
||||
throw new Exception("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
|
||||
e.setValue(value);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,196 +1,175 @@
|
|||
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 java.net.URISyntaxException;
|
||||
import java.text.ParseException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class Factory {
|
||||
|
||||
public static IdType newId(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
IdType res = new IdType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static StringType newString_(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
StringType res = new StringType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static UriType newUri(String value) throws URISyntaxException {
|
||||
if (value == null)
|
||||
return null;
|
||||
UriType res = new UriType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static DateTimeType newDateTime(String value) throws ParseException {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new DateTimeType(value);
|
||||
}
|
||||
|
||||
public static DateType newDate(String value) throws ParseException {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new DateType(value);
|
||||
}
|
||||
|
||||
public static CodeType newCode(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
CodeType res = new CodeType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IntegerType newInteger(int value) {
|
||||
IntegerType res = new IntegerType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IntegerType newInteger(java.lang.Integer value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
IntegerType res = new IntegerType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static BooleanType newBoolean(boolean value) {
|
||||
BooleanType res = new BooleanType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static ContactPoint newContactPoint(ContactPointSystem system, String value) {
|
||||
ContactPoint res = new ContactPoint();
|
||||
res.setSystem(system);
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Extension newExtension(String uri, Type value, boolean evenIfNull) throws Exception {
|
||||
if (!evenIfNull && value == null)
|
||||
return null;
|
||||
Extension e = new Extension();
|
||||
e.setUrl(uri);
|
||||
e.setValue(value);
|
||||
return e;
|
||||
}
|
||||
|
||||
public static CodeableConcept newCodeableConcept(String code, String system, String display) throws Exception {
|
||||
CodeableConcept cc = new CodeableConcept();
|
||||
Coding c = new Coding();
|
||||
c.setCode(code);
|
||||
c.setSystem(system);
|
||||
c.setDisplay(display);
|
||||
cc.getCoding().add(c);
|
||||
return cc;
|
||||
}
|
||||
|
||||
public static Reference makeReference(String url) throws Exception {
|
||||
Reference rr = new Reference();
|
||||
rr.setReference(url);
|
||||
return rr;
|
||||
}
|
||||
|
||||
public static Narrative newNarrative(NarrativeStatus status, String html) throws Exception {
|
||||
Narrative n = new Narrative();
|
||||
n.setStatus(status);
|
||||
n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>"));
|
||||
return n;
|
||||
}
|
||||
|
||||
public static Coding makeCoding(String code) throws Exception {
|
||||
String[] parts = code.split("\\|");
|
||||
Coding c = new Coding();
|
||||
if (parts.length == 2) {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
package org.hl7.fhir.instance.model;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.text.ParseException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class Factory {
|
||||
|
||||
public static IdType newId(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
IdType res = new IdType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static StringType newString_(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
StringType res = new StringType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static UriType newUri(String value) throws URISyntaxException {
|
||||
if (value == null)
|
||||
return null;
|
||||
UriType res = new UriType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static DateTimeType newDateTime(String value) throws ParseException {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new DateTimeType(value);
|
||||
}
|
||||
|
||||
public static DateType newDate(String value) throws ParseException {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new DateType(value);
|
||||
}
|
||||
|
||||
public static CodeType newCode(String value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
CodeType res = new CodeType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IntegerType newInteger(int value) {
|
||||
IntegerType res = new IntegerType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static IntegerType newInteger(java.lang.Integer value) {
|
||||
if (value == null)
|
||||
return null;
|
||||
IntegerType res = new IntegerType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static BooleanType newBoolean(boolean value) {
|
||||
BooleanType res = new BooleanType();
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static ContactPoint newContactPoint(ContactPointSystem system, String value) {
|
||||
ContactPoint res = new ContactPoint();
|
||||
res.setSystem(system);
|
||||
res.setValue(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Extension newExtension(String uri, Type value, boolean evenIfNull) throws Exception {
|
||||
if (!evenIfNull && value == null)
|
||||
return null;
|
||||
Extension e = new Extension();
|
||||
e.setUrl(uri);
|
||||
e.setValue(value);
|
||||
return e;
|
||||
}
|
||||
|
||||
public static CodeableConcept newCodeableConcept(String code, String system, String display) throws Exception {
|
||||
CodeableConcept cc = new CodeableConcept();
|
||||
Coding c = new Coding();
|
||||
c.setCode(code);
|
||||
c.setSystem(system);
|
||||
c.setDisplay(display);
|
||||
cc.getCoding().add(c);
|
||||
return cc;
|
||||
}
|
||||
|
||||
public static Reference makeReference(String url) throws Exception {
|
||||
Reference rr = new Reference();
|
||||
rr.setReference(url);
|
||||
return rr;
|
||||
}
|
||||
|
||||
public static Narrative newNarrative(NarrativeStatus status, String html) throws Exception {
|
||||
Narrative n = new Narrative();
|
||||
n.setStatus(status);
|
||||
n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>"));
|
||||
return n;
|
||||
}
|
||||
|
||||
public static Coding makeCoding(String code) throws Exception {
|
||||
String[] parts = code.split("\\|");
|
||||
Coding c = new Coding();
|
||||
if (parts.length == 2) {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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();
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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;
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue