mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-09 14:33:32 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/hl7api/fhircode
This commit is contained in:
commit
bba62b2972
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/target
|
||||
*.log
|
||||
*.log*
|
||||
nohup.out
|
||||
|
@ -9,6 +9,15 @@
|
||||
<release version="0.3" date="2014-May-12" description="This release corrects lots of bugs and introduces the fluent client mode">
|
||||
</release>
|
||||
<release version="0.4" date="TBD">
|
||||
<action type="add">
|
||||
<![CDATA[<b>BREAKING CHANGE:</b>]]>: IdDt has been modified so that it
|
||||
contains a partial or complete resource identity. Previously it contained
|
||||
only the simple alphanumeric id of the resource (the part at the end of the "read" URL for
|
||||
that resource) but it can now contain a complete URL or even a partial URL (e.g. "Patient/123")
|
||||
and can optionally contain a version (e.g. "Patient/123/_history/456"). New methods have
|
||||
been added to this datatype which provide just the numeric portion. See the JavaDoc
|
||||
for more information.
|
||||
</action>
|
||||
<action type="add">
|
||||
Allow use of QuantityDt as a service parameter to support the "quantity" type. Previously
|
||||
QuantityDt did not implement IQueryParameterType so it was not valid, and there was no way to
|
||||
@ -30,6 +39,20 @@
|
||||
<action type="fix">
|
||||
Support for Query resources fixed (in parser)
|
||||
</action>
|
||||
<action type="fix">
|
||||
Nested contained resources (e.g. encoding a resource with a contained resource that itself contains a resource)
|
||||
now parse and encode correctly, meaning that all contained resources are placed in the "contained" element
|
||||
of the root resource, and the parser looks in the root resource for all container levels when stitching
|
||||
contained resources back together.
|
||||
</action>
|
||||
<action type="fix">
|
||||
Server methods with @Include parameter would sometimes fail when no _include was actually
|
||||
specified in query strings.
|
||||
</action>
|
||||
<action type="fix">
|
||||
Client requests for IdentifierDt types (such as Patient.identifier) did not create the correct
|
||||
query string if the system is null.
|
||||
</action>
|
||||
</release>
|
||||
</body>
|
||||
</document>
|
||||
|
@ -46,6 +46,8 @@ public abstract class BaseRuntimeChildDefinition {
|
||||
List<? extends IElement> getValues(Object theTarget);
|
||||
}
|
||||
|
||||
public abstract String getElementName();
|
||||
|
||||
public abstract int getMax();
|
||||
|
||||
public abstract int getMin();
|
||||
|
@ -70,6 +70,7 @@ public class FhirContext {
|
||||
* Default constructor. In most cases this is the right constructor to use.
|
||||
*/
|
||||
public FhirContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FhirContext(Class<? extends IResource> theResourceType) {
|
||||
|
@ -147,4 +147,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getElementName() {
|
||||
return "extension";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public abstract class BaseResource extends BaseElement implements IResource {
|
||||
@Child(name = "language", order = 0, min = 0, max = Child.MAX_UNLIMITED)
|
||||
private CodeDt myLanguage;
|
||||
|
||||
private Map<ResourceMetadataKeyEnum, Object> myResourceMetadata;
|
||||
private Map<ResourceMetadataKeyEnum<?>, Object> myResourceMetadata;
|
||||
|
||||
@Child(name = "text", order = 1, min = 0, max = 1)
|
||||
private NarrativeDt myText;
|
||||
@ -57,9 +57,9 @@ public abstract class BaseResource extends BaseElement implements IResource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ResourceMetadataKeyEnum, Object> getResourceMetadata() {
|
||||
public Map<ResourceMetadataKeyEnum<?>, Object> getResourceMetadata() {
|
||||
if (myResourceMetadata == null) {
|
||||
myResourceMetadata = new HashMap<ResourceMetadataKeyEnum, Object>();
|
||||
myResourceMetadata = new HashMap<ResourceMetadataKeyEnum<?>, Object>();
|
||||
}
|
||||
return myResourceMetadata;
|
||||
}
|
||||
@ -81,7 +81,7 @@ public abstract class BaseResource extends BaseElement implements IResource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceMetadata(Map<ResourceMetadataKeyEnum, Object> theMap) {
|
||||
public void setResourceMetadata(Map<ResourceMetadataKeyEnum<?>, Object> theMap) {
|
||||
Validate.notNull(theMap, "The Map must not be null");
|
||||
myResourceMetadata = theMap;
|
||||
}
|
||||
|
@ -54,31 +54,13 @@ public abstract class BaseResourceReference extends BaseElement {
|
||||
*/
|
||||
public BaseResourceReference(IResource theResource) {
|
||||
myResource = theResource;
|
||||
setResourceId(theResource.getId());
|
||||
setReference(theResource.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference). creating it if it does not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute
|
||||
* URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be
|
||||
* version specific. Internal fragment references (start with '#') refer to contained resources
|
||||
* </p>
|
||||
*/
|
||||
public abstract IdDt getResourceId();
|
||||
|
||||
/**
|
||||
* Sets the resource ID
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute
|
||||
* URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be
|
||||
* version specific. Internal fragment references (start with '#') refer to contained resources
|
||||
* </p>
|
||||
*/
|
||||
public abstract void setResourceId(IdDt theResourceId);
|
||||
|
||||
public abstract BaseResourceReference setReference(IdDt theReference);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the actual loaded and parsed resource instance, <b>if it is already present</b>. This
|
||||
* method will return the resource instance only if it has previously been loaded using
|
||||
@ -107,7 +89,7 @@ public abstract class BaseResourceReference extends BaseElement {
|
||||
return myResource;
|
||||
}
|
||||
|
||||
IdDt resourceId = getResourceId();
|
||||
IdDt resourceId = getReference();
|
||||
if (resourceId == null) {
|
||||
throw new IllegalStateException("Reference has no resource ID defined");
|
||||
}
|
||||
@ -141,6 +123,8 @@ public abstract class BaseResourceReference extends BaseElement {
|
||||
return myResource;
|
||||
}
|
||||
|
||||
protected abstract IdDt getReference();
|
||||
|
||||
public void setResource(IResource theResource) {
|
||||
myResource = theResource;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public interface IResource extends ICompositeElement {
|
||||
* @see ResourceMetadataKeyEnum for a list of allowable keys and the object
|
||||
* types that values of a given key must use.
|
||||
*/
|
||||
Map<ResourceMetadataKeyEnum, Object> getResourceMetadata();
|
||||
Map<ResourceMetadataKeyEnum<?>, Object> getResourceMetadata();
|
||||
|
||||
/**
|
||||
* Sets the metadata map for this object. Metadata entries are used to
|
||||
@ -71,6 +71,6 @@ public interface IResource extends ICompositeElement {
|
||||
* @throws NullPointerException
|
||||
* The map must not be null
|
||||
*/
|
||||
void setResourceMetadata(Map<ResourceMetadataKeyEnum, Object> theMap);
|
||||
void setResourceMetadata(Map<ResourceMetadataKeyEnum<?>, Object> theMap);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
package ca.uhn.fhir.model.api;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
* %%
|
||||
* Copyright (C) 2014 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%
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a FHIR resource path specification, e.g.
|
||||
* <code>Patient.gender.coding</code>
|
||||
* <p>
|
||||
* Note on equality: This class uses the {@link Include#setValue(String) value}
|
||||
* as the single item used to provide {@link #hashCode()} and {@link #equals(Object)}.
|
||||
* </p>
|
||||
*/
|
||||
public class Include {
|
||||
|
||||
private String myValue;
|
||||
|
||||
public Include(String theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if ((obj instanceof Include)==false)
|
||||
return false;
|
||||
Include other = (Include) obj;
|
||||
if (myValue == null) {
|
||||
if (other.myValue != null)
|
||||
return false;
|
||||
} else if (!myValue.equals(other.myValue))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setValue(String theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
builder.append("myValue", myValue);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,6 @@ package ca.uhn.fhir.model.api;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* Represents a FHIR resource path specification, e.g.
|
||||
@ -29,53 +28,14 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
* Note on equality: This class uses the {@link PathSpecification#setValue(String) value}
|
||||
* as the single item used to provide {@link #hashCode()} and {@link #equals(Object)}.
|
||||
* </p>
|
||||
*
|
||||
* @deprecated {@link Include} should be used instead
|
||||
*/
|
||||
public class PathSpecification {
|
||||
public class PathSpecification extends Include {
|
||||
|
||||
private String myValue;
|
||||
|
||||
public PathSpecification(String theValue) {
|
||||
myValue = theValue;
|
||||
public PathSpecification(String theInclude) {
|
||||
super(theInclude);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PathSpecification other = (PathSpecification) obj;
|
||||
if (myValue == null) {
|
||||
if (other.myValue != null)
|
||||
return false;
|
||||
} else if (!myValue.equals(other.myValue))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setValue(String theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
builder.append("myValue", myValue);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
||||
public enum ResourceMetadataKeyEnum {
|
||||
public abstract class ResourceMetadataKeyEnum<T> {
|
||||
|
||||
|
||||
/**
|
||||
@ -41,18 +41,17 @@ public enum ResourceMetadataKeyEnum {
|
||||
* Values for this key are of type <b>{@link InstantDt}</b>
|
||||
* </p>
|
||||
*/
|
||||
DELETED_AT {
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> DELETED_AT = new ResourceMetadataKeyEnum<InstantDt>("DELETED_AT") {
|
||||
@Override
|
||||
public InstantDt get(IResource theResource) {
|
||||
return getInstantFromMetadataOrNullIfNone(theResource.getResourceMetadata(), DELETED_AT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
InstantDt obj = (InstantDt) theObject;
|
||||
theResource.getResourceMetadata().put(DELETED_AT, obj);
|
||||
public void put(IResource theResource, InstantDt theObject) {
|
||||
theResource.getResourceMetadata().put(DELETED_AT, theObject);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The value for this key represents a previous ID used to identify
|
||||
@ -62,18 +61,17 @@ public enum ResourceMetadataKeyEnum {
|
||||
* Values for this key are of type <b>{@link IdDt}</b>
|
||||
* </p>
|
||||
*/
|
||||
PREVIOUS_ID {
|
||||
public static final ResourceMetadataKeyEnum<IdDt> PREVIOUS_ID = new ResourceMetadataKeyEnum<IdDt>("PREVIOUS_ID") {
|
||||
@Override
|
||||
public IdDt get(IResource theResource) {
|
||||
return getIdFromMetadataOrNullIfNone(theResource.getResourceMetadata(), PREVIOUS_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
IdDt obj = (IdDt) theObject;
|
||||
theResource.getResourceMetadata().put(PREVIOUS_ID, obj);
|
||||
public void put(IResource theResource, IdDt theObject) {
|
||||
theResource.getResourceMetadata().put(PREVIOUS_ID, theObject);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The value for this key is the bundle entry <b>Published</b> time. This is
|
||||
@ -90,19 +88,18 @@ public enum ResourceMetadataKeyEnum {
|
||||
*
|
||||
* @see InstantDt
|
||||
*/
|
||||
PUBLISHED {
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> PUBLISHED = new ResourceMetadataKeyEnum<InstantDt>("PUBLISHED") {
|
||||
@Override
|
||||
public InstantDt get(IResource theResource) {
|
||||
return getInstantFromMetadataOrNullIfNone(theResource.getResourceMetadata(), PUBLISHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
InstantDt obj = (InstantDt) theObject;
|
||||
theResource.getResourceMetadata().put(PUBLISHED, obj);
|
||||
public void put(IResource theResource, InstantDt theObject) {
|
||||
theResource.getResourceMetadata().put(PUBLISHED, theObject);
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The value for this key is the list of tags associated with this resource
|
||||
@ -112,7 +109,7 @@ public enum ResourceMetadataKeyEnum {
|
||||
*
|
||||
* @see TagList
|
||||
*/
|
||||
TAG_LIST {
|
||||
public static final ResourceMetadataKeyEnum<TagList> TAG_LIST = new ResourceMetadataKeyEnum<TagList>("TAG_LIST") {
|
||||
@Override
|
||||
public TagList get(IResource theResource) {
|
||||
Object retValObj = theResource.getResourceMetadata().get(TAG_LIST);
|
||||
@ -129,11 +126,10 @@ public enum ResourceMetadataKeyEnum {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
TagList obj = (TagList) theObject;
|
||||
theResource.getResourceMetadata().put(TAG_LIST, obj);
|
||||
public void put(IResource theResource, TagList theObject) {
|
||||
theResource.getResourceMetadata().put(TAG_LIST, theObject);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -147,18 +143,17 @@ public enum ResourceMetadataKeyEnum {
|
||||
*
|
||||
* @see InstantDt
|
||||
*/
|
||||
UPDATED {
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> UPDATED = new ResourceMetadataKeyEnum<InstantDt>("UPDATED") {
|
||||
@Override
|
||||
public InstantDt get(IResource theResource) {
|
||||
return getInstantFromMetadataOrNullIfNone(theResource.getResourceMetadata(), UPDATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
InstantDt obj = (InstantDt) theObject;
|
||||
theResource.getResourceMetadata().put(UPDATED, obj);
|
||||
public void put(IResource theResource, InstantDt theObject) {
|
||||
theResource.getResourceMetadata().put(UPDATED, theObject);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The value for this key is the version ID of the resource object.
|
||||
@ -169,22 +164,52 @@ public enum ResourceMetadataKeyEnum {
|
||||
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getUnqualifiedVersionId()} method
|
||||
*/
|
||||
@Deprecated
|
||||
VERSION_ID {
|
||||
public static final ResourceMetadataKeyEnum<IdDt> VERSION_ID = new ResourceMetadataKeyEnum<IdDt>("VERSION_ID") {
|
||||
@Override
|
||||
public IdDt get(IResource theResource) {
|
||||
return getIdFromMetadataOrNullIfNone(theResource.getResourceMetadata(), VERSION_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
IdDt obj = (IdDt) theObject;
|
||||
theResource.getResourceMetadata().put(VERSION_ID, obj);
|
||||
public void put(IResource theResource, IdDt theObject) {
|
||||
theResource.getResourceMetadata().put(VERSION_ID, theObject);
|
||||
}
|
||||
};
|
||||
|
||||
public abstract Object get(IResource theResource);
|
||||
private final String myValue;
|
||||
|
||||
private static IdDt getIdFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum, Object> theResourceMetadata, ResourceMetadataKeyEnum theKey) {
|
||||
|
||||
|
||||
public ResourceMetadataKeyEnum(String theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ResourceMetadataKeyEnum<?> other = (ResourceMetadataKeyEnum<?>) obj;
|
||||
if (myValue == null) {
|
||||
if (other.myValue != null)
|
||||
return false;
|
||||
} else if (!myValue.equals(other.myValue))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static IdDt getIdFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<?> theKey) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
@ -206,7 +231,11 @@ public enum ResourceMetadataKeyEnum {
|
||||
throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + IdDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
private static InstantDt getInstantFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum, Object> theResourceMetadata, ResourceMetadataKeyEnum theKey) {
|
||||
private String name() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
private static InstantDt getInstantFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<InstantDt> theKey) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
@ -222,6 +251,8 @@ public enum ResourceMetadataKeyEnum {
|
||||
throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
public abstract void put(IResource theResource, Object theObject);
|
||||
|
||||
public abstract T get(IResource theResource);
|
||||
|
||||
public abstract void put(IResource theResource, T theObject);
|
||||
|
||||
}
|
||||
|
@ -71,6 +71,13 @@ public class CodeableConceptDt
|
||||
// nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which creates a CodeableConceptDt with one coding repetition, containing
|
||||
* the given system and code
|
||||
*/
|
||||
public CodeableConceptDt(String theSystem, String theCode) {
|
||||
addCoding().setSystem(theSystem).setCode(theCode);
|
||||
}
|
||||
|
||||
@Child(name="coding", type=CodingDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(
|
||||
|
@ -415,7 +415,7 @@ public class IdentifierDt
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(getSystem().getValueAsString())) {
|
||||
return getSystem().getValueAsString() + '|' + getValue().getValueAsString();
|
||||
} else {
|
||||
return getValue().getValueAsString();
|
||||
return '|' + getValue().getValueAsString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,20 @@
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
* %%
|
||||
* Copyright (C) 2014 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%
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -33,19 +29,22 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
||||
/**
|
||||
* HAPI/FHIR <b>ResourceReferenceDt</b> Datatype (A reference from one resource to another)
|
||||
*
|
||||
* HAPI/FHIR <b>ResourceReferenceDt</b> Datatype
|
||||
* (A reference from one resource to another)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference from one resource to another
|
||||
* </p>
|
||||
*
|
||||
* <b>Definition:</b>
|
||||
* A reference from one resource to another
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Requirements:</b>
|
||||
*
|
||||
* </p>
|
||||
* </p>
|
||||
*/
|
||||
@DatatypeDef(name = "ResourceReferenceDt")
|
||||
public class ResourceReferenceDt extends BaseResourceReference implements ICompositeDatatype {
|
||||
@DatatypeDef(name="ResourceReferenceDt")
|
||||
public class ResourceReferenceDt
|
||||
extends BaseResourceReference implements ICompositeDatatype {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -70,6 +69,14 @@ public class ResourceReferenceDt extends BaseResourceReference implements ICompo
|
||||
super(theResource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
org.apache.commons.lang3.builder.ToStringBuilder b = new org.apache.commons.lang3.builder.ToStringBuilder(this, org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE);
|
||||
b.append("reference", getReference().getValueAsString());
|
||||
b.append("loaded", getResource()!=null);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute
|
||||
* URL)
|
||||
@ -78,7 +85,7 @@ public class ResourceReferenceDt extends BaseResourceReference implements ICompo
|
||||
* The reference itself
|
||||
*/
|
||||
public ResourceReferenceDt(String theId) {
|
||||
setResourceId(new IdDt(theId));
|
||||
setReference(new IdDt(theId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,86 +96,89 @@ public class ResourceReferenceDt extends BaseResourceReference implements ICompo
|
||||
* The reference itself
|
||||
*/
|
||||
public ResourceReferenceDt(IdDt theResourceId) {
|
||||
setResourceId(theResourceId);
|
||||
setReference(theResourceId);
|
||||
}
|
||||
|
||||
@Child(name = "reference", type = StringDt.class, order = 0, min = 0, max = 1)
|
||||
@Description(shortDefinition = "Relative, internal or absolute URL reference", formalDefinition = "A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources")
|
||||
private StringDt myReference;
|
||||
|
||||
@Child(name = "display", type = StringDt.class, order = 1, min = 0, max = 1)
|
||||
@Description(shortDefinition = "Text alternative for the resource", formalDefinition = "Plain text narrative that identifies the resource in addition to the resource reference")
|
||||
@Child(name="reference", type=IdDt.class, order=0, min=0, max=1)
|
||||
@Description(
|
||||
shortDefinition="Relative, internal or absolute URL reference",
|
||||
formalDefinition="A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources"
|
||||
)
|
||||
private IdDt myReference;
|
||||
|
||||
@Child(name="display", type=StringDt.class, order=1, min=0, max=1)
|
||||
@Description(
|
||||
shortDefinition="Text alternative for the resource",
|
||||
formalDefinition="Plain text narrative that identifies the resource in addition to the resource reference"
|
||||
)
|
||||
private StringDt myDisplay;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(myReference, myDisplay);
|
||||
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
|
||||
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myReference, myDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference). creating it if it does not
|
||||
* exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference to a location at which the other resource is found. The reference may a relative
|
||||
* reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location
|
||||
* where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR
|
||||
* RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#')
|
||||
* refer to contained resources
|
||||
* </p>
|
||||
* Gets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getReference() {
|
||||
public IdDt getReference() {
|
||||
if (myReference == null) {
|
||||
myReference = new StringDt();
|
||||
myReference = new IdDt();
|
||||
}
|
||||
return myReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference to a location at which the other resource is found. The reference may a relative
|
||||
* reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location
|
||||
* where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR
|
||||
* RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#')
|
||||
* refer to contained resources
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt setReference(StringDt theValue) {
|
||||
public ResourceReferenceDt setReference(IdDt theValue) {
|
||||
myReference = theValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the value for <b>reference</b> (Relative, internal or absolute URL reference)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> A reference to a location at which the other resource is found. The reference may a relative
|
||||
* reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location
|
||||
* where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR
|
||||
* RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#')
|
||||
* refer to contained resources
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt setReference(String theString) {
|
||||
return setReference(new StringDt(theString));
|
||||
public ResourceReferenceDt setReference( String theId) {
|
||||
myReference = new IdDt(theId);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>display</b> (Text alternative for the resource). creating it if it does not exist. Will
|
||||
* not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
* Gets the value(s) for <b>display</b> (Text alternative for the resource).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
*/
|
||||
public StringDt getDisplay() {
|
||||
public StringDt getDisplay() {
|
||||
if (myDisplay == null) {
|
||||
myDisplay = new StringDt();
|
||||
}
|
||||
@ -177,36 +187,31 @@ public class ResourceReferenceDt extends BaseResourceReference implements ICompo
|
||||
|
||||
/**
|
||||
* Sets the value(s) for <b>display</b> (Text alternative for the resource)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt setDisplay(StringDt theValue) {
|
||||
myDisplay = theValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the value for <b>display</b> (Text alternative for the resource)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b> Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt setDisplay(String theString) {
|
||||
myDisplay = new StringDt(theString);
|
||||
return this;
|
||||
public ResourceReferenceDt setDisplay( String theString) {
|
||||
myDisplay = new StringDt(theString);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdDt getResourceId() {
|
||||
return new IdDt(myReference.getValue());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setResourceId(IdDt theResourceId) {
|
||||
myReference = new StringDt(theResourceId.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -42,6 +42,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
@ -54,7 +55,6 @@ import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -58,7 +59,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -64,7 +65,6 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -59,7 +60,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -56,7 +57,6 @@ import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -75,14 +75,6 @@ public class Binary extends BaseResource implements IResource {
|
||||
return myContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not call - throws {@link UnsupportedOperationException}
|
||||
*/
|
||||
@Override
|
||||
public NarrativeDt getText() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return (myContent.isEmpty()) && StringUtils.isBlank(myContentType);
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -71,7 +72,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IdrefDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -64,7 +65,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -62,7 +63,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -65,7 +66,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -76,7 +77,6 @@ import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -60,7 +61,6 @@ import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -56,7 +57,6 @@ import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -56,7 +57,6 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.CompositeParam;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -64,7 +65,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -59,7 +60,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -67,7 +68,6 @@ import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.CompositeParam;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
@ -16,26 +16,6 @@
|
||||
|
||||
package ca.uhn.fhir.model.dstu.resource;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
* %%
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
@ -44,6 +24,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -66,7 +47,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
@ -185,33 +165,6 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*/
|
||||
public static final Include INCLUDE_SUBJECT = new Include("Encounter.subject");
|
||||
|
||||
/**
|
||||
* Search parameter constant for <b>!fulfills</b>
|
||||
* <p>
|
||||
* Description: <b></b><br/>
|
||||
* Type: <b>reference</b><br/>
|
||||
* Path: <b>Encounter.fulfills</b><br/>
|
||||
* </p>
|
||||
*/
|
||||
@SearchParamDefinition(name="!fulfills", path="Encounter.fulfills", description="", type="reference")
|
||||
public static final String SP_FULFILLS = "!fulfills";
|
||||
|
||||
/**
|
||||
* <b>Fluent Client</b> search parameter constant for <b>!fulfills</b>
|
||||
* <p>
|
||||
* Description: <b></b><br/>
|
||||
* Type: <b>reference</b><br/>
|
||||
* Path: <b>Encounter.fulfills</b><br/>
|
||||
* </p>
|
||||
*/
|
||||
public static final ReferenceParam FULFILLS = new ReferenceParam(SP_FULFILLS);
|
||||
|
||||
/**
|
||||
* Constant for fluent queries to be used to add include statements. Specifies
|
||||
* the path value of "<b>Encounter.fulfills</b>".
|
||||
*/
|
||||
public static final Include INCLUDE_FULFILLS = new Include("Encounter.fulfills");
|
||||
|
||||
/**
|
||||
* Search parameter constant for <b>length</b>
|
||||
* <p>
|
||||
@ -498,11 +451,11 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*
|
||||
* @return Returns a reference to this object, to allow for simple chaining.
|
||||
*/
|
||||
public Encounter addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) {
|
||||
public Encounter addIdentifier( String theSystem, String theValue) {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new java.util.ArrayList<IdentifierDt>();
|
||||
}
|
||||
myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel));
|
||||
myIdentifier.add(new IdentifierDt(theSystem, theValue));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -516,11 +469,11 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*
|
||||
* @return Returns a reference to this object, to allow for simple chaining.
|
||||
*/
|
||||
public Encounter addIdentifier( String theSystem, String theValue) {
|
||||
public Encounter addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) {
|
||||
if (myIdentifier == null) {
|
||||
myIdentifier = new java.util.ArrayList<IdentifierDt>();
|
||||
}
|
||||
myIdentifier.add(new IdentifierDt(theSystem, theValue));
|
||||
myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -651,8 +604,24 @@ public class Encounter extends BaseResource implements IResource {
|
||||
* Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
|
||||
* </p>
|
||||
*/
|
||||
public void addType(EncounterTypeEnum theValue) {
|
||||
getType().add(new BoundCodeableConceptDt<EncounterTypeEnum>(EncounterTypeEnum.VALUESET_BINDER, theValue));
|
||||
public BoundCodeableConceptDt<EncounterTypeEnum> addType(EncounterTypeEnum theValue) {
|
||||
BoundCodeableConceptDt<EncounterTypeEnum> retVal = new BoundCodeableConceptDt<EncounterTypeEnum>(EncounterTypeEnum.VALUESET_BINDER, theValue);
|
||||
getType().add(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value for <b>type</b> (Specific type of encounter)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation)
|
||||
* </p>
|
||||
*/
|
||||
public BoundCodeableConceptDt<EncounterTypeEnum> addType() {
|
||||
BoundCodeableConceptDt<EncounterTypeEnum> retVal = new BoundCodeableConceptDt<EncounterTypeEnum>(EncounterTypeEnum.VALUESET_BINDER);
|
||||
getType().add(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1157,8 +1126,24 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void addType(ParticipantTypeEnum theValue) {
|
||||
getType().add(new BoundCodeableConceptDt<ParticipantTypeEnum>(ParticipantTypeEnum.VALUESET_BINDER, theValue));
|
||||
public BoundCodeableConceptDt<ParticipantTypeEnum> addType(ParticipantTypeEnum theValue) {
|
||||
BoundCodeableConceptDt<ParticipantTypeEnum> retVal = new BoundCodeableConceptDt<ParticipantTypeEnum>(ParticipantTypeEnum.VALUESET_BINDER, theValue);
|
||||
getType().add(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value for <b>type</b> (Role of participant in encounter)
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public BoundCodeableConceptDt<ParticipantTypeEnum> addType() {
|
||||
BoundCodeableConceptDt<ParticipantTypeEnum> retVal = new BoundCodeableConceptDt<ParticipantTypeEnum>(ParticipantTypeEnum.VALUESET_BINDER);
|
||||
getType().add(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1187,6 +1172,9 @@ public class Encounter extends BaseResource implements IResource {
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt getIndividual() {
|
||||
if (myIndividual == null) {
|
||||
myIndividual = new ResourceReferenceDt();
|
||||
}
|
||||
return myIndividual;
|
||||
}
|
||||
|
||||
@ -1355,8 +1343,8 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public Hospitalization setPreAdmissionIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) {
|
||||
myPreAdmissionIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel);
|
||||
public Hospitalization setPreAdmissionIdentifier( String theSystem, String theValue) {
|
||||
myPreAdmissionIdentifier = new IdentifierDt(theSystem, theValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1368,8 +1356,8 @@ public class Encounter extends BaseResource implements IResource {
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public Hospitalization setPreAdmissionIdentifier( String theSystem, String theValue) {
|
||||
myPreAdmissionIdentifier = new IdentifierDt(theSystem, theValue);
|
||||
public Hospitalization setPreAdmissionIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) {
|
||||
myPreAdmissionIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -2040,4 +2028,4 @@ public class Encounter extends BaseResource implements IResource {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -60,7 +61,6 @@ import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -58,7 +59,6 @@ import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -55,7 +56,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -53,7 +54,6 @@ import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -57,7 +58,6 @@ import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.CompositeParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -66,7 +67,6 @@ import ca.uhn.fhir.model.primitive.OidDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -66,7 +67,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -62,7 +63,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -61,7 +62,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -60,7 +61,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -57,7 +58,6 @@ import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -64,7 +65,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -67,7 +68,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -70,7 +71,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -61,7 +62,6 @@ import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -58,7 +59,6 @@ import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -75,7 +76,6 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.CompositeParam;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.QuantityParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -59,7 +60,6 @@ import ca.uhn.fhir.model.dstu.composite.ScheduleDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -59,7 +60,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -61,7 +62,6 @@ import ca.uhn.fhir.model.dstu.valueset.OrganizationTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -54,7 +55,6 @@ import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -71,7 +72,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -65,7 +66,6 @@ import ca.uhn.fhir.model.dstu.valueset.PractitionerRoleEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.PractitionerSpecialtyEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -59,7 +60,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -74,7 +75,6 @@ import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -62,7 +63,6 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -71,7 +72,6 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
@ -454,7 +454,10 @@ public class Questionnaire extends BaseResource implements IResource {
|
||||
* The subject of the questionnaires: this is the patient that the answers apply to, but this person is not necessarily the source of information
|
||||
* </p>
|
||||
*/
|
||||
public ResourceReferenceDt getSubject() {
|
||||
public ResourceReferenceDt getSubject() {
|
||||
if (mySubject==null) {
|
||||
mySubject = new ResourceReferenceDt();
|
||||
}
|
||||
return mySubject;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
@ -57,7 +58,6 @@ import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.PatientRelationshipTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -71,7 +72,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -57,7 +58,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -58,7 +59,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
|
||||
|
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -57,7 +58,6 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -46,6 +46,7 @@ import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -67,7 +68,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
|
||||
|
||||
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.gclient.DateParam;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.NumberParam;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -44,6 +44,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
@ -63,7 +64,6 @@ import ca.uhn.fhir.model.dstu.valueset.SupplyTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
||||
|
@ -42,6 +42,7 @@ import java.util.List;
|
||||
import ca.uhn.fhir.model.api.BaseResource;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
@ -53,7 +54,6 @@ import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.gclient.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.gclient.StringParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenParam;
|
||||
|
@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
@ -71,7 +72,7 @@ public class IdDt extends BasePrimitive<String> {
|
||||
setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ID using a long
|
||||
*/
|
||||
@ -99,14 +100,17 @@ public class IdDt extends BasePrimitive<String> {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param theResourceType The resource type (e.g. "Patient")
|
||||
* @param theId The ID (e.g. "123")
|
||||
* @param theVersionId The version ID ("e.g. "456")
|
||||
* @param theResourceType
|
||||
* The resource type (e.g. "Patient")
|
||||
* @param theId
|
||||
* The ID (e.g. "123")
|
||||
* @param theVersionId
|
||||
* The version ID ("e.g. "456")
|
||||
*/
|
||||
public IdDt(String theResourceType, String theId, String theVersionId) {
|
||||
Validate.notBlank(theResourceType, "Resource type must not be blank");
|
||||
Validate.notBlank(theId, "ID must not be blank");
|
||||
|
||||
|
||||
myResourceType = theResourceType;
|
||||
myUnqualifiedId = theId;
|
||||
myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionId, null);
|
||||
@ -169,7 +173,7 @@ public class IdDt extends BasePrimitive<String> {
|
||||
public Long getUnqualifiedVersionIdAsLong() {
|
||||
if (!hasUnqualifiedVersionId()) {
|
||||
return null;
|
||||
}else {
|
||||
} else {
|
||||
return Long.parseLong(getUnqualifiedVersionId());
|
||||
}
|
||||
}
|
||||
@ -288,13 +292,15 @@ public class IdDt extends BasePrimitive<String> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view of this ID as a fully qualified URL, given a server base and resource name
|
||||
* (which will only be used if the ID does not already contain those respective parts). Essentially,
|
||||
* because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this
|
||||
* method may be used to translate into a complete URL.
|
||||
* Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be
|
||||
* used if the ID does not already contain those respective parts). Essentially, because IdDt can contain either a
|
||||
* complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete
|
||||
* URL.
|
||||
*
|
||||
* @param theServerBase The server base (e.g. "http://example.com/fhir")
|
||||
* @param theResourceType The resource name (e.g. "Patient")
|
||||
* @param theServerBase
|
||||
* The server base (e.g. "http://example.com/fhir")
|
||||
* @param theResourceType
|
||||
* The resource name (e.g. "Patient")
|
||||
* @return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1")
|
||||
*/
|
||||
public String toQualifiedUrl(String theServerBase, String theResourceType) {
|
||||
@ -303,12 +309,12 @@ public class IdDt extends BasePrimitive<String> {
|
||||
}
|
||||
StringBuilder retVal = new StringBuilder();
|
||||
retVal.append(theServerBase);
|
||||
if (retVal.charAt(retVal.length()-1) != '/') {
|
||||
if (retVal.charAt(retVal.length() - 1) != '/') {
|
||||
retVal.append('/');
|
||||
}
|
||||
if (isNotBlank(getResourceType())) {
|
||||
retVal.append(getResourceType());
|
||||
}else {
|
||||
} else {
|
||||
retVal.append(theResourceType);
|
||||
}
|
||||
retVal.append('/');
|
||||
@ -324,12 +330,58 @@ public class IdDt extends BasePrimitive<String> {
|
||||
public IdDt withoutVersion() {
|
||||
int i = myValue.indexOf(Constants.PARAM_HISTORY);
|
||||
if (i > 1) {
|
||||
return new IdDt(myValue.substring(0, i-1));
|
||||
}else {
|
||||
return new IdDt(myValue.substring(0, i - 1));
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public IdDt unqualified() {
|
||||
return new IdDt(getResourceType(), getUnqualifiedId(), getUnqualifiedVersionId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this IdDt matches the given IdDt in terms of resource type and ID, but ignores the URL base
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean equalsIgnoreBase(IdDt theId) {
|
||||
if (theId == null) {
|
||||
return false;
|
||||
}
|
||||
if (theId.isEmpty()) {
|
||||
return isEmpty();
|
||||
}
|
||||
return ObjectUtils.equals(getResourceType(), theId.getResourceType()) && ObjectUtils.equals(getUnqualifiedId(), theId.getUnqualifiedId()) && ObjectUtils.equals(getUnqualifiedVersionId(), theId.getUnqualifiedVersionId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the ID is a local reference (in other words, it begins with the '#' character)
|
||||
*/
|
||||
public boolean isLocal() {
|
||||
return myUnqualifiedId != null && myUnqualifiedId.isEmpty() == false && myUnqualifiedId.charAt(0) == '#';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID
|
||||
* noted by theVersion.
|
||||
*
|
||||
* @param theVersion
|
||||
* The actual version string, e.g. "1"
|
||||
* @return A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted
|
||||
* by theVersion.
|
||||
*/
|
||||
public IdDt withVersion(String theVersion) {
|
||||
Validate.notBlank(theVersion, "Version may not be null or empty");
|
||||
|
||||
int i = myValue.indexOf(Constants.PARAM_HISTORY);
|
||||
String value;
|
||||
if (i > 1) {
|
||||
value = myValue.substring(0, i - 1);
|
||||
} else {
|
||||
value = myValue;
|
||||
}
|
||||
|
||||
return new IdDt(value + '/' + Constants.PARAM_HISTORY + '/' + theVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -121,4 +121,18 @@ public class UriDt extends BasePrimitive<URI> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new UriDt instance which uses the given OID as the content (and prepends "urn:oid:" to the
|
||||
* OID string in the value of the newly created UriDt, per the FHIR specification).
|
||||
*
|
||||
* @param theOid The OID to use (<code>null</code> is acceptable and will result in a UriDt instance with a <code>null</code> value)
|
||||
* @return A new UriDt instance
|
||||
*/
|
||||
public static UriDt fromOid(String theOid) {
|
||||
if (theOid == null) {
|
||||
return new UriDt();
|
||||
}
|
||||
return new UriDt("urn:oid:" + theOid);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeChildChoiceDefinition;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
@ -44,6 +45,11 @@ import ca.uhn.fhir.model.primitive.IdDt;
|
||||
public abstract class BaseParser implements IParser {
|
||||
|
||||
private boolean mySuppressNarratives;
|
||||
private FhirContext myContext;
|
||||
|
||||
public BaseParser(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagList parseTagList(String theString) {
|
||||
@ -116,7 +122,13 @@ public abstract class BaseParser implements IParser {
|
||||
}
|
||||
|
||||
public void containResourcesForEncoding(IResource theResource) {
|
||||
List<ResourceReferenceDt> allElements = theResource.getAllPopulatedChildElementsOfType(ResourceReferenceDt.class);
|
||||
containResourcesForEncoding(theResource, theResource);
|
||||
}
|
||||
|
||||
private long myNextContainedId = 1;
|
||||
|
||||
private void containResourcesForEncoding(IResource theResource, IResource theTarget) {
|
||||
List<ResourceReferenceDt> allElements = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, ResourceReferenceDt.class);
|
||||
|
||||
Set<String> allIds = new HashSet<String>();
|
||||
|
||||
@ -124,15 +136,18 @@ public abstract class BaseParser implements IParser {
|
||||
IResource resource = next.getResource();
|
||||
if (resource != null) {
|
||||
if (resource.getId().isEmpty()) {
|
||||
resource.setId(new IdDt(UUID.randomUUID().toString()));
|
||||
resource.setId(new IdDt(myNextContainedId++));
|
||||
// resource.setId(new IdDt(UUID.randomUUID().toString()));
|
||||
}
|
||||
|
||||
if (!allIds.contains(resource.getId().getValue())) {
|
||||
theResource.getContained().getContainedResources().add(resource);
|
||||
theTarget.getContained().getContainedResources().add(resource);
|
||||
allIds.add(resource.getId().getValue());
|
||||
}
|
||||
|
||||
next.setReference("#" + resource.getId().getValue());
|
||||
|
||||
containResourcesForEncoding(resource, theTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
private boolean myPrettyPrint;
|
||||
|
||||
public JsonParser(FhirContext theContext) {
|
||||
super(theContext);
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
@ -180,7 +181,9 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
for (BundleEntry nextEntry : theBundle.getEntries()) {
|
||||
eventWriter.writeStartObject();
|
||||
|
||||
writeTagWithTextNode(eventWriter, "deleted", nextEntry.getDeletedAt());
|
||||
if (nextEntry.getDeletedAt() !=null&&nextEntry.getDeletedAt().isEmpty()==false) {
|
||||
writeTagWithTextNode(eventWriter, "deleted", nextEntry.getDeletedAt());
|
||||
}
|
||||
writeTagWithTextNode(eventWriter, "title", nextEntry.getTitle());
|
||||
writeTagWithTextNode(eventWriter, "id", nextEntry.getId());
|
||||
|
||||
@ -211,7 +214,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
IResource resource = nextEntry.getResource();
|
||||
if (resource != null && !resource.isEmpty()) {
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource);
|
||||
encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content");
|
||||
encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content", false);
|
||||
}
|
||||
|
||||
eventWriter.writeEnd(); // entry object
|
||||
@ -272,7 +275,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
}
|
||||
case RESOURCE_REF: {
|
||||
ResourceReferenceDt referenceDt = (ResourceReferenceDt) theValue;
|
||||
IdDt value = referenceDt.getResourceId();
|
||||
IdDt value = referenceDt.getReference();
|
||||
if (theChildName != null) {
|
||||
theWriter.writeStartObject(theChildName);
|
||||
} else {
|
||||
@ -299,7 +302,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
theWriter.writeStartArray(theChildName);
|
||||
ContainedDt value = (ContainedDt) theValue;
|
||||
for (IResource next : value.getContainedResources()) {
|
||||
encodeResourceToJsonStreamWriter(theResDef, next, theWriter, null);
|
||||
encodeResourceToJsonStreamWriter(theResDef, next, theWriter, null, true);
|
||||
}
|
||||
theWriter.writeEnd();
|
||||
break;
|
||||
@ -465,8 +468,10 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
encodeCompositeElementChildrenToStreamWriter(theResDef, theResource, theElement, theEventWriter, resDef.getChildren());
|
||||
}
|
||||
|
||||
private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IResource theResource, JsonGenerator theEventWriter, String theObjectNameOrNull) throws IOException {
|
||||
super.containResourcesForEncoding(theResource);
|
||||
private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IResource theResource, JsonGenerator theEventWriter, String theObjectNameOrNull, boolean theIsSubElementWithinResource) throws IOException {
|
||||
if (!theIsSubElementWithinResource) {
|
||||
super.containResourcesForEncoding(theResource);
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
|
||||
|
||||
@ -477,7 +482,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
}
|
||||
|
||||
theEventWriter.write("resourceType", resDef.getName());
|
||||
if (theResource.getId() != null && isNotBlank(theResource.getId().getValue())) {
|
||||
if (theIsSubElementWithinResource && theResource.getId() != null && isNotBlank(theResource.getId().getValue())) {
|
||||
theEventWriter.write("id", theResource.getId().getValue());
|
||||
}
|
||||
|
||||
@ -499,7 +504,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||
JsonGenerator eventWriter = createJsonGenerator(theWriter);
|
||||
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
|
||||
encodeResourceToJsonStreamWriter(resDef, theResource, eventWriter, null);
|
||||
encodeResourceToJsonStreamWriter(resDef, theResource, eventWriter, null,false);
|
||||
eventWriter.flush();
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,37 @@ class ParserState<T> {
|
||||
return myState.isPreResource();
|
||||
}
|
||||
|
||||
private void pop() {
|
||||
myState = myState.myStack;
|
||||
myState.wereBack();
|
||||
}
|
||||
|
||||
private void push(BaseState theState) {
|
||||
theState.setStack(myState);
|
||||
myState = theState;
|
||||
}
|
||||
|
||||
private void putPlacerResourceInDeletedEntry(BundleEntry entry) {
|
||||
IdDt id = null;
|
||||
if (entry.getLinkSelf() != null && entry.getLinkSelf().isEmpty() == false) {
|
||||
id = new IdDt(entry.getLinkSelf().getValue());
|
||||
} else {
|
||||
id = entry.getId();
|
||||
}
|
||||
|
||||
IResource resource = entry.getResource();
|
||||
if (resource == null && id != null && isNotBlank(id.getResourceType())) {
|
||||
resource = myContext.getResourceDefinition(id.getResourceType()).newInstance();
|
||||
resource.setId(id);
|
||||
entry.setResource(resource);
|
||||
}
|
||||
|
||||
if (resource != null) {
|
||||
resource.getResourceMetadata().put(ResourceMetadataKeyEnum.DELETED_AT, entry.getDeletedAt());
|
||||
resource.getResourceMetadata().put(ResourceMetadataKeyEnum.VERSION_ID, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void string(String theData) {
|
||||
myState.string(theData);
|
||||
}
|
||||
@ -128,16 +159,6 @@ class ParserState<T> {
|
||||
myState.xmlEvent(theNextEvent);
|
||||
}
|
||||
|
||||
private void pop() {
|
||||
myState = myState.myStack;
|
||||
myState.wereBack();
|
||||
}
|
||||
|
||||
private void push(BaseState theState) {
|
||||
theState.setStack(myState);
|
||||
myState = theState;
|
||||
}
|
||||
|
||||
public static ParserState<Bundle> getPreAtomInstance(FhirContext theContext, Class<? extends IResource> theResourceType, boolean theJsonMode) throws DataFormatException {
|
||||
ParserState<Bundle> retVal = new ParserState<Bundle>(theContext, theJsonMode);
|
||||
retVal.push(retVal.new PreAtomState(theResourceType));
|
||||
@ -191,13 +212,10 @@ class ParserState<T> {
|
||||
|
||||
private static final int STATE_LABEL = 2;
|
||||
private static final int STATE_NONE = 0;
|
||||
|
||||
private static final int STATE_SCHEME = 3;
|
||||
|
||||
private static final int STATE_TERM = 1;
|
||||
|
||||
|
||||
private int myCatState = STATE_NONE;
|
||||
|
||||
private Tag myInstance;
|
||||
|
||||
public AtomCategoryState(Tag theEntry) {
|
||||
@ -261,32 +279,68 @@ class ParserState<T> {
|
||||
|
||||
}
|
||||
|
||||
private void putPlacerResourceInDeletedEntry(BundleEntry entry) {
|
||||
IdDt id = null;
|
||||
if (entry.getLinkSelf() != null && entry.getLinkSelf().isEmpty() == false) {
|
||||
id = new IdDt(entry.getLinkSelf().getValue());
|
||||
} else {
|
||||
id = entry.getId();
|
||||
public class AtomDeletedEntryState extends AtomEntryState {
|
||||
|
||||
public AtomDeletedEntryState(Bundle theInstance, Class<? extends IResource> theResourceType) {
|
||||
super(theInstance, theResourceType);
|
||||
}
|
||||
|
||||
IResource resource = entry.getResource();
|
||||
if (resource == null && id != null && isNotBlank(id.getResourceType())) {
|
||||
resource = myContext.getResourceDefinition(id.getResourceType()).newInstance();
|
||||
resource.setId(id);
|
||||
entry.setResource(resource);
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
if ("ref".equals(theName)) {
|
||||
getEntry().setId(new IdDt(theValue));
|
||||
} else if ("when".equals(theName)) {
|
||||
getEntry().setDeleted(new InstantDt(theValue));
|
||||
}
|
||||
}
|
||||
|
||||
if (resource != null) {
|
||||
resource.getResourceMetadata().put(ResourceMetadataKeyEnum.DELETED_AT, entry.getDeletedAt());
|
||||
resource.getResourceMetadata().put(ResourceMetadataKeyEnum.VERSION_ID, id);
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
putPlacerResourceInDeletedEntry(getEntry());
|
||||
super.endingElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomDeletedJsonWhenState extends BaseState {
|
||||
|
||||
private String myData;
|
||||
private IPrimitiveDatatype<?> myPrimitive;
|
||||
|
||||
public AtomDeletedJsonWhenState(IPrimitiveDatatype<?> thePrimitive) {
|
||||
super(null);
|
||||
Validate.notNull(thePrimitive, "thePrimitive");
|
||||
myPrimitive = thePrimitive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
myData = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
myPrimitive.setValueAsString(myData);
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag: " + theLocalPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class AtomEntryState extends BaseState {
|
||||
|
||||
private boolean myDeleted;
|
||||
private BundleEntry myEntry;
|
||||
private Class<? extends IResource> myResourceType;
|
||||
private boolean myDeleted;
|
||||
|
||||
public AtomEntryState(Bundle theInstance, Class<? extends IResource> theResourceType) {
|
||||
super(null);
|
||||
@ -295,10 +349,6 @@ class ParserState<T> {
|
||||
theInstance.getEntries().add(myEntry);
|
||||
}
|
||||
|
||||
protected BundleEntry getEntry() {
|
||||
return myEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
populateResourceMetadata();
|
||||
@ -340,6 +390,10 @@ class ParserState<T> {
|
||||
// TODO: handle category
|
||||
}
|
||||
|
||||
protected BundleEntry getEntry() {
|
||||
return myEntry;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void populateResourceMetadata() {
|
||||
if (myEntry.getResource() == null) {
|
||||
@ -351,19 +405,19 @@ class ParserState<T> {
|
||||
myEntry.getResource().setId(id);
|
||||
}
|
||||
|
||||
Map<ResourceMetadataKeyEnum, Object> metadata = myEntry.getResource().getResourceMetadata();
|
||||
Map<ResourceMetadataKeyEnum<?>, Object> metadata = myEntry.getResource().getResourceMetadata();
|
||||
if (myEntry.getPublished().isEmpty() == false) {
|
||||
metadata.put(ResourceMetadataKeyEnum.PUBLISHED, myEntry.getPublished());
|
||||
ResourceMetadataKeyEnum.PUBLISHED.put(myEntry.getResource(), myEntry.getPublished());
|
||||
}
|
||||
if (myEntry.getUpdated().isEmpty() == false) {
|
||||
metadata.put(ResourceMetadataKeyEnum.UPDATED, myEntry.getUpdated());
|
||||
ResourceMetadataKeyEnum.UPDATED.put(myEntry.getResource(), myEntry.getUpdated());
|
||||
}
|
||||
if (myEntry.getCategories().isEmpty() == false) {
|
||||
TagList tagList = new TagList();
|
||||
for (Tag next : myEntry.getCategories()) {
|
||||
tagList.add(next);
|
||||
}
|
||||
metadata.put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(myEntry.getResource(), tagList);
|
||||
}
|
||||
if (!myEntry.getLinkSelf().isEmpty()) {
|
||||
String linkSelfValue = myEntry.getLinkSelf().getValue();
|
||||
@ -378,29 +432,6 @@ class ParserState<T> {
|
||||
|
||||
}
|
||||
|
||||
public class AtomDeletedEntryState extends AtomEntryState {
|
||||
|
||||
public AtomDeletedEntryState(Bundle theInstance, Class<? extends IResource> theResourceType) {
|
||||
super(theInstance, theResourceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
if ("ref".equals(theName)) {
|
||||
getEntry().setId(new IdDt(theValue));
|
||||
} else if ("when".equals(theName)) {
|
||||
getEntry().setDeleted(new InstantDt(theValue));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
putPlacerResourceInDeletedEntry(getEntry());
|
||||
super.endingElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomLinkState extends BaseState {
|
||||
|
||||
private BundleEntry myEntry;
|
||||
@ -460,77 +491,6 @@ class ParserState<T> {
|
||||
|
||||
}
|
||||
|
||||
private class BinaryResourceState extends BaseState {
|
||||
|
||||
private static final int SUBSTATE_CT = 1;
|
||||
private static final int SUBSTATE_CONTENT = 2;
|
||||
private Binary myInstance;
|
||||
private String myData;
|
||||
private int mySubState = 0;
|
||||
|
||||
public BinaryResourceState(PreResourceState thePreResourceState, Binary theInstance) {
|
||||
super(thePreResourceState);
|
||||
myInstance = theInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
if ("contentType".equals(theName)) {
|
||||
myInstance.setContentType(theValue);
|
||||
} else if (myJsonMode && "value".equals(theName)) {
|
||||
string(theValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
if (mySubState == SUBSTATE_CT) {
|
||||
myInstance.setContentType(myData);
|
||||
mySubState = 0;
|
||||
myData=null;
|
||||
return;
|
||||
} else if (mySubState == SUBSTATE_CONTENT) {
|
||||
myInstance.setContentAsBase64(myData);
|
||||
mySubState = 0;
|
||||
myData=null;
|
||||
return;
|
||||
} else {
|
||||
if (!myJsonMode) {
|
||||
myInstance.setContentAsBase64(myData);
|
||||
}
|
||||
pop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
if (myJsonMode && "contentType".equals(theLocalPart) && mySubState == 0) {
|
||||
mySubState = SUBSTATE_CT;
|
||||
} else if (myJsonMode && "content".equals(theLocalPart) && mySubState == 0) {
|
||||
mySubState = SUBSTATE_CONTENT;
|
||||
} else {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag: " + theLocalPart);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void string(String theData) {
|
||||
if (myData == null) {
|
||||
myData = theData;
|
||||
} else {
|
||||
// this shouldn't generally happen so it's ok that it's
|
||||
// inefficient
|
||||
myData = myData + theData;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomPrimitiveState extends BaseState {
|
||||
|
||||
private String myData;
|
||||
@ -561,6 +521,11 @@ class ParserState<T> {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag: " + theLocalPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void string(String theData) {
|
||||
if (myData == null) {
|
||||
@ -572,45 +537,6 @@ class ParserState<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomDeletedJsonWhenState extends BaseState {
|
||||
|
||||
private String myData;
|
||||
private IPrimitiveDatatype<?> myPrimitive;
|
||||
|
||||
public AtomDeletedJsonWhenState(IPrimitiveDatatype<?> thePrimitive) {
|
||||
super(null);
|
||||
Validate.notNull(thePrimitive, "thePrimitive");
|
||||
myPrimitive = thePrimitive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
myPrimitive.setValueAsString(myData);
|
||||
pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag: " + theLocalPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
myData = theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AtomState extends BaseState {
|
||||
@ -710,6 +636,10 @@ class ParserState<T> {
|
||||
}
|
||||
}
|
||||
|
||||
protected Object getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PreResourceState getPreResourceState() {
|
||||
return myPreResourceState;
|
||||
}
|
||||
@ -734,10 +664,77 @@ class ParserState<T> {
|
||||
// ignore
|
||||
}
|
||||
|
||||
protected Object getCurrentElement() {
|
||||
}
|
||||
|
||||
private class BinaryResourceState extends BaseState {
|
||||
|
||||
private static final int SUBSTATE_CONTENT = 2;
|
||||
private static final int SUBSTATE_CT = 1;
|
||||
private String myData;
|
||||
private Binary myInstance;
|
||||
private int mySubState = 0;
|
||||
|
||||
public BinaryResourceState(PreResourceState thePreResourceState, Binary theInstance) {
|
||||
super(thePreResourceState);
|
||||
myInstance = theInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
if ("contentType".equals(theName)) {
|
||||
myInstance.setContentType(theValue);
|
||||
} else if (myJsonMode && "value".equals(theName)) {
|
||||
string(theValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endingElement() throws DataFormatException {
|
||||
if (mySubState == SUBSTATE_CT) {
|
||||
myInstance.setContentType(myData);
|
||||
mySubState = 0;
|
||||
myData=null;
|
||||
return;
|
||||
} else if (mySubState == SUBSTATE_CONTENT) {
|
||||
myInstance.setContentAsBase64(myData);
|
||||
mySubState = 0;
|
||||
myData=null;
|
||||
return;
|
||||
} else {
|
||||
if (!myJsonMode) {
|
||||
myInstance.setContentAsBase64(myData);
|
||||
}
|
||||
pop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
if (myJsonMode && "contentType".equals(theLocalPart) && mySubState == 0) {
|
||||
mySubState = SUBSTATE_CT;
|
||||
} else if (myJsonMode && "content".equals(theLocalPart) && mySubState == 0) {
|
||||
mySubState = SUBSTATE_CONTENT;
|
||||
} else {
|
||||
throw new DataFormatException("Unexpected nested element in atom tag: " + theLocalPart);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void string(String theData) {
|
||||
if (myData == null) {
|
||||
myData = theData;
|
||||
} else {
|
||||
// this shouldn't generally happen so it's ok that it's
|
||||
// inefficient
|
||||
myData = myData + theData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ContainedResourcesState extends PreResourceState {
|
||||
@ -811,7 +808,7 @@ class ParserState<T> {
|
||||
case RESOURCE_REF: {
|
||||
ResourceReferenceDt newChildInstance = new ResourceReferenceDt();
|
||||
myDefinition.getMutator().addValue(myParentInstance, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), (RuntimeResourceReferenceDefinition) target, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
@ -917,7 +914,7 @@ class ParserState<T> {
|
||||
ResourceReferenceDt newChildInstance = new ResourceReferenceDt();
|
||||
getPreResourceState().getResourceReferences().add(newChildInstance);
|
||||
child.getMutator().addValue(myInstance, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), resourceRefTarget, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
@ -952,7 +949,8 @@ class ParserState<T> {
|
||||
return;
|
||||
}
|
||||
case UNDECL_EXT:
|
||||
case RESOURCE: {
|
||||
case RESOURCE:
|
||||
case EXTENSION_DECLARED:{
|
||||
// Throw an exception because this shouldn't happen here
|
||||
break;
|
||||
}
|
||||
@ -1023,7 +1021,7 @@ class ParserState<T> {
|
||||
case RESOURCE_REF: {
|
||||
ResourceReferenceDt newChildInstance = new ResourceReferenceDt();
|
||||
myExtension.setValue(newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), null, newChildInstance);
|
||||
ResourceReferenceState newState = new ResourceReferenceState(getPreResourceState(), newChildInstance);
|
||||
push(newState);
|
||||
return;
|
||||
}
|
||||
@ -1031,6 +1029,8 @@ class ParserState<T> {
|
||||
case RESOURCE:
|
||||
case RESOURCE_BLOCK:
|
||||
case UNDECL_EXT:
|
||||
case EXTENSION_DECLARED:
|
||||
case CONTAINED_RESOURCES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1068,17 +1068,17 @@ class ParserState<T> {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void wereBack() {
|
||||
myObject = (T) myInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PreResourceState extends BaseState {
|
||||
@ -1087,7 +1087,6 @@ class ParserState<T> {
|
||||
private BundleEntry myEntry;
|
||||
private IResource myInstance;
|
||||
private List<ResourceReferenceDt> myResourceReferences = new ArrayList<ResourceReferenceDt>();
|
||||
|
||||
private Class<? extends IResource> myResourceType;
|
||||
|
||||
public PreResourceState(BundleEntry theEntry, Class<? extends IResource> theResourceType) {
|
||||
@ -1113,7 +1112,7 @@ class ParserState<T> {
|
||||
public void endingElement() throws DataFormatException {
|
||||
pop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
BaseRuntimeElementDefinition<?> definition;
|
||||
@ -1136,9 +1135,9 @@ class ParserState<T> {
|
||||
}
|
||||
|
||||
if ("Binary".equals(def.getName())) {
|
||||
push(new BinaryResourceState(this, (Binary) myInstance));
|
||||
push(new BinaryResourceState(getRootPreResourceState(), (Binary) myInstance));
|
||||
} else {
|
||||
push(new ElementCompositeState(this, def, myInstance));
|
||||
push(new ElementCompositeState(getRootPreResourceState(), def, myInstance));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1146,10 +1145,23 @@ class ParserState<T> {
|
||||
return myContainedResources;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IResource getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
public List<ResourceReferenceDt> getResourceReferences() {
|
||||
return myResourceReferences;
|
||||
}
|
||||
|
||||
private PreResourceState getRootPreResourceState() {
|
||||
if (getPreResourceState() != null) {
|
||||
return getPreResourceState();
|
||||
}else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreResource() {
|
||||
return true;
|
||||
@ -1178,11 +1190,6 @@ class ParserState<T> {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IResource getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PreTagListState extends BaseState {
|
||||
@ -1208,6 +1215,11 @@ class ParserState<T> {
|
||||
push(new TagListState(myTagList));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TagList getCurrentElement() {
|
||||
return myTagList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreResource() {
|
||||
return true;
|
||||
@ -1219,11 +1231,6 @@ class ParserState<T> {
|
||||
myObject = (T) myTagList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TagList getCurrentElement() {
|
||||
return myTagList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class PrimitiveState extends BaseState {
|
||||
@ -1279,7 +1286,7 @@ class ParserState<T> {
|
||||
private ResourceReferenceDt myInstance;
|
||||
private ResourceReferenceSubState mySubState;
|
||||
|
||||
public ResourceReferenceState(PreResourceState thePreResourceState, RuntimeResourceReferenceDefinition theTarget, ResourceReferenceDt theInstance) {
|
||||
public ResourceReferenceState(PreResourceState thePreResourceState, ResourceReferenceDt theInstance) {
|
||||
super(thePreResourceState);
|
||||
myInstance = theInstance;
|
||||
mySubState = ResourceReferenceSubState.INITIAL;
|
||||
@ -1507,6 +1514,11 @@ class ParserState<T> {
|
||||
super.endingElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myDt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void xmlEvent(XMLEvent theEvent) {
|
||||
if (theEvent.isEndElement()) {
|
||||
@ -1529,11 +1541,6 @@ class ParserState<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IElement getCurrentElement() {
|
||||
return myDt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ public class XmlParser extends BaseParser implements IParser {
|
||||
private XMLOutputFactory myXmlOutputFactory;
|
||||
|
||||
public XmlParser(FhirContext theContext) {
|
||||
super(theContext);
|
||||
myContext = theContext;
|
||||
myXmlInputFactory = XMLInputFactory.newInstance();
|
||||
myXmlOutputFactory = XMLOutputFactory.newInstance();
|
||||
@ -543,7 +544,9 @@ public class XmlParser extends BaseParser implements IParser {
|
||||
*
|
||||
*/
|
||||
private void encodeResourceToXmlStreamWriter(IResource theResource, XMLStreamWriter theEventWriter, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
super.containResourcesForEncoding(theResource);
|
||||
if (!theIncludedResource) {
|
||||
super.containResourcesForEncoding(theResource);
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
|
||||
if (resDef == null) {
|
||||
|
@ -37,6 +37,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.dstu.resource.Conformance;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
@ -49,7 +50,6 @@ import ca.uhn.fhir.rest.gclient.IParam;
|
||||
import ca.uhn.fhir.rest.gclient.IQuery;
|
||||
import ca.uhn.fhir.rest.gclient.ISort;
|
||||
import ca.uhn.fhir.rest.gclient.IUntypedQuery;
|
||||
import ca.uhn.fhir.rest.gclient.Include;
|
||||
import ca.uhn.fhir.rest.method.BaseOutcomeReturningMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.ConformanceMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.CreateMethodBinding;
|
||||
@ -379,7 +379,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
||||
}
|
||||
|
||||
for (Include next : myInclude) {
|
||||
addParam(params, Constants.PARAM_INCLUDE, next.getInclude());
|
||||
addParam(params, Constants.PARAM_INCLUDE, next.getValue());
|
||||
}
|
||||
|
||||
for (SortInternal next : mySort) {
|
||||
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.rest.gclient;
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
|
||||
public interface IQuery {
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
* %%
|
||||
* Copyright (C) 2014 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 Include {
|
||||
|
||||
private String myInclude;
|
||||
|
||||
public Include(String theInclude) {
|
||||
myInclude = theInclude;
|
||||
}
|
||||
|
||||
public String getInclude() {
|
||||
return myInclude;
|
||||
}
|
||||
|
||||
}
|
@ -32,7 +32,7 @@ class TokenCriterion implements ICriterion, ICriterionInternal {
|
||||
if (StringUtils.isNotBlank(theSystem)) {
|
||||
myValue = theSystem + "|" + StringUtils.defaultString(theCode);
|
||||
} else {
|
||||
myValue = StringUtils.defaultString(theCode);
|
||||
myValue = "|" + StringUtils.defaultString(theCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR Library
|
||||
@ -58,6 +60,11 @@ public class TokenParam implements IParam {
|
||||
public ICriterion identifier(String theIdentifier) {
|
||||
return new TokenCriterion(getParamName(), null, theIdentifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICriterion identifier(IdentifierDt theIdentifier) {
|
||||
return new TokenCriterion(getParamName(), theIdentifier.getSystem().getValueAsString(), theIdentifier.getValue().getValue());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -101,6 +108,15 @@ public class TokenParam implements IParam {
|
||||
* @return A criterion
|
||||
*/
|
||||
ICriterion code(String theIdentifier);
|
||||
|
||||
/**
|
||||
* Creates a search criterion that matches against the given identifier (system and code if both are present, or whatever is present)
|
||||
*
|
||||
* @param theIdentifier
|
||||
* The identifier
|
||||
* @return A criterion
|
||||
*/
|
||||
ICriterion identifier(IdentifierDt theIdentifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public abstract class BaseQueryParameter implements IParameter {
|
||||
|
||||
if (paramList.isEmpty()) {
|
||||
if (handlesMissing()) {
|
||||
return paramList;
|
||||
return parse(paramList);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.model.api.IQueryParameterAnd;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterOr;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
@ -184,8 +186,12 @@ public class DateRangeParam implements IQueryParameterAnd {
|
||||
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
|
||||
*/
|
||||
public void setRangeFromDatesInclusive(Date theLowerBound, Date theUpperBound) {
|
||||
myLowerBound = new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, theLowerBound);
|
||||
myUpperBound = new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, theUpperBound);
|
||||
if (theLowerBound != null) {
|
||||
myLowerBound = new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, theLowerBound);
|
||||
}
|
||||
if (theUpperBound != null) {
|
||||
myUpperBound = new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, theUpperBound);
|
||||
}
|
||||
validateAndThrowDataFormatExceptionIfInvalid();
|
||||
}
|
||||
|
||||
@ -200,8 +206,12 @@ public class DateRangeParam implements IQueryParameterAnd {
|
||||
* "2011-02-22" or "2011-02-22T13:12:00". Will be treated inclusively.
|
||||
*/
|
||||
public void setRangeFromDatesInclusive(String theLowerBound, String theUpperBound) {
|
||||
myLowerBound = new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, theLowerBound);
|
||||
myUpperBound = new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, theUpperBound);
|
||||
if (StringUtils.isNotBlank(theLowerBound)) {
|
||||
myLowerBound = new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, theLowerBound);
|
||||
}
|
||||
if (StringUtils.isNotBlank(theUpperBound)) {
|
||||
myUpperBound = new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, theUpperBound);
|
||||
}
|
||||
validateAndThrowDataFormatExceptionIfInvalid();
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import java.util.TreeSet;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.PathSpecification;
|
||||
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
@ -37,11 +38,11 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
||||
public class IncludeParameter extends BaseQueryParameter {
|
||||
|
||||
private Class<? extends Collection<PathSpecification>> myInstantiableCollectionType;
|
||||
private Class<? extends Collection<Include>> myInstantiableCollectionType;
|
||||
private HashSet<String> myAllow;
|
||||
private Class<?> mySpecType;
|
||||
|
||||
public IncludeParameter(IncludeParam theAnnotation, Class<? extends Collection<PathSpecification>> theInstantiableCollectionType, Class<?> theSpecType) {
|
||||
public IncludeParameter(IncludeParam theAnnotation, Class<? extends Collection<Include>> theInstantiableCollectionType, Class<?> theSpecType) {
|
||||
myInstantiableCollectionType = theInstantiableCollectionType;
|
||||
if (theAnnotation.allow().length > 0) {
|
||||
myAllow = new HashSet<String>();
|
||||
@ -49,12 +50,12 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
myAllow.add(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mySpecType = theSpecType;
|
||||
if (mySpecType != PathSpecification.class && mySpecType != String.class) {
|
||||
if (mySpecType != Include.class && mySpecType != PathSpecification.class && mySpecType != String.class) {
|
||||
throw new ConfigurationException("Invalid @" + IncludeParam.class.getSimpleName() + " parameter type: " + mySpecType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -63,18 +64,20 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
ArrayList<QualifiedParamList> retVal = new ArrayList<QualifiedParamList>();
|
||||
|
||||
if (myInstantiableCollectionType == null) {
|
||||
if (mySpecType == PathSpecification.class) {
|
||||
retVal.add(QualifiedParamList.singleton(((PathSpecification)theObject).getValue()));
|
||||
if (mySpecType == Include.class) {
|
||||
retVal.add(QualifiedParamList.singleton(((Include) theObject).getValue()));
|
||||
}else if (mySpecType == PathSpecification.class) {
|
||||
retVal.add(QualifiedParamList.singleton(((PathSpecification) theObject).getValue()));
|
||||
} else {
|
||||
retVal.add(QualifiedParamList.singleton(((String)theObject)));
|
||||
retVal.add(QualifiedParamList.singleton(((String) theObject)));
|
||||
}
|
||||
}else {
|
||||
Collection<PathSpecification> val = (Collection<PathSpecification>) theObject;
|
||||
for (PathSpecification pathSpec : val) {
|
||||
} else {
|
||||
Collection<Include> val = (Collection<Include>) theObject;
|
||||
for (Include pathSpec : val) {
|
||||
retVal.add(QualifiedParamList.singleton(pathSpec.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@ -85,15 +88,15 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
|
||||
@Override
|
||||
public Object parse(List<QualifiedParamList> theString) throws InternalErrorException, InvalidRequestException {
|
||||
Collection<PathSpecification> retValCollection = null;
|
||||
if (myInstantiableCollectionType!=null) {
|
||||
try {
|
||||
retValCollection = myInstantiableCollectionType.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new InternalErrorException("Failed to instantiate " + myInstantiableCollectionType.getName(), e);
|
||||
Collection<Include> retValCollection = null;
|
||||
if (myInstantiableCollectionType != null) {
|
||||
try {
|
||||
retValCollection = myInstantiableCollectionType.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new InternalErrorException("Failed to instantiate " + myInstantiableCollectionType.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (List<String> nextParamList : theString) {
|
||||
if (nextParamList.isEmpty()) {
|
||||
continue;
|
||||
@ -101,7 +104,7 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
if (nextParamList.size() > 1) {
|
||||
throw new InvalidRequestException("'OR' query parameters (values containing ',') are not supported in _include parameters");
|
||||
}
|
||||
|
||||
|
||||
String value = nextParamList.get(0);
|
||||
if (myAllow != null) {
|
||||
if (!myAllow.contains(value)) {
|
||||
@ -111,14 +114,20 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
if (retValCollection == null) {
|
||||
if (mySpecType == String.class) {
|
||||
return value;
|
||||
} else {
|
||||
} else if (mySpecType == PathSpecification.class) {
|
||||
return new PathSpecification(value);
|
||||
} else {
|
||||
return new Include(value);
|
||||
}
|
||||
} else {
|
||||
if (mySpecType == PathSpecification.class) {
|
||||
retValCollection.add(new PathSpecification(value));
|
||||
} else {
|
||||
retValCollection.add(new Include(value));
|
||||
}
|
||||
}else {
|
||||
retValCollection.add(new PathSpecification(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return retValCollection;
|
||||
}
|
||||
|
||||
@ -137,5 +146,4 @@ public class IncludeParameter extends BaseQueryParameter {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterOr;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.PathSpecification;
|
||||
import ca.uhn.fhir.model.api.TagList;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.TagListParam;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.rest.annotation.TransactionParam;
|
||||
import ca.uhn.fhir.rest.annotation.Count;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
@ -60,6 +60,7 @@ import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||
import ca.uhn.fhir.rest.annotation.ServerBase;
|
||||
import ca.uhn.fhir.rest.annotation.Since;
|
||||
import ca.uhn.fhir.rest.annotation.Sort;
|
||||
import ca.uhn.fhir.rest.annotation.TransactionParam;
|
||||
import ca.uhn.fhir.rest.annotation.VersionIdParam;
|
||||
import ca.uhn.fhir.rest.method.QualifiedParamList;
|
||||
import ca.uhn.fhir.util.ReflectionUtil;
|
||||
@ -197,17 +198,17 @@ public class ParameterUtil {
|
||||
extractDescription(parameter, annotations);
|
||||
param = parameter;
|
||||
} else if (nextAnnotation instanceof IncludeParam) {
|
||||
Class<? extends Collection<PathSpecification>> instantiableCollectionType;
|
||||
Class<? extends Collection<Include>> instantiableCollectionType;
|
||||
Class<?> specType;
|
||||
|
||||
if (parameterType == String.class) {
|
||||
instantiableCollectionType = null;
|
||||
specType = String.class;
|
||||
} else if (parameterType != PathSpecification.class || innerCollectionType == null || outerCollectionType != null) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' is annotated with @" + IncludeParam.class.getSimpleName() + " but has a type other than Collection<" + PathSpecification.class.getSimpleName() + ">");
|
||||
} else if ((parameterType != Include.class && parameterType != PathSpecification.class) || innerCollectionType == null || outerCollectionType != null) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' is annotated with @" + IncludeParam.class.getSimpleName() + " but has a type other than Collection<" + Include.class.getSimpleName() + ">");
|
||||
} else {
|
||||
instantiableCollectionType = (Class<? extends Collection<PathSpecification>>) CollectionBinder.getInstantiableCollectionType(innerCollectionType, "Method '" + theMethod.getName() + "'");
|
||||
specType = PathSpecification.class;
|
||||
instantiableCollectionType = (Class<? extends Collection<Include>>) CollectionBinder.getInstantiableCollectionType(innerCollectionType, "Method '" + theMethod.getName() + "'");
|
||||
specType = parameterType;
|
||||
}
|
||||
|
||||
param = new IncludeParameter((IncludeParam) nextAnnotation, instantiableCollectionType, specType);
|
||||
|
@ -20,6 +20,9 @@ package ca.uhn.fhir.rest.param;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
@ -62,6 +65,16 @@ public class StringParam extends StringDt {
|
||||
return myExact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||
builder.append("value", getValue());
|
||||
if (myExact) {
|
||||
builder.append("exact", myExact);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void setExact(boolean theExact) {
|
||||
myExact = theExact;
|
||||
}
|
||||
|
@ -625,6 +625,11 @@ public class RestfulServer extends HttpServlet {
|
||||
resourceMethod.invokeServer(this, r, theResponse);
|
||||
|
||||
} catch (AuthenticationException e) {
|
||||
String userAgent = theRequest.getHeader("User-Agent");
|
||||
if (userAgent != null && userAgent.contains("Mozilla")) {
|
||||
//if request is coming from a browser, prompt the user to enter login credentials
|
||||
theResponse.setHeader("WWW-Authenticate", "BASIC realm=\"FHIR\"");
|
||||
}
|
||||
theResponse.setStatus(e.getStatusCode());
|
||||
addHeadersToResponse(theResponse);
|
||||
theResponse.setContentType("text/plain");
|
||||
|
@ -36,6 +36,7 @@ import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
|
||||
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
public class FhirTerser {
|
||||
|
||||
@ -147,7 +148,13 @@ public class FhirTerser {
|
||||
if (nextValue == null) {
|
||||
continue;
|
||||
}
|
||||
if (nextValue.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
BaseRuntimeElementDefinition<?> childElementDef = nextChild.getChildElementDefinitionByDatatype(nextValue.getClass());
|
||||
if (childElementDef == null) {
|
||||
throw new DataFormatException("Found value of type[" + nextValue.getClass().getSimpleName() + "] which is not valid for field[" + nextChild.getElementName() + "] in " + childDef.getName());
|
||||
}
|
||||
getAllChildElementsOfType(nextValue, childElementDef, theType, theList);
|
||||
}
|
||||
}
|
||||
|
@ -1,96 +0,0 @@
|
||||
Hacking HAPI
|
||||
|
||||
This page explains all of the steps neccesary to work with the actual source
|
||||
code for HAPI. This might be done for example to fix bugs, add features, or
|
||||
learn how HAPI works internally.
|
||||
|
||||
As of version 0.6, HAPI uses the {{{./http://maven.apache.org}Maven}} build system to build
|
||||
it's source code. Generating the source takes the following steps.
|
||||
|
||||
* Getting the Source
|
||||
|
||||
The first step to building HAPI is obtaining the source code. HAPI uses CVS
|
||||
as its {{{./source-repository.html}source-code repository}}.
|
||||
|
||||
Note that the correct subdirectory to check out from the repository is now
|
||||
called "hapi-mvn". There is an outdated directory called "hapi" which
|
||||
is kept only for reference.
|
||||
|
||||
If you are using Eclipse to check the project out, the project may show errors
|
||||
when you first check it out. These will be resolved by running through the build
|
||||
using Maven.
|
||||
|
||||
* Understanding the Project Structure
|
||||
|
||||
HAPI is now broken up into several subprojects:
|
||||
|
||||
*--------------------+------+
|
||||
hapi-base | This is the core of the HAPI library. It contains things such as parsers, transport, validation, etc. If you are making changes to HAPI itself, this is probably where you want to start.
|
||||
*--------------------+------+
|
||||
hapi-sourcegen | This project is used to generate message libraries. It is only used at build time.
|
||||
*--------------------+------+
|
||||
hapi-structures-vXX | These projects contain the libraries used to generate and process individual messages for a specific version of HL7. They are generated using the proprietary HL7 database provided by HL7.org, and so are usually not modified by end users of the HAPI library.
|
||||
*--------------------+------+
|
||||
hapi-examples | This project provides several annotated examples of how to use HAPI.
|
||||
*--------------------+------+
|
||||
hapi-test | This project contains unit tests for the HAPI library
|
||||
*--------------------+------+
|
||||
|
||||
|
||||
* Install the build tools
|
||||
|
||||
Download the latest version of {{{http://maven.apache.org}Maven}}. The download page also
|
||||
has instructions for installing Maven correctly.
|
||||
|
||||
|
||||
* Building HAPI
|
||||
|
||||
Building a HAPI base JAR is as simple as typing:
|
||||
|
||||
+----------------+
|
||||
mvn install
|
||||
+----------------+
|
||||
|
||||
At the end of this build, you should have a compiled JAR in the following
|
||||
subdirectory:
|
||||
|
||||
+----------------+
|
||||
[workspace]/hapi-mvn/hapi-base/target/hapi-base-VERSION.jar
|
||||
+----------------+
|
||||
|
||||
|
||||
* Set up Eclipse
|
||||
|
||||
Once Maven has been run for the first time, you will need to define an Eclipse classpath variable
|
||||
pointing to your local maven repository.
|
||||
|
||||
* First, find your local Maven repository. It will be a directory called ".m2/repository" in your home directory. So, for a user named "james", it would be in the following location, depending on OS:
|
||||
|
||||
*--------------------+------+
|
||||
Windows XP | C:\Documents and Settings\James\.m2\repository
|
||||
*--------------------+------+
|
||||
Windows Vista | C:\Users\James\.m2\repository
|
||||
*--------------------+------+
|
||||
Linux | /home/james/.m2/repository
|
||||
*--------------------+------+
|
||||
|
||||
* Next, in Eclipse, open the Preferences dialogue (in the Window menu).
|
||||
|
||||
* Navigate to the following section: Java -> Build Path -> Classpath Variables
|
||||
|
||||
* Click on "New"
|
||||
|
||||
** For "Name", enter "M2_REPO"
|
||||
|
||||
** For "Path", enter the path to the local repo. eg: "C:\Users\James\.m2\repository"
|
||||
|
||||
|
||||
* Tips and tricks
|
||||
|
||||
To skip running the unit tests, execute the following:
|
||||
|
||||
+----------------+
|
||||
mvn -Dmaven.test.skip -P CORE install
|
||||
+----------------+
|
||||
|
||||
|
@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.PathSpecification;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.api.Tag;
|
||||
import ca.uhn.fhir.model.api.TagList;
|
||||
@ -186,8 +186,7 @@ public List<Patient> getPatientHistory(@IdParam IdDt theId) {
|
||||
patient.addName().addFamily("Smith");
|
||||
|
||||
// Set the ID and version
|
||||
patient.setId(theId);
|
||||
patient.getResourceMetadata().put(ResourceMetadataKeyEnum.VERSION_ID, new IdDt("1"));
|
||||
patient.setId(theId.withVersion("1"));
|
||||
|
||||
// ...populate the rest...
|
||||
return retVal;
|
||||
@ -322,14 +321,14 @@ public List<DiagnosticReport> getDiagnosticReport(
|
||||
@RequiredParam(name=DiagnosticReport.SP_IDENTIFIER)
|
||||
IdentifierDt theIdentifier,
|
||||
@IncludeParam(allow= {"DiagnosticReport.subject"})
|
||||
Set<PathSpecification> theIncludes ) {
|
||||
Set<Include> theIncludes ) {
|
||||
List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>();
|
||||
|
||||
// Assume this method exists and loads the report from the DB
|
||||
DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier);
|
||||
|
||||
// If the client has asked for the subject to be included:
|
||||
if (theIncludes.contains(new PathSpecification("DiagnosticReport.subject"))) {
|
||||
if (theIncludes.contains(new Include("DiagnosticReport.subject"))) {
|
||||
|
||||
// The resource reference should contain the ID of the patient
|
||||
IdDt subjectId = report.getSubject().getId();
|
||||
|
@ -24,8 +24,8 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals("Organization", ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals("Organization", ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
|
||||
}
|
||||
|
||||
@ -38,9 +38,9 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals("Organization", ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals("999", ref.getResourceId().getUnqualifiedVersionId());
|
||||
assertEquals("Organization", ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
assertEquals("999", ref.getReference().getUnqualifiedVersionId());
|
||||
|
||||
}
|
||||
|
||||
@ -53,9 +53,9 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals(null, ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals("999", ref.getResourceId().getUnqualifiedVersionId());
|
||||
assertEquals(null, ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
assertEquals("999", ref.getReference().getUnqualifiedVersionId());
|
||||
|
||||
}
|
||||
|
||||
@ -69,8 +69,8 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals(null, ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals(null, ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals(null, ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals(null, ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
|
||||
}
|
||||
|
||||
@ -97,8 +97,8 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals("Organization", ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals("Organization", ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ public class IdDtTest {
|
||||
|
||||
Patient actual = parseAndEncode(patient);
|
||||
ResourceReferenceDt ref = actual.getManagingOrganization();
|
||||
assertEquals("Organization", ref.getResourceId().getResourceType());
|
||||
assertEquals("123", ref.getResourceId().getUnqualifiedId());
|
||||
assertEquals("Organization", ref.getReference().getResourceType());
|
||||
assertEquals("123", ref.getReference().getUnqualifiedId());
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
||||
|
||||
public class IdentifierDtTest {
|
||||
|
||||
@Test
|
||||
public void testTokenWithPipeInValue() {
|
||||
IdentifierDt dt = new IdentifierDt();
|
||||
dt.setValueAsQueryToken(null, "a|b|c");
|
||||
|
||||
assertEquals("a", dt.getSystem().getValueAsString());
|
||||
assertEquals("b|c", dt.getValue().getValue());
|
||||
assertEquals("a|b|c", dt.getValueAsQueryToken());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenWithPipeInValueAndNoSystem() {
|
||||
IdentifierDt dt = new IdentifierDt();
|
||||
dt.setValueAsQueryToken(null, "|b|c");
|
||||
|
||||
assertEquals("", dt.getSystem().getValueAsString());
|
||||
assertEquals("b|c", dt.getValue().getValue());
|
||||
assertEquals("|b|c", dt.getValueAsQueryToken());
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@ -23,6 +23,7 @@ import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.mockito.internal.matchers.Not;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
@ -83,6 +84,44 @@ public class JsonParserTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedContainedResources() {
|
||||
|
||||
Observation A = new Observation();
|
||||
A.getName().setText("A");
|
||||
|
||||
Observation B = new Observation();
|
||||
B.getName().setText("B");
|
||||
A.addRelated().setTarget(new ResourceReferenceDt(B));
|
||||
|
||||
Observation C = new Observation();
|
||||
C.getName().setText("C");
|
||||
B.addRelated().setTarget(new ResourceReferenceDt(C));
|
||||
|
||||
String str = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(A);
|
||||
ourLog.info(str);
|
||||
|
||||
assertThat(str, stringContainsInOrder(Arrays.asList("\"text\":\"B\"", "\"text\":\"C\"", "\"text\":\"A\"")));
|
||||
|
||||
// Only one (outer) contained block
|
||||
int idx0 = str.indexOf("\"contained\"");
|
||||
int idx1 = str.indexOf("\"contained\"",idx0+1);
|
||||
|
||||
assertNotEquals(-1, idx0);
|
||||
assertEquals(-1, idx1);
|
||||
|
||||
Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, str);
|
||||
assertEquals("A",obs.getName().getText().getValue());
|
||||
|
||||
Observation obsB = (Observation) obs.getRelatedFirstRep().getTarget().getResource();
|
||||
assertEquals("B",obsB.getName().getText().getValue());
|
||||
|
||||
Observation obsC = (Observation) obsB.getRelatedFirstRep().getTarget().getResource();
|
||||
assertEquals("C",obsC.getName().getText().getValue());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseQuery() {
|
||||
String msg = "{\n" +
|
||||
@ -308,15 +347,18 @@ public class JsonParserTest {
|
||||
MyPatientWithOneDeclaredExtension actual = parser.parseResource(MyPatientWithOneDeclaredExtension.class, val);
|
||||
assertEquals(AddressUseEnum.HOME, patient.getAddressFirstRep().getUse().getValueAsEnum());
|
||||
ResourceReferenceDt ref = actual.getFoo();
|
||||
assertEquals("Organization/123", ref.getResourceId().getValue());
|
||||
assertEquals("Organization/123", ref.getReference().getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeExt() throws Exception {
|
||||
|
||||
ValueSet valueSet = new ValueSet();
|
||||
valueSet.setId("123456");
|
||||
|
||||
Define define = valueSet.getDefine();
|
||||
DefineConcept code = define.addConcept();
|
||||
code.setCode("someCode");
|
||||
@ -326,6 +368,9 @@ public class JsonParserTest {
|
||||
String encoded = new FhirContext().newJsonParser().encodeResourceToString(valueSet);
|
||||
ourLog.info(encoded);
|
||||
|
||||
assertThat(encoded, not(containsString("123456")));
|
||||
assertThat(encoded, containsString("\"define\":{\"concept\":[{\"code\":\"someCode\",\"display\":\"someDisplay\"}],\"_concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}]}]}"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +406,7 @@ public class JsonParserTest {
|
||||
try {
|
||||
p.encodeResourceToString(obs);
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.getMessage(), StringContains.containsString("PeriodDt"));
|
||||
assertThat(e.getMessage(), StringContains.containsString("DecimalDt"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,8 +696,14 @@ public class JsonParserTest {
|
||||
strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\""));
|
||||
strings.addAll(Arrays.asList("\"deleted\":\""+nowDt.getValueAsString()+"\"", "\"id\":\"Patient/3\""));
|
||||
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
|
||||
|
||||
b.getEntries().remove(2);
|
||||
bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||
assertThat(bundleString, not(containsString("deleted")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleBundleEncode() throws IOException {
|
||||
|
||||
|
@ -17,6 +17,7 @@ import java.util.List;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.custommonkey.xmlunit.Diff;
|
||||
import org.custommonkey.xmlunit.XMLUnit;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.hamcrest.core.IsNot;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
@ -80,6 +81,46 @@ public class XmlParserTest {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNestedContainedResources() {
|
||||
|
||||
Observation A = new Observation();
|
||||
A.getName().setText("A");
|
||||
|
||||
Observation B = new Observation();
|
||||
B.getName().setText("B");
|
||||
A.addRelated().setTarget(new ResourceReferenceDt(B));
|
||||
|
||||
Observation C = new Observation();
|
||||
C.getName().setText("C");
|
||||
B.addRelated().setTarget(new ResourceReferenceDt(C));
|
||||
|
||||
String str = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(A);
|
||||
ourLog.info(str);
|
||||
|
||||
assertThat(str, stringContainsInOrder(Arrays.asList("<text value=\"B\"/>", "<text value=\"C\"/>", "<text value=\"A\"/>")));
|
||||
assertThat(str, stringContainsInOrder(Arrays.asList("<contained>", "</contained>")));
|
||||
|
||||
// Only one (outer) contained block
|
||||
int idx0 = str.indexOf("<contained>");
|
||||
int idx1 = str.indexOf("<contained>",idx0+1);
|
||||
assertNotEquals(-1, idx0);
|
||||
assertEquals(-1, idx1);
|
||||
|
||||
Observation obs = ourCtx.newXmlParser().parseResource(Observation.class, str);
|
||||
assertEquals("A",obs.getName().getText().getValue());
|
||||
|
||||
Observation obsB = (Observation) obs.getRelatedFirstRep().getTarget().getResource();
|
||||
assertEquals("B",obsB.getName().getText().getValue());
|
||||
|
||||
Observation obsC = (Observation) obsB.getRelatedFirstRep().getTarget().getResource();
|
||||
assertEquals("C",obsC.getName().getText().getValue());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseQuery() {
|
||||
String msg = "<Query xmlns=\"http://hl7.org/fhir\">\n" +
|
||||
@ -379,7 +420,7 @@ public class XmlParserTest {
|
||||
try {
|
||||
p.encodeResourceToString(obs);
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.getMessage(), StringContains.containsString("PeriodDt"));
|
||||
assertThat(e.getMessage(), StringContains.containsString("DecimalDt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,156 @@
|
||||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.PathSpecification;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.annotation.Sort;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
import ca.uhn.fhir.testutil.RandomServerPortProvider;
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public class IncludeTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(IncludeTest.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
|
||||
@Test
|
||||
public void testNoIncludes() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
|
||||
assertEquals(1, bundle.size());
|
||||
|
||||
Patient p = bundle.getResources(Patient.class).get(0);
|
||||
assertEquals(0, p.getName().size());
|
||||
assertEquals("Hello", p.getId().getUnqualifiedId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneInclude() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_include=foo");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
|
||||
assertEquals(1, bundle.size());
|
||||
|
||||
Patient p = bundle.getResources(Patient.class).get(0);
|
||||
assertEquals(1, p.getName().size());
|
||||
assertEquals("Hello", p.getId().getUnqualifiedId());
|
||||
assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoInclude() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_include=foo&_include=bar");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
|
||||
assertEquals(1, bundle.size());
|
||||
|
||||
Patient p = bundle.getResources(Patient.class).get(0);
|
||||
assertEquals(2, p.getName().size());
|
||||
assertEquals("Hello", p.getId().getUnqualifiedId());
|
||||
assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue());
|
||||
assertEquals("bar", p.getName().get(1).getFamilyFirstRep().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadInclude() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?name=Hello&_include=foo&_include=baz");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
ourServer.stop();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
ourPort = RandomServerPortProvider.findFreePort();
|
||||
ourServer = new Server(ourPort);
|
||||
|
||||
DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider();
|
||||
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
RestfulServer servlet = new RestfulServer();
|
||||
servlet.setResourceProviders(patientProvider);
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
ourServer.start();
|
||||
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
builder.setConnectionManager(connectionManager);
|
||||
ourClient = builder.build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class DummyPatientResourceProvider implements IResourceProvider {
|
||||
|
||||
@Search
|
||||
public List<Patient> findPatient(@RequiredParam(name = Patient.SP_NAME) StringDt theName, @IncludeParam(allow = { "foo", "bar" }) Set<PathSpecification> theIncludes) {
|
||||
ArrayList<Patient> retVal = new ArrayList<Patient>();
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier("foo", "bar");
|
||||
|
||||
p.setId(theName.getValue());
|
||||
|
||||
if (theIncludes != null) {
|
||||
for (PathSpecification next : theIncludes) {
|
||||
p.addName().addFamily().setValue(next.getValue());
|
||||
}
|
||||
}
|
||||
retVal.add(p);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
||||
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.testutil.RandomServerPortProvider;
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public class SearchTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchTest.class);
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static FhirContext ourCtx = new FhirContext();
|
||||
|
||||
@Test
|
||||
public void testSearchById() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
|
||||
assertEquals(1, bundle.getEntries().size());
|
||||
|
||||
Patient p = bundle.getResources(Patient.class).get(0);
|
||||
assertEquals("idaaa", p.getNameFirstRep().getFamilyAsSingleString());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
ourServer.stop();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
ourPort = RandomServerPortProvider.findFreePort();
|
||||
ourServer = new Server(ourPort);
|
||||
|
||||
DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider();
|
||||
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
RestfulServer servlet = new RestfulServer();
|
||||
servlet.setResourceProviders(patientProvider);
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
ourServer.start();
|
||||
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
builder.setConnectionManager(connectionManager);
|
||||
ourClient = builder.build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class DummyPatientResourceProvider implements IResourceProvider {
|
||||
|
||||
@Search
|
||||
public List<Patient> findPatient(@OptionalParam(name = "_id") StringParam theParam) {
|
||||
ArrayList<Patient> retVal = new ArrayList<Patient>();
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.setId("1");
|
||||
patient.addName().addFamily("id"+theParam.getValue());
|
||||
retVal.add(patient);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -34,8 +35,8 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.jpa.entity.BaseHasResource;
|
||||
import ca.uhn.fhir.jpa.entity.BaseTag;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTablePk;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceHistoryTag;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
|
||||
@ -45,6 +46,7 @@ import ca.uhn.fhir.jpa.entity.ResourceLink;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceTag;
|
||||
import ca.uhn.fhir.jpa.entity.TagDefinition;
|
||||
import ca.uhn.fhir.jpa.util.StopWatch;
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
@ -57,6 +59,7 @@ import ca.uhn.fhir.model.dstu.composite.CodingDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.ContactDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.PeriodDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
|
||||
@ -73,14 +76,17 @@ import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public abstract class BaseFhirDao {
|
||||
private FhirContext myContext = new FhirContext();
|
||||
|
||||
@Autowired(required=true)
|
||||
private FhirContext myContext;
|
||||
|
||||
@PersistenceContext(name = "FHIR_UT", type = PersistenceContextType.TRANSACTION, unitName = "FHIR_UT")
|
||||
private EntityManager myEntityManager;
|
||||
@Autowired
|
||||
private List<IFhirResourceDao<?>> myResourceDaos;
|
||||
|
||||
private Map<Class<? extends IResource>, IFhirResourceDao<?>> myResourceTypeToDao;
|
||||
|
||||
|
||||
public FhirContext getContext() {
|
||||
return myContext;
|
||||
}
|
||||
@ -125,9 +131,9 @@ public abstract class BaseFhirDao {
|
||||
q.setMaxResults(myConfig.getHardSearchLimit());
|
||||
}
|
||||
for (Tuple next : q.getResultList()) {
|
||||
long id = (Long) next.get(0);
|
||||
Date updated = (Date) next.get(1);
|
||||
tuples.add(new HistoryTuple(ResourceTable.class, updated, id));
|
||||
long id = next.get(0, Long.class);
|
||||
Date updated = next.get(1, Date.class);
|
||||
tuples.add(new HistoryTuple(false, updated, id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,13 +141,13 @@ public abstract class BaseFhirDao {
|
||||
Collection<HistoryTuple> tuples = Collections2.filter(theTuples, new com.google.common.base.Predicate<HistoryTuple>() {
|
||||
@Override
|
||||
public boolean apply(HistoryTuple theInput) {
|
||||
return theInput.getTable().equals(ResourceTable.class);
|
||||
return theInput.isHistory() == false;
|
||||
}
|
||||
});
|
||||
Collection<Long> ids = Collections2.transform(tuples, new Function<HistoryTuple, Long>() {
|
||||
@Override
|
||||
public Long apply(HistoryTuple theInput) {
|
||||
return (Long) theInput.getId();
|
||||
return theInput.getId();
|
||||
}
|
||||
});
|
||||
if (ids.isEmpty()) {
|
||||
@ -160,11 +166,11 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
}
|
||||
|
||||
private void searchHistoryHistory(String theResourceName, Long theId, Date theSince, Integer theLimit, List<HistoryTuple> tuples) {
|
||||
private void searchHistoryHistory(String theResourceName, Long theResourceId, Date theSince, Integer theLimit, List<HistoryTuple> tuples) {
|
||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<Tuple> cq = builder.createTupleQuery();
|
||||
Root<?> from = cq.from(ResourceHistoryTable.class);
|
||||
cq.multiselect(from.get("myPk").as(ResourceHistoryTablePk.class), from.get("myUpdated").as(Date.class));
|
||||
cq.multiselect(from.get("myId").as(Long.class), from.get("myUpdated").as(Date.class));
|
||||
|
||||
List<Predicate> predicates = new ArrayList<Predicate>();
|
||||
if (theSince != null) {
|
||||
@ -175,8 +181,8 @@ public abstract class BaseFhirDao {
|
||||
if (theResourceName != null) {
|
||||
predicates.add(builder.equal(from.get("myResourceType"), theResourceName));
|
||||
}
|
||||
if (theId != null) {
|
||||
predicates.add(builder.equal(from.get("myId"), theId));
|
||||
if (theResourceId != null) {
|
||||
predicates.add(builder.equal(from.get("myResourceId"), theResourceId));
|
||||
}
|
||||
|
||||
cq.where(builder.and(predicates.toArray(new Predicate[0])));
|
||||
@ -189,33 +195,37 @@ public abstract class BaseFhirDao {
|
||||
q.setMaxResults(myConfig.getHardSearchLimit());
|
||||
}
|
||||
for (Tuple next : q.getResultList()) {
|
||||
ResourceHistoryTablePk id = (ResourceHistoryTablePk) next.get(0);
|
||||
Long id = next.get(0, Long.class);
|
||||
Date updated = (Date) next.get(1);
|
||||
tuples.add(new HistoryTuple(ResourceHistoryTable.class, updated, id));
|
||||
tuples.add(new HistoryTuple(true, updated, id));
|
||||
}
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseFhirDao.class);
|
||||
|
||||
private void searchHistoryHistory(List<HistoryTuple> theTuples, List<BaseHasResource> theRetVal) {
|
||||
Collection<HistoryTuple> tuples = Collections2.filter(theTuples, new com.google.common.base.Predicate<HistoryTuple>() {
|
||||
@Override
|
||||
public boolean apply(HistoryTuple theInput) {
|
||||
return theInput.getTable().equals(ResourceHistoryTable.class);
|
||||
return theInput.isHistory()==true;
|
||||
}
|
||||
});
|
||||
Collection<ResourceHistoryTablePk> ids = Collections2.transform(tuples, new Function<HistoryTuple, ResourceHistoryTablePk>() {
|
||||
Collection<Long> ids = Collections2.transform(tuples, new Function<HistoryTuple, Long>() {
|
||||
@Override
|
||||
public ResourceHistoryTablePk apply(HistoryTuple theInput) {
|
||||
return (ResourceHistoryTablePk) theInput.getId();
|
||||
public Long apply(HistoryTuple theInput) {
|
||||
return (Long) theInput.getId();
|
||||
}
|
||||
});
|
||||
if (ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ourLog.info("Retrieving {} history elements from ResourceHistoryTable", ids.size());
|
||||
|
||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<ResourceHistoryTable> cq = builder.createQuery(ResourceHistoryTable.class);
|
||||
Root<ResourceHistoryTable> from = cq.from(ResourceHistoryTable.class);
|
||||
cq.where(from.get("myPk").in(ids));
|
||||
cq.where(from.get("myId").in(ids));
|
||||
|
||||
cq.orderBy(builder.desc(from.get("myUpdated")));
|
||||
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery(cq);
|
||||
@ -258,19 +268,19 @@ public abstract class BaseFhirDao {
|
||||
continue;
|
||||
}
|
||||
|
||||
String typeString = nextValue.getResourceId().getResourceType();
|
||||
String typeString = nextValue.getReference().getResourceType();
|
||||
if (isBlank(typeString)) {
|
||||
throw new InvalidRequestException("Invalid resource reference found at path[" + nextPath + "] - Does not contain resource type - " + nextValue.getReference().getValue());
|
||||
}
|
||||
Class<? extends IResource> type = getContext().getResourceDefinition(typeString).getImplementingClass();
|
||||
String id = nextValue.getResourceId().getUnqualifiedId();
|
||||
String id = nextValue.getReference().getUnqualifiedId();
|
||||
if (StringUtils.isBlank(id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IFhirResourceDao<?> dao = getDao(type);
|
||||
if (dao == null) {
|
||||
throw new InvalidRequestException("This server is not able to handle resources of type: " + nextValue.getResourceId().getResourceType());
|
||||
throw new InvalidRequestException("This server is not able to handle resources of type: " + nextValue.getReference().getResourceType());
|
||||
}
|
||||
Long valueOf;
|
||||
try {
|
||||
@ -333,6 +343,12 @@ public abstract class BaseFhirDao {
|
||||
continue;
|
||||
}
|
||||
nextEntity = new ResourceIndexedSearchParamDate(nextSpDef.getName(), nextValue.getValue(), nextValue.getValue());
|
||||
} else if (nextObject instanceof PeriodDt) {
|
||||
PeriodDt nextValue = (PeriodDt) nextObject;
|
||||
if (nextValue.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
nextEntity = new ResourceIndexedSearchParamDate(nextSpDef.getName(), nextValue.getStart().getValue(), nextValue.getEnd().getValue());
|
||||
} else {
|
||||
if (!multiType) {
|
||||
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
|
||||
@ -377,7 +393,8 @@ public abstract class BaseFhirDao {
|
||||
|
||||
if (nextObject instanceof QuantityDt) {
|
||||
QuantityDt nextValue = (QuantityDt) nextObject;
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue().getValue(), nextValue.getSystem().getValueAsString(), nextValue.getUnits().getValue());
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue().getValue(), nextValue.getSystem().getValueAsString(),
|
||||
nextValue.getUnits().getValue());
|
||||
nextEntity.setResource(theEntity);
|
||||
retVal.add(nextEntity);
|
||||
} else {
|
||||
@ -460,7 +477,8 @@ public abstract class BaseFhirDao {
|
||||
} else if (nextObject instanceof ContactDt) {
|
||||
ContactDt nextContact = (ContactDt) nextObject;
|
||||
if (nextContact.getValue().isEmpty() == false) {
|
||||
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, normalizeString(nextContact.getValue().getValueAsString()), nextContact.getValue().getValueAsString());
|
||||
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, normalizeString(nextContact.getValue().getValueAsString()), nextContact
|
||||
.getValue().getValueAsString());
|
||||
nextEntity.setResource(theEntity);
|
||||
retVal.add(nextEntity);
|
||||
}
|
||||
@ -549,12 +567,12 @@ public abstract class BaseFhirDao {
|
||||
for (IFhirResourceDao<?> next : myResourceDaos) {
|
||||
myResourceTypeToDao.put(next.getResourceType(), next);
|
||||
}
|
||||
|
||||
|
||||
if (this instanceof IFhirResourceDao<?>) {
|
||||
IFhirResourceDao<?> thiz = (IFhirResourceDao<?>) this;
|
||||
myResourceTypeToDao.put(thiz.getResourceType(), thiz);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return myResourceTypeToDao.get(theType);
|
||||
@ -563,11 +581,16 @@ public abstract class BaseFhirDao {
|
||||
protected ArrayList<IResource> history(String theResourceName, Long theId, Date theSince, Integer theLimit) {
|
||||
List<HistoryTuple> tuples = new ArrayList<HistoryTuple>();
|
||||
|
||||
StopWatch timer = new StopWatch();
|
||||
|
||||
// Get list of IDs
|
||||
searchHistoryCurrentVersion(theResourceName, theId, theSince, theLimit, tuples);
|
||||
assert tuples.size() < 2 || !tuples.get(tuples.size() - 2).getUpdated().before(tuples.get(tuples.size() - 1).getUpdated());
|
||||
ourLog.info("Retrieved {} history IDs from current versions in {} ms", tuples.size(), timer.getMillisAndRestart());
|
||||
|
||||
searchHistoryHistory(theResourceName, theId, theSince, theLimit, tuples);
|
||||
assert tuples.size() < 2 || !tuples.get(tuples.size() - 2).getUpdated().before(tuples.get(tuples.size() - 1).getUpdated());
|
||||
ourLog.info("Retrieved {} history IDs from previous versions in {} ms", tuples.size(), timer.getMillisAndRestart());
|
||||
|
||||
// Sort merged list
|
||||
Collections.sort(tuples, Collections.reverseOrder());
|
||||
@ -575,8 +598,23 @@ public abstract class BaseFhirDao {
|
||||
|
||||
// Pull actual resources
|
||||
List<BaseHasResource> resEntities = Lists.newArrayList();
|
||||
|
||||
int limit;
|
||||
if (theLimit != null && theLimit < myConfig.getHardSearchLimit()) {
|
||||
limit = theLimit;
|
||||
} else {
|
||||
limit = myConfig.getHardSearchLimit();
|
||||
}
|
||||
|
||||
if (tuples.size() > limit) {
|
||||
tuples = tuples.subList(0, limit);
|
||||
}
|
||||
|
||||
searchHistoryCurrentVersion(tuples, resEntities);
|
||||
ourLog.info("Loaded history from current versions in {} ms", timer.getMillisAndRestart());
|
||||
|
||||
searchHistoryHistory(tuples, resEntities);
|
||||
ourLog.info("Loaded history from previous versions in {} ms", timer.getMillisAndRestart());
|
||||
|
||||
Collections.sort(resEntities, new Comparator<BaseHasResource>() {
|
||||
@Override
|
||||
@ -585,12 +623,6 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
});
|
||||
|
||||
int limit;
|
||||
if (theLimit != null && theLimit < myConfig.getHardSearchLimit()) {
|
||||
limit = theLimit;
|
||||
} else {
|
||||
limit = myConfig.getHardSearchLimit();
|
||||
}
|
||||
if (resEntities.size() > limit) {
|
||||
resEntities = resEntities.subList(0, limit);
|
||||
}
|
||||
@ -638,9 +670,22 @@ public abstract class BaseFhirDao {
|
||||
theEntity.setUpdated(new Date());
|
||||
|
||||
theEntity.setResourceType(toResourceName(theResource));
|
||||
theEntity.setResource(getContext().newJsonParser().encodeResourceToString(theResource));
|
||||
theEntity.setEncoding(EncodingEnum.JSON);
|
||||
|
||||
|
||||
String encoded = myConfig.getResourceEncoding().newParser(myContext).encodeResourceToString(theResource);
|
||||
ResourceEncodingEnum encoding = myConfig.getResourceEncoding();
|
||||
theEntity.setEncoding(encoding);
|
||||
try {
|
||||
switch (encoding) {
|
||||
case JSON:
|
||||
theEntity.setResource(encoded.getBytes("UTF-8"));
|
||||
break;
|
||||
case JSONC:
|
||||
theEntity.setResource(GZipUtil.compress(encoded));
|
||||
break;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
}
|
||||
|
||||
TagList tagList = (TagList) theResource.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
|
||||
if (tagList != null) {
|
||||
for (Tag next : tagList) {
|
||||
@ -665,7 +710,20 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
protected <T extends IResource> T toResource(Class<T> theResourceType, BaseHasResource theEntity) {
|
||||
String resourceText = theEntity.getResource();
|
||||
String resourceText=null;
|
||||
switch (theEntity.getEncoding()) {
|
||||
case JSON:
|
||||
try {
|
||||
resourceText = new String(theEntity.getResource(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new Error("Should not happen", e);
|
||||
}
|
||||
break;
|
||||
case JSONC:
|
||||
resourceText = GZipUtil.decompress(theEntity.getResource());
|
||||
break;
|
||||
}
|
||||
|
||||
IParser parser = theEntity.getEncoding().newParser(getContext());
|
||||
T retVal = parser.parseResource(theResourceType, resourceText);
|
||||
retVal.setId(theEntity.getIdDt());
|
||||
@ -685,11 +743,11 @@ public abstract class BaseFhirDao {
|
||||
protected String toResourceName(IResource theResource) {
|
||||
return myContext.getResourceDefinition(theResource).getName();
|
||||
}
|
||||
|
||||
protected String toResourceName(Class<? extends IResource> theResourceType) {
|
||||
return myContext.getResourceDefinition(theResourceType).getName();
|
||||
}
|
||||
|
||||
|
||||
protected ResourceTable updateEntity(final IResource theResource, ResourceTable entity, boolean theUpdateHistory) {
|
||||
if (entity.getPublished() == null) {
|
||||
entity.setPublished(new Date());
|
||||
@ -702,6 +760,12 @@ public abstract class BaseFhirDao {
|
||||
|
||||
entity.setVersion(entity.getVersion() + 1);
|
||||
|
||||
Collection<ResourceIndexedSearchParamString> paramsString = new ArrayList<ResourceIndexedSearchParamString>(entity.getParamsString());
|
||||
Collection<ResourceIndexedSearchParamToken> paramsToken = new ArrayList<ResourceIndexedSearchParamToken>(entity.getParamsToken());
|
||||
Collection<ResourceIndexedSearchParamNumber> paramsNumber = new ArrayList<ResourceIndexedSearchParamNumber>(entity.getParamsNumber());
|
||||
Collection<ResourceIndexedSearchParamDate> paramsDate = new ArrayList<ResourceIndexedSearchParamDate>(entity.getParamsDate());
|
||||
Collection<ResourceLink> resourceLinks = new ArrayList<ResourceLink>(entity.getResourceLinks());
|
||||
|
||||
final List<ResourceIndexedSearchParamString> stringParams = extractSearchParamStrings(entity, theResource);
|
||||
final List<ResourceIndexedSearchParamToken> tokenParams = extractSearchParamTokens(entity, theResource);
|
||||
final List<ResourceIndexedSearchParamNumber> numberParams = extractSearchParamNumber(entity, theResource);
|
||||
@ -711,6 +775,16 @@ public abstract class BaseFhirDao {
|
||||
populateResourceIntoEntity(theResource, entity);
|
||||
|
||||
entity.setUpdated(new Date());
|
||||
entity.setParamsString(stringParams);
|
||||
entity.setParamsStringPopulated(stringParams.isEmpty()==false);
|
||||
entity.setParamsToken(tokenParams);
|
||||
entity.setParamsTokenPopulated(tokenParams.isEmpty()==false);
|
||||
entity.setParamsNumber(numberParams);
|
||||
entity.setParamsNumberPopulated(numberParams.isEmpty()==false);
|
||||
entity.setParamsDate(dateParams);
|
||||
entity.setParamsDatePopulated(dateParams.isEmpty()==false);
|
||||
entity.setResourceLinks(links);
|
||||
entity.setHasLinks(links.isEmpty()==false);
|
||||
|
||||
if (entity.getId() == null) {
|
||||
myEntityManager.persist(entity);
|
||||
@ -719,16 +793,16 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
if (entity.isParamsStringPopulated()) {
|
||||
for (ResourceIndexedSearchParamString next : entity.getParamsString()) {
|
||||
for (ResourceIndexedSearchParamString next : paramsString) {
|
||||
myEntityManager.remove(next);
|
||||
}
|
||||
}
|
||||
for (ResourceIndexedSearchParamString next : stringParams) {
|
||||
myEntityManager.persist(next);
|
||||
}
|
||||
|
||||
|
||||
if (entity.isParamsTokenPopulated()) {
|
||||
for (ResourceIndexedSearchParamToken next : entity.getParamsToken()) {
|
||||
for (ResourceIndexedSearchParamToken next : paramsToken) {
|
||||
myEntityManager.remove(next);
|
||||
}
|
||||
}
|
||||
@ -737,7 +811,7 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
if (entity.isParamsNumberPopulated()) {
|
||||
for (ResourceIndexedSearchParamNumber next : entity.getParamsNumber()) {
|
||||
for (ResourceIndexedSearchParamNumber next : paramsNumber) {
|
||||
myEntityManager.remove(next);
|
||||
}
|
||||
}
|
||||
@ -746,7 +820,7 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
if (entity.isParamsDatePopulated()) {
|
||||
for (ResourceIndexedSearchParamDate next : entity.getParamsDate()) {
|
||||
for (ResourceIndexedSearchParamDate next : paramsDate) {
|
||||
myEntityManager.remove(next);
|
||||
}
|
||||
}
|
||||
@ -755,14 +829,14 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
if (entity.isHasLinks()) {
|
||||
for (ResourceLink next : entity.getResourceLinks()) {
|
||||
for (ResourceLink next : resourceLinks) {
|
||||
myEntityManager.remove(next);
|
||||
}
|
||||
}
|
||||
for (ResourceLink next : links) {
|
||||
myEntityManager.persist(next);
|
||||
}
|
||||
|
||||
|
||||
myEntityManager.flush();
|
||||
theResource.setId(new IdDt(entity.getResourceType(), entity.getId().toString(), Long.toString(entity.getVersion())));
|
||||
|
||||
@ -770,7 +844,7 @@ public abstract class BaseFhirDao {
|
||||
}
|
||||
|
||||
protected TagList getTags(Class<? extends IResource> theResourceType, IdDt theResourceId) {
|
||||
String resourceName=null;
|
||||
String resourceName = null;
|
||||
if (theResourceType != null) {
|
||||
resourceName = toResourceName(theResourceType);
|
||||
if (theResourceId != null && theResourceId.hasUnqualifiedVersionId()) {
|
||||
@ -783,7 +857,7 @@ public abstract class BaseFhirDao {
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Set<Long> tagIds = new HashSet<Long>();
|
||||
findMatchingTagIds(resourceName, theResourceId, tagIds, ResourceTag.class);
|
||||
findMatchingTagIds(resourceName, theResourceId, tagIds, ResourceHistoryTag.class);
|
||||
|
@ -1,9 +1,12 @@
|
||||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum;
|
||||
|
||||
public class DaoConfig {
|
||||
|
||||
private int myHardSearchLimit = 1000;
|
||||
private int myHardTagListLimit = 1000;
|
||||
private ResourceEncodingEnum myResourceEncoding=ResourceEncodingEnum.JSONC;
|
||||
|
||||
public int getHardSearchLimit() {
|
||||
return myHardSearchLimit;
|
||||
@ -21,4 +24,12 @@ public class DaoConfig {
|
||||
myHardTagListLimit = theHardTagListLimit;
|
||||
}
|
||||
|
||||
public ResourceEncodingEnum getResourceEncoding() {
|
||||
return myResourceEncoding;
|
||||
}
|
||||
|
||||
public void setResourceEncoding(ResourceEncodingEnum theResourceEncoding) {
|
||||
myResourceEncoding = theResourceEncoding;
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user