Lots of work on DSTU2 server

This commit is contained in:
jamesagnew 2014-12-21 18:13:37 -05:00
parent 94bef8d254
commit 994e49057d
206 changed files with 5814 additions and 114248 deletions

View File

@ -709,7 +709,14 @@ class ModelScanner {
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition); RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition);
myClassToElementDefinitions.put(theClass, resourceDef); myClassToElementDefinitions.put(theClass, resourceDef);
if (primaryNameProvider) { if (primaryNameProvider) {
myNameToResourceDefinitions.put(resourceName, resourceDef); try {
IResource res = (IResource) theClass.newInstance();
if (res.getStructureFhirVersionEnum() == myContext.getVersion().getVersion()) {
myNameToResourceDefinitions.put(resourceName, resourceDef);
}
} catch (Exception e) {
ourLog.error("Failed to instantiate type[" +theClass.getName() +"]", e);
}
} }
scanCompositeElementForChildren(theClass, resourceDef); scanCompositeElementForChildren(theClass, resourceDef);

View File

@ -20,8 +20,6 @@ package ca.uhn.fhir.model.api;
* #L% * #L%
*/ */
import java.util.Map;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
import ca.uhn.fhir.model.dstu.composite.ContainedDt; import ca.uhn.fhir.model.dstu.composite.ContainedDt;
@ -134,4 +132,10 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode
*/ */
String getResourceName(); String getResourceName();
/**
* Returns the FHIR version represented by this structure
*/
public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum();
} }

View File

@ -61,7 +61,7 @@ public abstract class BaseResourceReferenceDt extends BaseIdentifiableElement {
setReference(theResource.getId()); setReference(theResource.getId());
} }
protected abstract IdDt getReference(); public abstract IdDt getReference();
/** /**
* 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 * 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

View File

@ -23,8 +23,7 @@ package ca.uhn.fhir.model.dstu.resource;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.api.BaseResource; import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
@ -105,4 +104,9 @@ public class Binary extends BaseResource implements IResource {
return Binary.class.getName(); return Binary.class.getName();
} }
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.DSTU1;
}
} }

View File

@ -1834,12 +1834,14 @@ class ParserState<T> {
@Override @Override
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
throw new Error("Element " + theLocalPart + " in primitive!"); // TODO: if (false) {// TODO: make this configurable
// can throw new Error("Element " + theLocalPart + " in primitive!"); // TODO:
// this }
// happen? ourLog.warn("Ignoring element {} in primitive tag", theLocalPart);
push(new SwallowChildrenWholeState(getPreResourceState()));
return;
} }
@Override @Override
protected IBase getCurrentElement() { protected IBase getCurrentElement() {
return myInstance; return myInstance;

View File

@ -66,13 +66,21 @@ public interface IRestfulClientFactory {
*/ */
IGenericClient newGenericClient(String theServerBase); IGenericClient newGenericClient(String theServerBase);
/**
* Sets the socket timeout (in milliseconds)
*/
void setSocketTimeout(int theSocketTimeout); void setSocketTimeout(int theSocketTimeout);
/**
* Sets the connection timeout (in milliseconds)
*/
void setConnectTimeout(int theConnectTimeout); void setConnectTimeout(int theConnectTimeout);
/**
* Sets the connection request timeout (in milliseconds)
*/
void setConnectionRequestTimeout(int theConnectionRequestTimeout); void setConnectionRequestTimeout(int theConnectionRequestTimeout);
/** /**

View File

@ -47,6 +47,11 @@
<artifactId>hapi-fhir-structures-dstu</artifactId> <artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version> <version>0.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dev</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>

View File

@ -0,0 +1,36 @@
package ca.uhn.fhir.testmindeps;
import static org.junit.Assert.*;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.dstu.resource.Patient;
public class FhirContextTest {
@Test
public void testWrongVersionDoesntGetInContext1() {
FhirContext ctx = FhirContext.forDstu1();
RuntimeResourceDefinition def = ctx.getResourceDefinition("Patient");
assertEquals(Patient.class, def.getImplementingClass());
}
@Test
public void testWrongVersionDoesntGetInContext2() {
FhirContext ctx = FhirContext.forDstu1();
RuntimeResourceDefinition def = ctx.getResourceDefinition("Patient");
assertEquals(Patient.class, def.getImplementingClass());
ctx = FhirContext.forDstu1();
def = ctx.getResourceDefinition(ca.uhn.fhir.model.dev.resource.Patient.class);
assertEquals(ca.uhn.fhir.model.dev.resource.Patient.class, def.getImplementingClass());
def = ctx.getResourceDefinition("Patient");
assertEquals(Patient.class, def.getImplementingClass());
}
}

View File

@ -26,5 +26,15 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/tinder">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-resources/tinder">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -3,4 +3,6 @@ encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8 encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8 encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8 encoding//src/test/resources=UTF-8
encoding//target/generated-resources/tinder=UTF-8
encoding//target/generated-sources/tinder=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View File

@ -2,5 +2,7 @@
<wb-module deploy-name="hapi-fhir-jpaserver-base"> <wb-module deploy-name="hapi-fhir-jpaserver-base">
<wb-resource deploy-path="/" source-path="/src/main/java"/> <wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/resources"/> <wb-resource deploy-path="/" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/generated-sources/tinder"/>
<wb-resource deploy-path="/" source-path="/target/generated-resources/tinder"/>
</wb-module> </wb-module>
</project-modules> </project-modules>

View File

@ -48,6 +48,11 @@
<artifactId>hapi-fhir-structures-dstu</artifactId> <artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version> <version>0.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dev</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
@ -318,6 +323,49 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.9-SNAPSHOT</version>
<executions>
<execution>
<id>build_dstu1</id>
<goals>
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<version>dstu</version>
<packageBase>ca.uhn.fhir.jpa.rp.dstu</packageBase>
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders-dstu1.xml</targetResourceSpringBeansFile>
<baseResourceNames></baseResourceNames>
</configuration>
</execution>
<execution>
<id>build_dev</id>
<goals>
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<version>dev</version>
<packageBase>ca.uhn.fhir.jpa.rp.dev</packageBase>
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders-dev.xml</targetResourceSpringBeansFile>
<baseResourceNames></baseResourceNames>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dev</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
@ -326,6 +374,17 @@
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/target/generated-sources/tinder</directory>
</resource>
<resource>
<directory>${basedir}/target/generated-resources/tinder</directory>
</resource>
</resources>
</build> </build>
<profiles> <profiles>

View File

@ -0,0 +1,26 @@
package ca.uhn.fhir.jpa.dao;
import java.util.ArrayList;
import java.util.List;
import ca.uhn.fhir.jpa.entity.BaseResourceIndexedSearchParam;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.entity.ResourceTable;
import ca.uhn.fhir.model.api.IResource;
interface ISearchParamExtractor {
public abstract List<ResourceIndexedSearchParamDate> extractSearchParamDates(ResourceTable theEntity, IResource theResource);
public abstract ArrayList<ResourceIndexedSearchParamNumber> extractSearchParamNumber(ResourceTable theEntity, IResource theResource);
public abstract List<ResourceIndexedSearchParamQuantity> extractSearchParamQuantity(ResourceTable theEntity, IResource theResource);
public abstract List<ResourceIndexedSearchParamString> extractSearchParamStrings(ResourceTable theEntity, IResource theResource);
public abstract List<BaseResourceIndexedSearchParam> extractSearchParamTokens(ResourceTable theEntity, IResource theResource);
}

View File

@ -0,0 +1,504 @@
package ca.uhn.fhir.jpa.dao;
import static org.apache.commons.lang3.StringUtils.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.measure.quantity.Quantity;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.apache.commons.lang3.tuple.Pair;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.jpa.entity.BaseResourceIndexedSearchParam;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.entity.ResourceTable;
import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseHumanNameDt;
import ca.uhn.fhir.model.dev.composite.AddressDt;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.BaseDateTimeDt;
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.util.FhirTerser;
class SearchParamExtractorDev implements ISearchParamExtractor {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchParamExtractorDev.class);
private FhirContext myContext;
public SearchParamExtractorDev(FhirContext theContext) {
myContext = theContext;
}
/*
* (non-Javadoc)
*
* @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamDates(ca.uhn.fhir.jpa.entity.ResourceTable,
* ca.uhn.fhir.model.api.IResource)
*/
@Override
public List<ResourceIndexedSearchParamDate> extractSearchParamDates(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamDate> retVal = new ArrayList<ResourceIndexedSearchParamDate>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.DATE) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null) {
continue;
}
ResourceIndexedSearchParamDate nextEntity;
if (nextObject instanceof BaseDateTimeDt) {
BaseDateTimeDt nextValue = (BaseDateTimeDt) nextObject;
if (nextValue.isEmpty()) {
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(), nextValue.getEnd());
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
if (nextEntity != null) {
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
}
theEntity.setParamsDatePopulated(retVal.size() > 0);
return retVal;
}
/*
* (non-Javadoc)
*
* @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamNumber(ca.uhn.fhir.jpa.entity.ResourceTable,
* ca.uhn.fhir.model.api.IResource)
*/
@Override
public ArrayList<ResourceIndexedSearchParamNumber> extractSearchParamNumber(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamNumber> retVal = new ArrayList<ResourceIndexedSearchParamNumber>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.NUMBER) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof DurationDt) {
DurationDt nextValue = (DurationDt) nextObject;
if (nextValue.getValueElement().isEmpty()) {
continue;
}
if (new UriDt(BaseFhirDao.UCUM_NS).equals(nextValue.getSystem())) {
if (isNotBlank(nextValue.getCode())) {
Unit<? extends Quantity> unit = Unit.valueOf(nextValue.getCode());
javax.measure.converter.UnitConverter dayConverter = unit.getConverterTo(NonSI.DAY);
double dayValue = dayConverter.convert(nextValue.getValue().doubleValue());
DurationDt newValue = new DurationDt();
newValue.setSystem(BaseFhirDao.UCUM_NS);
newValue.setCode(NonSI.DAY.toString());
newValue.setValue(dayValue);
nextValue = newValue;
/*
* @SuppressWarnings("unchecked") PhysicsUnit<? extends
* org.unitsofmeasurement.quantity.Quantity<?>> unit = (PhysicsUnit<? extends
* org.unitsofmeasurement.quantity.Quantity<?>>)
* UCUMFormat.getCaseInsensitiveInstance().parse(nextValue.getCode().getValue(), null); if
* (unit.isCompatible(UCUM.DAY)) {
*
* @SuppressWarnings("unchecked") PhysicsUnit<org.unitsofmeasurement.quantity.Time> timeUnit
* = (PhysicsUnit<Time>) unit; UnitConverter conv = timeUnit.getConverterTo(UCUM.DAY);
* double dayValue = conv.convert(nextValue.getValue().getValue().doubleValue()); DurationDt
* newValue = new DurationDt(); newValue.setSystem(UCUM_NS);
* newValue.setCode(UCUM.DAY.getSymbol()); newValue.setValue(dayValue); nextValue=newValue;
* }
*/
}
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else if (nextObject instanceof QuantityDt) {
QuantityDt nextValue = (QuantityDt) nextObject;
if (nextValue.getValueElement().isEmpty()) {
continue;
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else if (nextObject instanceof IntegerDt) {
IntegerDt nextValue = (IntegerDt) nextObject;
if (nextValue.getValue() == null) {
continue;
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, new BigDecimal(nextValue.getValue()));
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
}
theEntity.setParamsNumberPopulated(retVal.size() > 0);
return retVal;
}
/*
* (non-Javadoc)
*
* @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamQuantity(ca.uhn.fhir.jpa.entity.ResourceTable,
* ca.uhn.fhir.model.api.IResource)
*/
@Override
public List<ResourceIndexedSearchParamQuantity> extractSearchParamQuantity(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamQuantity> retVal = new ArrayList<ResourceIndexedSearchParamQuantity>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.QUANTITY) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof QuantityDt) {
QuantityDt nextValue = (QuantityDt) nextObject;
if (nextValue.getValueElement().isEmpty()) {
continue;
}
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValue.getValueElement().getValue(), nextValue.getSystemElement().getValueAsString(), nextValue.getUnits());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
}
theEntity.setParamsNumberPopulated(retVal.size() > 0);
return retVal;
}
/*
* (non-Javadoc)
*
* @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamStrings(ca.uhn.fhir.jpa.entity.ResourceTable,
* ca.uhn.fhir.model.api.IResource)
*/
@Override
public List<ResourceIndexedSearchParamString> extractSearchParamStrings(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamString> retVal = new ArrayList<ResourceIndexedSearchParamString>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.STRING) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
// TODO: implement phoenetic, and any others that have no path
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof IPrimitiveDatatype<?>) {
IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject;
String searchTerm = nextValue.getValueAsString();
if (searchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) {
searchTerm = searchTerm.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH);
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(searchTerm), searchTerm);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (nextObject instanceof BaseHumanNameDt) {
ArrayList<StringDt> allNames = new ArrayList<StringDt>();
HumanNameDt nextHumanName = (HumanNameDt) nextObject;
allNames.addAll(nextHumanName.getFamily());
allNames.addAll(nextHumanName.getGiven());
for (StringDt nextName : allNames) {
if (nextName.isEmpty()) {
continue;
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextName.getValueAsString()), nextName.getValueAsString());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else if (nextObject instanceof AddressDt) {
ArrayList<StringDt> allNames = new ArrayList<StringDt>();
AddressDt nextAddress = (AddressDt) nextObject;
allNames.addAll(nextAddress.getLine());
allNames.add(nextAddress.getCityElement());
allNames.add(nextAddress.getStateElement());
allNames.add(nextAddress.getCountryElement());
allNames.add(nextAddress.getPostalCodeElement());
for (StringDt nextName : allNames) {
if (nextName.isEmpty()) {
continue;
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextName.getValueAsString()), nextName.getValueAsString());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else if (nextObject instanceof ContactPointDt) {
ContactPointDt nextContact = (ContactPointDt) nextObject;
if (nextContact.getValue().isEmpty() == false) {
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextContact.getValueElement().getValueAsString()), nextContact.getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
}
}
}
}
}
theEntity.setParamsStringPopulated(retVal.size() > 0);
return retVal;
}
/*
* (non-Javadoc)
*
* @see ca.uhn.fhir.jpa.dao.ISearchParamExtractor#extractSearchParamTokens(ca.uhn.fhir.jpa.entity.ResourceTable,
* ca.uhn.fhir.model.api.IResource)
*/
@Override
public List<BaseResourceIndexedSearchParam> extractSearchParamTokens(ResourceTable theEntity, IResource theResource) {
ArrayList<BaseResourceIndexedSearchParam> retVal = new ArrayList<BaseResourceIndexedSearchParam>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.TOKEN) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
List<String> systems = new ArrayList<String>();
List<String> codes = new ArrayList<String>();
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject instanceof IdentifierDt) {
IdentifierDt nextValue = (IdentifierDt) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(nextValue.getSystemElement().getValueAsString());
codes.add(nextValue.getValueElement().getValue());
} else if (nextObject instanceof IPrimitiveDatatype<?>) {
IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(null);
codes.add(nextValue.getValueAsString());
} else if (nextObject instanceof CodeableConceptDt) {
CodeableConceptDt nextCC = (CodeableConceptDt) nextObject;
if (!nextCC.getText().isEmpty()) {
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(nextSpDef.getName(), BaseFhirDao.normalizeString(nextCC.getTextElement().getValue()), nextCC.getTextElement().getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
for (CodingDt nextCoding : nextCC.getCoding()) {
if (nextCoding.isEmpty()) {
continue;
}
String nextSystem = nextCoding.getSystemElement().getValueAsString();
String nextCode = nextCoding.getCodeElement().getValue();
if (isNotBlank(nextSystem) || isNotBlank(nextCode)) {
systems.add(nextSystem);
codes.add(nextCode);
}
if (!nextCoding.getDisplay().isEmpty()) {
systems.add(null);
codes.add(nextCoding.getDisplayElement().getValue());
}
}
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
assert systems.size() == codes.size() : "Systems contains " + systems + ", codes contains: " + codes;
Set<Pair<String, String>> haveValues = new HashSet<Pair<String, String>>();
for (int i = 0; i < systems.size(); i++) {
String system = systems.get(i);
String code = codes.get(i);
if (isBlank(system) && isBlank(code)) {
continue;
}
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
system = system.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
code = code.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
Pair<String, String> nextPair = Pair.of(system, code);
if (haveValues.contains(nextPair)) {
continue;
}
haveValues.add(nextPair);
ResourceIndexedSearchParamToken nextEntity;
nextEntity = new ResourceIndexedSearchParamToken(nextSpDef.getName(), system, code);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
theEntity.setParamsTokenPopulated(retVal.size() > 0);
return retVal;
}
private List<Object> extractValues(String thePaths, IResource theResource) {
List<Object> values = new ArrayList<Object>();
String[] nextPathsSplit = thePaths.split("\\|");
FhirTerser t = myContext.newTerser();
for (String nextPath : nextPathsSplit) {
String nextPathTrimmed = nextPath.trim();
try {
values.addAll(t.getValues(theResource, nextPathTrimmed));
} catch (Exception e) {
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
ourLog.warn("Failed to index values from path[{}] in resource type[{}]: ", nextPathTrimmed, def.getName(), e.toString());
}
}
return values;
}
}

View File

@ -0,0 +1,474 @@
package ca.uhn.fhir.jpa.dao;
import static org.apache.commons.lang3.StringUtils.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.measure.quantity.Quantity;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.apache.commons.lang3.tuple.Pair;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.jpa.entity.BaseResourceIndexedSearchParam;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.entity.ResourceTable;
import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseHumanNameDt;
import ca.uhn.fhir.model.dstu.composite.AddressDt;
import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.composite.ContactDt;
import ca.uhn.fhir.model.dstu.composite.DurationDt;
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.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.BaseDateTimeDt;
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.util.FhirTerser;
class SearchParamExtractorDstu1 implements ISearchParamExtractor {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchParamExtractorDstu1.class);
private FhirContext myContext;
public SearchParamExtractorDstu1(FhirContext theContext) {
myContext = theContext;
}
@Override
public List<ResourceIndexedSearchParamDate> extractSearchParamDates(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamDate> retVal = new ArrayList<ResourceIndexedSearchParamDate>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.DATE) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null) {
continue;
}
ResourceIndexedSearchParamDate nextEntity;
if (nextObject instanceof BaseDateTimeDt) {
BaseDateTimeDt nextValue = (BaseDateTimeDt) nextObject;
if (nextValue.isEmpty()) {
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());
} else {
continue;
}
}
if (nextEntity != null) {
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
}
theEntity.setParamsDatePopulated(retVal.size() > 0);
return retVal;
}
@Override
public ArrayList<ResourceIndexedSearchParamNumber> extractSearchParamNumber(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamNumber> retVal = new ArrayList<ResourceIndexedSearchParamNumber>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.NUMBER) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof DurationDt) {
DurationDt nextValue = (DurationDt) nextObject;
if (nextValue.getValue().isEmpty()) {
continue;
}
if (new UriDt(BaseFhirDao.UCUM_NS).equals(nextValue.getSystem())) {
if (isNotBlank(nextValue.getCode().getValue())) {
Unit<? extends Quantity> unit = Unit.valueOf(nextValue.getCode().getValue());
javax.measure.converter.UnitConverter dayConverter = unit.getConverterTo(NonSI.DAY);
double dayValue = dayConverter.convert(nextValue.getValue().getValue().doubleValue());
DurationDt newValue = new DurationDt();
newValue.setSystem(BaseFhirDao.UCUM_NS);
newValue.setCode(NonSI.DAY.toString());
newValue.setValue(dayValue);
nextValue = newValue;
/*
* @SuppressWarnings("unchecked") PhysicsUnit<? extends
* org.unitsofmeasurement.quantity.Quantity<?>> unit = (PhysicsUnit<? extends
* org.unitsofmeasurement.quantity.Quantity<?>>)
* UCUMFormat.getCaseInsensitiveInstance().parse(nextValue.getCode().getValue(), null); if
* (unit.isCompatible(UCUM.DAY)) {
*
* @SuppressWarnings("unchecked") PhysicsUnit<org.unitsofmeasurement.quantity.Time> timeUnit
* = (PhysicsUnit<Time>) unit; UnitConverter conv = timeUnit.getConverterTo(UCUM.DAY);
* double dayValue = conv.convert(nextValue.getValue().getValue().doubleValue()); DurationDt
* newValue = new DurationDt(); newValue.setSystem(UCUM_NS);
* newValue.setCode(UCUM.DAY.getSymbol()); newValue.setValue(dayValue); nextValue=newValue;
* }
*/
}
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue().getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else if (nextObject instanceof QuantityDt) {
QuantityDt nextValue = (QuantityDt) nextObject;
if (nextValue.getValue().isEmpty()) {
continue;
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, nextValue.getValue().getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else if (nextObject instanceof IntegerDt) {
IntegerDt nextValue = (IntegerDt) nextObject;
if (nextValue.getValue() == null) {
continue;
}
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(resourceName, new BigDecimal(nextValue.getValue()));
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
}
theEntity.setParamsNumberPopulated(retVal.size() > 0);
return retVal;
}
@Override
public List<ResourceIndexedSearchParamQuantity> extractSearchParamQuantity(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamQuantity> retVal = new ArrayList<ResourceIndexedSearchParamQuantity>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.QUANTITY) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof QuantityDt) {
QuantityDt nextValue = (QuantityDt) nextObject;
if (nextValue.getValue().isEmpty()) {
continue;
}
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValue.getValue().getValue(), nextValue.getSystem().getValueAsString(), nextValue.getUnits().getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
}
theEntity.setParamsNumberPopulated(retVal.size() > 0);
return retVal;
}
@Override
public List<ResourceIndexedSearchParamString> extractSearchParamStrings(ResourceTable theEntity, IResource theResource) {
ArrayList<ResourceIndexedSearchParamString> retVal = new ArrayList<ResourceIndexedSearchParamString>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.STRING) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
// TODO: implement phoenetic, and any others that have no path
continue;
}
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null || ((IDatatype) nextObject).isEmpty()) {
continue;
}
String resourceName = nextSpDef.getName();
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
if (nextObject instanceof IPrimitiveDatatype<?>) {
IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject;
String searchTerm = nextValue.getValueAsString();
if (searchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) {
searchTerm = searchTerm.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH);
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(searchTerm), searchTerm);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
} else {
if (nextObject instanceof BaseHumanNameDt) {
ArrayList<StringDt> allNames = new ArrayList<StringDt>();
HumanNameDt nextHumanName = (HumanNameDt) nextObject;
allNames.addAll(nextHumanName.getFamily());
allNames.addAll(nextHumanName.getGiven());
for (StringDt nextName : allNames) {
if (nextName.isEmpty()) {
continue;
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextName.getValueAsString()), nextName.getValueAsString());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else if (nextObject instanceof AddressDt) {
ArrayList<StringDt> allNames = new ArrayList<StringDt>();
AddressDt nextAddress = (AddressDt) nextObject;
allNames.addAll(nextAddress.getLine());
allNames.add(nextAddress.getCity());
allNames.add(nextAddress.getState());
allNames.add(nextAddress.getCountry());
allNames.add(nextAddress.getZip());
for (StringDt nextName : allNames) {
if (nextName.isEmpty()) {
continue;
}
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextName.getValueAsString()), nextName.getValueAsString());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else if (nextObject instanceof ContactDt) {
ContactDt nextContact = (ContactDt) nextObject;
if (nextContact.getValue().isEmpty() == false) {
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(resourceName, BaseFhirDao.normalizeString(nextContact.getValue().getValueAsString()), nextContact.getValue().getValueAsString());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + resourceName + " is of unexpected datatype: " + nextObject.getClass());
}
}
}
}
}
theEntity.setParamsStringPopulated(retVal.size() > 0);
return retVal;
}
@Override
public List<BaseResourceIndexedSearchParam> extractSearchParamTokens(ResourceTable theEntity, IResource theResource) {
ArrayList<BaseResourceIndexedSearchParam> retVal = new ArrayList<BaseResourceIndexedSearchParam>();
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
for (RuntimeSearchParam nextSpDef : def.getSearchParams()) {
if (nextSpDef.getParamType() != SearchParamTypeEnum.TOKEN) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
List<String> systems = new ArrayList<String>();
List<String> codes = new ArrayList<String>();
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject instanceof IdentifierDt) {
IdentifierDt nextValue = (IdentifierDt) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(nextValue.getSystem().getValueAsString());
codes.add(nextValue.getValue().getValue());
} else if (nextObject instanceof IPrimitiveDatatype<?>) {
IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(null);
codes.add(nextValue.getValueAsString());
} else if (nextObject instanceof CodeableConceptDt) {
CodeableConceptDt nextCC = (CodeableConceptDt) nextObject;
if (!nextCC.getText().isEmpty()) {
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(nextSpDef.getName(), BaseFhirDao.normalizeString(nextCC.getText().getValue()), nextCC.getText().getValue());
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
for (CodingDt nextCoding : nextCC.getCoding()) {
if (nextCoding.isEmpty()) {
continue;
}
String nextSystem = nextCoding.getSystem().getValueAsString();
String nextCode = nextCoding.getCode().getValue();
if (isNotBlank(nextSystem) || isNotBlank(nextCode)) {
systems.add(nextSystem);
codes.add(nextCode);
}
if (!nextCoding.getDisplay().isEmpty()) {
systems.add(null);
codes.add(nextCoding.getDisplay().getValue());
}
}
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
assert systems.size() == codes.size() : "Systems contains " + systems + ", codes contains: " + codes;
Set<Pair<String, String>> haveValues = new HashSet<Pair<String, String>>();
for (int i = 0; i < systems.size(); i++) {
String system = systems.get(i);
String code = codes.get(i);
if (isBlank(system) && isBlank(code)) {
continue;
}
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
system = system.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
code = code.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
Pair<String, String> nextPair = Pair.of(system, code);
if (haveValues.contains(nextPair)) {
continue;
}
haveValues.add(nextPair);
ResourceIndexedSearchParamToken nextEntity;
nextEntity = new ResourceIndexedSearchParamToken(nextSpDef.getName(), system, code);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
theEntity.setParamsTokenPopulated(retVal.size() > 0);
return retVal;
}
private List<Object> extractValues(String thePaths, IResource theResource) {
List<Object> values = new ArrayList<Object>();
String[] nextPathsSplit = thePaths.split("\\|");
FhirTerser t = myContext.newTerser();
for (String nextPath : nextPathsSplit) {
String nextPathTrimmed = nextPath.trim();
try {
values.addAll(t.getValues(theResource, nextPathTrimmed));
} catch (Exception e) {
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
ourLog.warn("Failed to index values from path[{}] in resource type[{}]: ", nextPathTrimmed, def.getName(), e.toString());
}
}
return values;
}
}

View File

@ -14,6 +14,7 @@ import javax.persistence.OneToOne;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;
@ -29,7 +30,11 @@ public abstract class BaseHasResource {
@Column(name = "RES_ENCODING", nullable = false, length = 5) @Column(name = "RES_ENCODING", nullable = false, length = 5)
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private ResourceEncodingEnum myEncoding; private ResourceEncodingEnum myEncoding;
@Column(name = "RES_VERSION", nullable = true, length = 5)
@Enumerated(EnumType.STRING)
private FhirVersionEnum myFhirVersion;
@OneToOne(optional = true, fetch = FetchType.EAGER, cascade = {}, orphanRemoval = false) @OneToOne(optional = true, fetch = FetchType.EAGER, cascade = {}, orphanRemoval = false)
@JoinColumn(name = "FORCED_ID_PID") @JoinColumn(name = "FORCED_ID_PID")
private ForcedId myForcedId; private ForcedId myForcedId;
@ -62,6 +67,10 @@ public abstract class BaseHasResource {
return myEncoding; return myEncoding;
} }
public FhirVersionEnum getFhirVersion() {
return myFhirVersion;
}
public ForcedId getForcedId() { public ForcedId getForcedId() {
return myForcedId; return myForcedId;
} }
@ -102,6 +111,10 @@ public abstract class BaseHasResource {
myEncoding = theEncoding; myEncoding = theEncoding;
} }
public void setFhirVersion(FhirVersionEnum theFhirVersion) {
myFhirVersion = theFhirVersion;
}
public void setForcedId(ForcedId theForcedId) { public void setForcedId(ForcedId theForcedId) {
myForcedId = theForcedId; myForcedId = theForcedId;
} }

View File

@ -327,6 +327,7 @@ public class ResourceTable extends BaseHasResource implements Serializable {
retVal.setPublished(getPublished()); retVal.setPublished(getPublished());
retVal.setUpdated(getUpdated()); retVal.setUpdated(getUpdated());
retVal.setEncoding(getEncoding()); retVal.setEncoding(getEncoding());
retVal.setFhirVersion(getFhirVersion());
retVal.setResource(getResource()); retVal.setResource(getResource());
retVal.setDeleted(getDeleted()); retVal.setDeleted(getDeleted());
retVal.setForcedId(getForcedId()); retVal.setForcedId(getForcedId());

View File

@ -34,7 +34,6 @@ public class JpaResourceProvider<T extends IResource> extends BaseJpaProvider im
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JpaResourceProvider.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JpaResourceProvider.class);
@Autowired(required = true)
private FhirContext myContext; private FhirContext myContext;
private IFhirResourceDao<T> myDao; private IFhirResourceDao<T> myDao;

View File

@ -13,37 +13,46 @@
<context:annotation-config /> <context:annotation-config />
<context:mbean-server /> <context:mbean-server />
<bean class="ca.uhn.fhir.context.FhirContext"></bean> <bean id="myFhirContext" class="ca.uhn.fhir.context.FhirContext"></bean>
<bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig"> <bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig">
</bean> </bean>
<bean id="mySystemDao" class="ca.uhn.fhir.jpa.dao.FhirSystemDao"> <bean id="mySystemDao" class="ca.uhn.fhir.jpa.dao.FhirSystemDao">
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myDiagnosticReportDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myDiagnosticReportDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DiagnosticReport"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DiagnosticReport"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myDeviceDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myDeviceDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Device"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Device"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myPatientDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myPatientDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Patient"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Patient"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myObservationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myObservationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Observation"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Observation"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myOrganizationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myOrganizationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Organization"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Organization"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myLocationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myLocationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Location"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Location"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myQuestionnaireDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myQuestionnaireDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Questionnaire"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Questionnaire"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myEncounterDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao"> <bean id="myEncounterDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Encounter"/> <property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Encounter"/>
<property name="context" ref="myFhirContext"/>
</bean> </bean>
<bean id="myPersistenceDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true"> <bean id="myPersistenceDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry excluding="**/*.java" including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/> <classpathentry excluding="**/*.java" including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" path="target/generated-sources/tinder"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>

View File

@ -124,46 +124,6 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.9-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>
<goals>
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<packageBase>ca.uhn.test.jpasrv</packageBase>
<baseResourceNames>
<baseResourceName>device</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>

View File

@ -13,50 +13,10 @@
<context:annotation-config /> <context:annotation-config />
<context:mbean-server /> <context:mbean-server />
<bean class="ca.uhn.fhir.context.FhirContext"></bean>
<bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig"> <bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig">
</bean> </bean>
<bean id="mySystemDao" class="ca.uhn.fhir.jpa.dao.FhirSystemDao">
</bean>
<bean id="myDiagnosticReportDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DiagnosticReport"/>
</bean>
<bean id="myImagingStudyDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.ImagingStudy"/>
</bean>
<bean id="myLocationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Location"/>
</bean>
<bean id="myPatientDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Patient"/>
</bean>
<bean id="myObservationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Observation"/>
</bean>
<bean id="myOrganizationDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Organization"/>
</bean>
<bean id="myQuestionnaireDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Questionnaire"/>
</bean>
<bean id="myEncounterDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.Encounter"/>
</bean>
<bean id="myDiagnosticOrderDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DiagnosticOrder"/>
</bean>
<bean id="myDocumentManifestDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DocumentManifest"/>
</bean>
<bean id="myDocumentReferenceDao" class="ca.uhn.fhir.jpa.dao.FhirResourceDao">
<property name="resourceType" value="ca.uhn.fhir.model.dstu.resource.DocumentReference"/>
</bean>
<bean id="myPersistenceDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true"> <bean id="myPersistenceDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">
<property name="url" value="jdbc:derby:memory:myUnitTestDB;create=true" /> <property name="url" value="jdbc:derby:memory:myUnitTestDB;create=true" />
<!-- <property name="url" value="jdbc:derby:directory:myUnitTestDB;create=true" /> --> <!-- <property name="url" value="jdbc:derby:directory:myUnitTestDB;create=true" /> -->

View File

@ -32,10 +32,8 @@ import ca.uhn.fhir.model.dstu.resource.DocumentReference;
import ca.uhn.fhir.model.dstu.resource.Encounter; import ca.uhn.fhir.model.dstu.resource.Encounter;
import ca.uhn.fhir.model.dstu.resource.ImagingStudy; import ca.uhn.fhir.model.dstu.resource.ImagingStudy;
import ca.uhn.fhir.model.dstu.resource.Location; import ca.uhn.fhir.model.dstu.resource.Location;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.Organization; import ca.uhn.fhir.model.dstu.resource.Organization;
import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
import ca.uhn.fhir.model.dstu.valueset.EncounterClassEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum;
@ -47,18 +45,10 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.gclient.StringClientParam; import ca.uhn.fhir.rest.gclient.StringClientParam;
import ca.uhn.fhir.rest.gclient.TokenClientParam; import ca.uhn.fhir.rest.gclient.TokenClientParam;
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider; import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.test.jpasrv.DiagnosticOrderResourceProvider;
import ca.uhn.test.jpasrv.DocumentManifestResourceProvider;
import ca.uhn.test.jpasrv.DocumentReferenceResourceProvider;
import ca.uhn.test.jpasrv.EncounterResourceProvider;
import ca.uhn.test.jpasrv.ImagingStudyResourceProvider;
import ca.uhn.test.jpasrv.LocationResourceProvider;
import ca.uhn.test.jpasrv.ObservationResourceProvider;
import ca.uhn.test.jpasrv.OrganizationResourceProvider;
import ca.uhn.test.jpasrv.PatientResourceProvider;
public class CompleteResourceProviderTest { public class CompleteResourceProviderTest {
@ -66,12 +56,11 @@ public class CompleteResourceProviderTest {
private static IGenericClient ourClient; private static IGenericClient ourClient;
private static FhirContext ourFhirCtx; private static FhirContext ourFhirCtx;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CompleteResourceProviderTest.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CompleteResourceProviderTest.class);
private static IFhirResourceDao<Observation> ourObservationDao; // private static IFhirResourceDao<Observation> ourObservationDao;
private static IFhirResourceDao<Patient> ourPatientDao; // private static IFhirResourceDao<Patient> ourPatientDao;
private static IFhirResourceDao<Questionnaire> ourQuestionnaireDao; // private static IFhirResourceDao<Questionnaire> ourQuestionnaireDao;
private static Server ourServer; private static Server ourServer;
private static IFhirResourceDao<Organization> ourOrganizationDao; private static IFhirResourceDao<Organization> ourOrganizationDao;
private static OrganizationResourceProvider ourOrganizationRp;
private static DaoConfig ourDaoConfig; private static DaoConfig ourDaoConfig;
// private static JpaConformanceProvider ourConfProvider; // private static JpaConformanceProvider ourConfProvider;
@ -107,7 +96,7 @@ public class CompleteResourceProviderTest {
public void testCountParam() throws Exception { public void testCountParam() throws Exception {
// NB this does not get used- The paging provider has its own limits built in // NB this does not get used- The paging provider has its own limits built in
ourDaoConfig.setHardSearchLimit(100); ourDaoConfig.setHardSearchLimit(100);
List<IResource> resources = new ArrayList<>(); List<IResource> resources = new ArrayList<>();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
Organization org = new Organization(); Organization org = new Organization();
@ -241,7 +230,7 @@ public class CompleteResourceProviderTest {
} }
Bundle history = ourClient.history(null, (String) null, null, null); Bundle history = ourClient.history(null, (String) null, null, null);
assertEquals("Expected[" + p1Id.getIdPart() + "] but was " + history.getEntries().get(0).getId(), p1Id.getIdPart(), history.getEntries().get(0).getId().getIdPart()); assertEquals("Expected[" + p1Id.getIdPart() + "] but was " + history.getEntries().get(0).getId(), p1Id.getIdPart(), history.getEntries().get(0).getId().getIdPart());
assertNotNull(history.getEntries().get(0).getResource()); assertNotNull(history.getEntries().get(0).getResource());
} }
@ -360,8 +349,7 @@ public class CompleteResourceProviderTest {
p1.addIdentifier().setValue("testSearchByIdentifierWithoutSystem01"); p1.addIdentifier().setValue("testSearchByIdentifierWithoutSystem01");
IdDt p1Id = ourClient.create().resource(p1).execute().getId(); IdDt p1Id = ourClient.create().resource(p1).execute().getId();
Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01")).encodedJson().prettyPrint() Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01")).encodedJson().prettyPrint().execute();
.execute();
assertEquals(1, actual.size()); assertEquals(1, actual.size());
assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getId().getIdPart()); assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getId().getIdPart());
@ -459,8 +447,7 @@ public class CompleteResourceProviderTest {
assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExist/_history")); assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExist/_history"));
Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExist")).encodedJson() Bundle actual = ourClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExist")).encodedJson().prettyPrint().execute();
.prettyPrint().execute();
assertEquals(1, actual.size()); assertEquals(1, actual.size());
assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getId().getIdPart()); assertEquals(p1Id.getIdPart(), actual.getEntries().get(0).getId().getIdPart());
@ -479,85 +466,38 @@ public class CompleteResourceProviderTest {
RestfulServer restServer = new RestfulServer(); RestfulServer restServer = new RestfulServer();
String serverBase = "http://localhost:" + port + "/fhir/context"; String serverBase = "http://localhost:" + port + "/fhir/context";
if (true) { ourAppCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-spring-test-config.xml");
ourAppCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml");
ourDaoConfig = (DaoConfig)ourAppCtx.getBean(DaoConfig.class); ourDaoConfig = (DaoConfig) ourAppCtx.getBean(DaoConfig.class);
ourPatientDao = (IFhirResourceDao<Patient>) ourAppCtx.getBean("myPatientDao", IFhirResourceDao.class);
PatientResourceProvider patientRp = new PatientResourceProvider();
patientRp.setDao(ourPatientDao);
ourQuestionnaireDao = (IFhirResourceDao<Questionnaire>) ourAppCtx.getBean("myQuestionnaireDao", IFhirResourceDao.class); ourOrganizationDao = (IFhirResourceDao<Organization>) ourAppCtx.getBean("myOrganizationDaoDstu1", IFhirResourceDao.class);
QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider();
questionnaireRp.setDao(ourQuestionnaireDao);
ourObservationDao = (IFhirResourceDao<Observation>) ourAppCtx.getBean("myObservationDao", IFhirResourceDao.class); List<IResourceProvider> rpsDstu1 = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDstu1", List.class);
ObservationResourceProvider observationRp = new ObservationResourceProvider(); restServer.setResourceProviders(rpsDstu1);
observationRp.setDao(ourObservationDao);
IFhirResourceDao<Location> locationDao = (IFhirResourceDao<Location>) ourAppCtx.getBean("myLocationDao", IFhirResourceDao.class); restServer.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
LocationResourceProvider locationRp = new LocationResourceProvider();
locationRp.setDao(locationDao);
IFhirResourceDao<Encounter> encounterDao = (IFhirResourceDao<Encounter>) ourAppCtx.getBean("myEncounterDao", IFhirResourceDao.class); IFhirSystemDao systemDao = (IFhirSystemDao) ourAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class);
EncounterResourceProvider encounterRp = new EncounterResourceProvider(); JpaSystemProvider systemProv = new JpaSystemProvider(systemDao);
encounterRp.setDao(encounterDao); restServer.setPlainProviders(systemProv);
ourOrganizationDao = (IFhirResourceDao<Organization>) ourAppCtx.getBean("myOrganizationDao", IFhirResourceDao.class); restServer.setPagingProvider(new FifoMemoryPagingProvider(10));
ourOrganizationRp = new OrganizationResourceProvider();
ourOrganizationRp.setDao(ourOrganizationDao);
IFhirResourceDao<ImagingStudy> imagingStudyDao = (IFhirResourceDao<ImagingStudy>) ourAppCtx.getBean("myImagingStudyDao", IFhirResourceDao.class); ourServer = new Server(port);
ImagingStudyResourceProvider imagingStudyRp = new ImagingStudyResourceProvider();
imagingStudyRp.setDao(imagingStudyDao);
IFhirResourceDao<DiagnosticOrder> diagnosticOrderDao = ourAppCtx.getBean("myDiagnosticOrderDao", IFhirResourceDao.class); ServletContextHandler proxyHandler = new ServletContextHandler();
DiagnosticOrderResourceProvider diagnosticOrderRp = new DiagnosticOrderResourceProvider(); proxyHandler.setContextPath("/");
diagnosticOrderRp.setDao(diagnosticOrderDao);
IFhirResourceDao<DocumentManifest> documentManifestDao = ourAppCtx.getBean("myDocumentManifestDao", IFhirResourceDao.class); ServletHolder servletHolder = new ServletHolder();
DocumentManifestResourceProvider documentManifestRp = new DocumentManifestResourceProvider(); servletHolder.setServlet(restServer);
documentManifestRp.setDao(documentManifestDao); proxyHandler.addServlet(servletHolder, "/fhir/context/*");
IFhirResourceDao<DocumentReference> documentReferenceDao = ourAppCtx.getBean("myDocumentReferenceDao", IFhirResourceDao.class); ourServer.setHandler(proxyHandler);
DocumentReferenceResourceProvider documentReferenceRp = new DocumentReferenceResourceProvider(); ourServer.start();
documentReferenceRp.setDao(documentReferenceDao);
restServer.setResourceProviders(diagnosticOrderRp, documentManifestRp, documentReferenceRp, encounterRp, locationRp, patientRp, questionnaireRp, ourOrganizationRp, imagingStudyRp);
restServer.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
IFhirSystemDao systemDao = (IFhirSystemDao) ourAppCtx.getBean("mySystemDao", IFhirSystemDao.class);
JpaSystemProvider systemProv = new JpaSystemProvider(systemDao);
restServer.setPlainProviders(systemProv);
// ourConfProvider = new JpaConformanceProvider(restServer, systemDao,
// Collections.singletonList((IFhirResourceDao)patientDao));
restServer.setPagingProvider(new FifoMemoryPagingProvider(10));
ourServer = new Server(port);
ServletContextHandler proxyHandler = new ServletContextHandler();
proxyHandler.setContextPath("/");
// testerServlet.setServerBase("http://fhir.healthintersections.com.au/open");
ServletHolder servletHolder = new ServletHolder();
servletHolder.setServlet(restServer);
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
ourServer.setHandler(proxyHandler);
ourServer.start();
}
ourFhirCtx = restServer.getFhirContext(); ourFhirCtx = restServer.getFhirContext();
// ourCtx.getRestfulClientFactory().setProxy("localhost", 8888);
ourClient = ourFhirCtx.newRestfulGenericClient(serverBase); ourClient = ourFhirCtx.newRestfulGenericClient(serverBase);
// ourClient = ourCtx.newRestfulGenericClient("http://fhir.healthintersections.com.au/open");
// ourClient = ourCtx.newRestfulGenericClient("https://fhir.orionhealth.com/blaze/fhir");
// ourClient = ourCtx.newRestfulGenericClient("http://spark.furore.com/fhir");
ourClient.registerInterceptor(new LoggingInterceptor(true)); ourClient.registerInterceptor(new LoggingInterceptor(true));
} }

View File

@ -0,0 +1,190 @@
package ca.uhn.fhir.jpa.test;
import static org.junit.Assert.*;
import java.util.List;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.provider.JpaSystemProvider;
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.dev.resource.SupportingDocumentation;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.client.IGenericClient;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
public class MultiFhirVersionTest {
private static ClassPathXmlApplicationContext ourAppCtx;
private static IGenericClient ourClientDev;
private static Server ourServer;
private static IGenericClient ourClientDstu1;
@AfterClass
public static void afterClass() throws Exception {
ourServer.stop();
ourAppCtx.stop();
}
@Test
public void testSubmitPatient() {
Patient p = new Patient();
p.addIdentifier("urn:MultiFhirVersionTest", "testSubmitPatient01");
p.addUndeclaredExtension(false, "http://foo#ext1", new StringDt("The value"));
p.getGender().setValueAsEnum(AdministrativeGenderCodesEnum.M);
IdDt id = ourClientDstu1.create().resource(p).execute().getId();
// Read back as DSTU1
Patient patDstu1 = ourClientDstu1.read(Patient.class, id);
assertEquals("testSubmitPatient01", p.getIdentifierFirstRep().getValue().getValue());
assertEquals(1, patDstu1.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals("M", patDstu1.getGender().getCodingFirstRep().getCode().getValue());
// Read back as DEV
ca.uhn.fhir.model.dev.resource.Patient patDev;
patDev = ourClientDev.read(ca.uhn.fhir.model.dev.resource.Patient.class, id);
assertEquals("testSubmitPatient01", p.getIdentifierFirstRep().getValue().getValue());
assertEquals(1, patDev.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals(null, patDev.getGender());
// Search using new bundle format
Bundle bundle = ourClientDev.search().forResource(ca.uhn.fhir.model.dev.resource.Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:MultiFhirVersionTest", "testSubmitPatient01")).encodedJson().execute();
patDev = (ca.uhn.fhir.model.dev.resource.Patient) bundle.getEntries().get(0).getResource();
assertEquals("testSubmitPatient01", p.getIdentifierFirstRep().getValue().getValue());
assertEquals(1, patDev.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals(null, patDev.getGender());
}
@Test
public void testSubmitPatientDev() {
ca.uhn.fhir.model.dev.resource.Patient p = new ca.uhn.fhir.model.dev.resource.Patient();
p.addIdentifier().setSystem("urn:MultiFhirVersionTest").setValue("testSubmitPatientDev01");
p.addUndeclaredExtension(false, "http://foo#ext1", new StringDt("The value"));
p.setGender(AdministrativeGenderEnum.MALE);
IdDt id = ourClientDev.create().resource(p).execute().getId();
// Read back as DSTU1
Patient patDstu1 = ourClientDstu1.read(Patient.class, id);
assertEquals("testSubmitPatientDev01", p.getIdentifierFirstRep().getValue());
assertEquals(1, patDstu1.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals(null, patDstu1.getGender().getCodingFirstRep().getCode().getValue());
// Read back as DEV
ca.uhn.fhir.model.dev.resource.Patient patDev;
patDev = ourClientDev.read(ca.uhn.fhir.model.dev.resource.Patient.class, id);
assertEquals("testSubmitPatientDev01", p.getIdentifierFirstRep().getValue());
assertEquals(1, patDev.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals("male", patDev.getGender());
// Search using new bundle format
Bundle bundle = ourClientDev.search().forResource(ca.uhn.fhir.model.dev.resource.Patient.class).where(Patient.IDENTIFIER.exactly().systemAndCode("urn:MultiFhirVersionTest", "testSubmitPatientDev01")).encodedJson().execute();
patDev = (ca.uhn.fhir.model.dev.resource.Patient) bundle.getEntries().get(0).getResource();
assertEquals("testSubmitPatientDev01", p.getIdentifierFirstRep().getValue());
assertEquals(1, patDev.getUndeclaredExtensionsByUrl("http://foo#ext1").size());
assertEquals("male", patDev.getGender());
}
@Test
public void testUnknownResourceType() {
ca.uhn.fhir.model.dev.resource.Patient p = new ca.uhn.fhir.model.dev.resource.Patient();
p.addIdentifier().setSystem("urn:MultiFhirVersionTest").setValue("testUnknownResourceType01");
IdDt id = ourClientDev.create().resource(p).execute().getId();
SupportingDocumentation s = new SupportingDocumentation();
s.addIdentifier().setSystem("urn:MultiFhirVersionTest").setValue("testUnknownResourceType02");
id = ourClientDev.create().resource(s).execute().getId();
Bundle history = ourClientDev.history(null, id, null, null);
assertEquals(SupportingDocumentation.class, history.getEntries().get(0).getResource().getClass());
assertEquals(ca.uhn.fhir.model.dev.resource.Patient.class, history.getEntries().get(1).getResource().getClass());
history = ourClientDstu1.history(null, id, null, null);
assertEquals(ca.uhn.fhir.model.dstu.resource.Patient.class, history.getEntries().get(0).getResource().getClass());
}
@SuppressWarnings("unchecked")
@BeforeClass
public static void beforeClass() throws Exception {
ourAppCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dev.xml", "hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-spring-test-config.xml");
int port = RandomServerPortProvider.findFreePort();
ServletContextHandler proxyHandler = new ServletContextHandler();
proxyHandler.setContextPath("/");
ourServer = new Server(port);
/*
* DEV resources
*/
RestfulServer restServerDev = new RestfulServer();
restServerDev.setFhirContext(ourAppCtx.getBean("myFhirContextDev", FhirContext.class));
List<IResourceProvider> rpsDev = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDev", List.class);
restServerDev.setResourceProviders(rpsDev);
JpaSystemProvider systemProvDev = (JpaSystemProvider) ourAppCtx.getBean("mySystemProviderDev", JpaSystemProvider.class);
restServerDev.setPlainProviders(systemProvDev);
ServletHolder servletHolder = new ServletHolder();
servletHolder.setServlet(restServerDev);
proxyHandler.addServlet(servletHolder, "/fhir/contextDev/*");
/*
* DSTU resources
*/
RestfulServer restServerDstu1 = new RestfulServer();
restServerDstu1.setFhirContext(ourAppCtx.getBean("myFhirContextDstu1", FhirContext.class));
List<IResourceProvider> rpsDstu1 = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDstu1", List.class);
restServerDstu1.setResourceProviders(rpsDstu1);
JpaSystemProvider systemProvDstu1 = (JpaSystemProvider) ourAppCtx.getBean("mySystemProviderDstu1", JpaSystemProvider.class);
restServerDstu1.setPlainProviders(systemProvDstu1);
servletHolder = new ServletHolder();
servletHolder.setServlet(restServerDstu1);
proxyHandler.addServlet(servletHolder, "/fhir/contextDstu1/*");
/*
* Start server
*/
ourServer.setHandler(proxyHandler);
ourServer.start();
/*
* DEV Client
*/
String serverBaseDev = "http://localhost:" + port + "/fhir/contextDev";
FhirContext ctxDev = ourAppCtx.getBean("myFhirContextDev", FhirContext.class);
ctxDev.getRestfulClientFactory().setSocketTimeout(600 * 1000);
ourClientDev = ctxDev.newRestfulGenericClient(serverBaseDev);
ourClientDev.registerInterceptor(new LoggingInterceptor(true));
/*
* DSTU1 Client
*/
String serverBaseDstu1 = "http://localhost:" + port + "/fhir/contextDstu1";
FhirContext ctxDstu1 = ourAppCtx.getBean("myFhirContextDstu1", FhirContext.class);
ctxDstu1.getRestfulClientFactory().setSocketTimeout(600 * 1000);
ourClientDstu1 = ctxDstu1.newRestfulGenericClient(serverBaseDstu1);
ourClientDstu1.registerInterceptor(new LoggingInterceptor(true));
}
}

View File

@ -16,6 +16,9 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.provider.JpaSystemProvider;
import ca.uhn.fhir.jpa.rp.dstu.ObservationResourceProvider;
import ca.uhn.fhir.jpa.rp.dstu.OrganizationResourceProvider;
import ca.uhn.fhir.jpa.rp.dstu.PatientResourceProvider;
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
@ -25,9 +28,6 @@ import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Questionnaire; import ca.uhn.fhir.model.dstu.resource.Questionnaire;
import ca.uhn.fhir.rest.client.IGenericClient; import ca.uhn.fhir.rest.client.IGenericClient;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.test.jpasrv.ObservationResourceProvider;
import ca.uhn.test.jpasrv.OrganizationResourceProvider;
import ca.uhn.test.jpasrv.PatientResourceProvider;
public class SystemTest { public class SystemTest {
@ -58,23 +58,23 @@ public class SystemTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {
ourAppCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml"); ourAppCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml", "hapi-fhir-server-resourceproviders-dstu1.xml");
IFhirResourceDao<Patient> patientDao = (IFhirResourceDao<Patient>) ourAppCtx.getBean("myPatientDao", IFhirResourceDao.class); IFhirResourceDao<Patient> patientDao = (IFhirResourceDao<Patient>) ourAppCtx.getBean("myPatientDaoDstu1", IFhirResourceDao.class);
PatientResourceProvider patientRp = new PatientResourceProvider(); PatientResourceProvider patientRp = new PatientResourceProvider();
patientRp.setDao(patientDao); patientRp.setDao(patientDao);
IFhirResourceDao<Questionnaire> questionnaireDao = (IFhirResourceDao<Questionnaire>) ourAppCtx.getBean("myQuestionnaireDao", IFhirResourceDao.class); IFhirResourceDao<Questionnaire> questionnaireDao = (IFhirResourceDao<Questionnaire>) ourAppCtx.getBean("myQuestionnaireDaoDstu1", IFhirResourceDao.class);
QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider(); QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider();
questionnaireRp.setDao(questionnaireDao); questionnaireRp.setDao(questionnaireDao);
IFhirResourceDao<Observation> observationDao = (IFhirResourceDao<Observation>) ourAppCtx.getBean("myObservationDao", IFhirResourceDao.class); IFhirResourceDao<Observation> observationDao = (IFhirResourceDao<Observation>) ourAppCtx.getBean("myObservationDaoDstu1", IFhirResourceDao.class);
ObservationResourceProvider observationRp = new ObservationResourceProvider(); ObservationResourceProvider observationRp = new ObservationResourceProvider();
observationRp.setDao(observationDao); observationRp.setDao(observationDao);
IFhirSystemDao systemDao = ourAppCtx.getBean("mySystemDao", IFhirSystemDao.class); IFhirSystemDao systemDao = ourAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class);
IFhirResourceDao<Organization> organizationDao = (IFhirResourceDao<Organization>) ourAppCtx.getBean("myOrganizationDao", IFhirResourceDao.class); IFhirResourceDao<Organization> organizationDao = (IFhirResourceDao<Organization>) ourAppCtx.getBean("myOrganizationDaoDstu1", IFhirResourceDao.class);
OrganizationResourceProvider organizationRp = new OrganizationResourceProvider(); OrganizationResourceProvider organizationRp = new OrganizationResourceProvider();
organizationRp.setDao(organizationDao); organizationRp.setDao(organizationDao);

View File

@ -3,3 +3,4 @@ target/
fhir/ fhir/
/bin /bin
nohup.out nohup.out
/target/

View File

@ -15,7 +15,10 @@
<dependent-module archiveName="hapi-fhir-structures-dstu-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu"> <dependent-module archiveName="hapi-fhir-structures-dstu-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.9-SNAPSHOT/hapi-fhir-testpage-overlay-0.9-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module archiveName="hapi-fhir-structures-dev-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dev/hapi-fhir-structures-dev">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type> <dependency-type>consumes</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -23,6 +23,11 @@
<artifactId>hapi-fhir-structures-dstu</artifactId> <artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version> <version>0.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dev</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
@ -187,97 +192,6 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.9-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>
<goals>
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<version>dstu</version>
<packageBase>ca.uhn.test.jpasrv</packageBase>
<baseResourceNames>
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
<baseResourceName>conformance</baseResourceName>
<baseResourceName>coverage</baseResourceName>
<baseResourceName>deviceobservationreport</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName>
<baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>gvfmeta</baseResourceName>
<baseResourceName>gvfvariant</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>immunizationrecommendation</baseResourceName>
<baseResourceName>immunization</baseResourceName>
<baseResourceName>list</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>media</baseResourceName>
<baseResourceName>medicationadministration</baseResourceName>
<baseResourceName>medicationdispense</baseResourceName>
<baseResourceName>medicationprescription</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>medicationstatement</baseResourceName>
<baseResourceName>messageheader</baseResourceName>
<baseResourceName>microarray</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<baseResourceName>securityevent</baseResourceName>
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
<targetResourceDirectory>${project.build.directory}/hapi-fhir-jpaserver/WEB-INF</targetResourceDirectory>
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders.xml</targetResourceSpringBeansFile>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>

View File

@ -1,6 +1,6 @@
package ca.uhn.fhirtest; package ca.uhn.fhirtest;
import java.util.Collection; import java.util.List;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -27,6 +27,7 @@ public class TestRestfulServer extends RestfulServer {
private ApplicationContext myAppCtx; private ApplicationContext myAppCtx;
@SuppressWarnings("unchecked")
@Override @Override
protected void initialize() throws ServletException { protected void initialize() throws ServletException {
super.initialize(); super.initialize();
@ -46,13 +47,31 @@ public class TestRestfulServer extends RestfulServer {
// "WEB-INF/hapi-fhir-server-config.xml" // "WEB-INF/hapi-fhir-server-config.xml"
// ); // );
String fhirVersionParam = getInitParameter("FhirVersion");
if (StringUtils.isBlank(fhirVersionParam)) {
fhirVersionParam="DSTU1";
}
myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext(); myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext();
FhirContext ctx = myAppCtx.getBean(FhirContext.class); List<IResourceProvider> beans;
ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator()); switch (fhirVersionParam.trim().toUpperCase()) {
setFhirContext(ctx); case "DSTU":
case "DSTU1":
setFhirContext(FhirContext.forDstu1());
beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class);
break;
case "DEV":
setFhirContext(FhirContext.forDev());
beans = myAppCtx.getBean("myResourceProvidersDev", List.class);
break;
default:
throw new ServletException("Unknown FHIR version specified in init-param[FhirVersion]: " + fhirVersionParam);
}
FhirContext ctx = getFhirContext();
ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
Collection<IResourceProvider> beans = myAppCtx.getBeansOfType(IResourceProvider.class).values();
for (IResourceProvider nextResourceProvider : beans) { for (IResourceProvider nextResourceProvider : beans) {
ourLog.info(" * Have resource provider for: {}", nextResourceProvider.getResourceType().getSimpleName()); ourLog.info(" * Have resource provider for: {}", nextResourceProvider.getResourceType().getSimpleName());
} }

View File

@ -12,14 +12,15 @@
<bean class="ca.uhn.fhir.to.TesterConfig"> <bean class="ca.uhn.fhir.to.TesterConfig">
<property name="servers"> <property name="servers">
<list> <list>
<value>home , UHN/HAPI Server , http://fhirtest.uhn.ca/base</value> <value>home , DSTU1 , UHN/HAPI Server (DSTU1 FHIR) , http://fhirtest.uhn.ca/baseDstu1</value>
<value>hi , Health Intersections (Ref Server) , http://fhir.healthintersections.com.au/open</value> <value>home_dev , DEV , UHN/HAPI Server (DEV FHIR) , http://fhirtest.uhn.ca/baseDev</value>
<value>hidev , Health Intersections (Developnent FHIR) , http://fhir-dev.healthintersections.com.au/open</value> <value>hi , DSTU1 , Health Intersections (DSTU1 FHIR) , http://fhir.healthintersections.com.au/open</value>
<value>furore , Spark - Furore (Ref Server) , http://spark.furore.com/fhir</value> <value>hidev , DEV , Health Intersections (DEV FHIR) , http://fhir-dev.healthintersections.com.au/open</value>
<value>blaze , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value> <value>furore , DSTU1 , Spark - Furore , http://spark.furore.com/fhir</value>
<value>oridashi , Oridashi , http://demo.oridashi.com.au:8190</value> <value>blaze , DSTU1 , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value>
<!-- <value>fhirbase , FHIRPlace (Health Samurai) , http://try-fhirplace.hospital-systems.com/ </value> --> <value>oridashi , DSTU1 , Oridashi , http://demo.oridashi.com.au:8190</value>
<value>nortal , Nortal , http://fhir.nortal.com/fhir-server</value> <!-- <value>fhirbase , DSTU1 , FHIRPlace (Health Samurai) , http://try-fhirplace.hospital-systems.com/ </value> -->
<value>nortal , DSTU1 , Nortal , http://fhir.nortal.com/fhir-server</value>
</list> </list>
</property> </property>
</bean> </bean>

View File

@ -11,7 +11,8 @@
<param-value> <param-value>
/WEB-INF/hapi-fhir-server-database-config.xml /WEB-INF/hapi-fhir-server-database-config.xml
/WEB-INF/hapi-fhir-server-config.xml /WEB-INF/hapi-fhir-server-config.xml
/WEB-INF/hapi-fhir-server-resourceproviders.xml classpath:hapi-fhir-server-resourceproviders-dstu1.xml
classpath:hapi-fhir-server-resourceproviders-dev.xml
/WEB-INF/hapi-fhir-tester-application-context.xml /WEB-INF/hapi-fhir-tester-application-context.xml
/WEB-INF/hapi-fhir-tester-config.xml /WEB-INF/hapi-fhir-tester-config.xml
</param-value> </param-value>
@ -33,20 +34,48 @@
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>fhirServlet</servlet-name> <servlet-name>fhirServletDstu1</servlet-name>
<servlet-class>ca.uhn.fhirtest.TestRestfulServer</servlet-class> <servlet-class>ca.uhn.fhirtest.TestRestfulServer</servlet-class>
<init-param> <init-param>
<param-name>ImplementationDescription</param-name> <param-name>ImplementationDescription</param-name>
<param-value>UHN Test Server</param-value> <param-value>UHN Test Server (DSTU1 Resources)</param-value>
</init-param>
<init-param>
<param-name>FhirVersion</param-name>
<param-value>DSTU1</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>fhirServletDev</servlet-name>
<servlet-class>ca.uhn.fhirtest.TestRestfulServer</servlet-class>
<init-param>
<param-name>ImplementationDescription</param-name>
<param-value>UHN Test Server (DEV Resources)</param-value>
</init-param>
<init-param>
<param-name>FhirVersion</param-name>
<param-value>DEV</param-value>
</init-param> </init-param>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>fhirServlet</servlet-name> <servlet-name>fhirServletDstu1</servlet-name>
<url-pattern>/base/*</url-pattern> <url-pattern>/base/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>fhirServletDstu1</servlet-name>
<url-pattern>/baseDstu1/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>fhirServletDev</servlet-name>
<url-pattern>/baseDev/*</url-pattern>
</servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>spring</servlet-name> <servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern> <url-pattern>/</url-pattern>

View File

@ -24,6 +24,7 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>

View File

@ -5,6 +5,11 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <name>org.eclipse.jdt.core.javabuilder</name>
<arguments> <arguments>
@ -15,9 +20,17 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -1,5 +1,8 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.6

View File

@ -245,7 +245,7 @@
<baseResourceName>explanationofbenefit</baseResourceName> <baseResourceName>explanationofbenefit</baseResourceName>
<baseResourceName>extensiondefinition</baseResourceName> <baseResourceName>extensiondefinition</baseResourceName>
<baseResourceName>familyhistory</baseResourceName> <baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName> <!--<baseResourceName>geneexpression</baseResourceName>-->
<baseResourceName>geneticanalysis</baseResourceName> <baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>goal</baseResourceName> <baseResourceName>goal</baseResourceName>
<!--<baseResourceName>goalrequest</baseResourceName>--> <!--<baseResourceName>goalrequest</baseResourceName>-->

View File

@ -0,0 +1,8 @@
package ca.uhn.fhir.model.dev.api;
import ca.uhn.fhir.model.api.BaseResource;
public abstract class BaseResourceDev extends BaseResource {
}

View File

@ -0,0 +1,42 @@
package ca.uhn.fhir.model.dev;
import java.io.IOException;
import java.util.Properties;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.IResource;
public class ModelInstantiationTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelInstantiationTest.class);
@SuppressWarnings("unchecked")
@Test
public void testInstantiateAllTypes() throws Exception {
FhirContext ctx = FhirContext.forDev();
Properties p = new Properties();
p.load(ctx.getVersion().getFhirVersionPropertiesFile());
for (Object next : p.keySet()) {
String nextStr = (String)next;
if (nextStr.startsWith("resource.")) {
nextStr = nextStr.substring("resource.".length());
} else {
continue;
}
String className = p.getProperty((String) next);
ourLog.info("Loading class: {}", className);
Class<? extends IResource> clazz = (Class<? extends IResource>) Class.forName(className);
RuntimeResourceDefinition def = ctx.getResourceDefinition(clazz);
def.newInstance();
}
}
}

View File

@ -37,6 +37,16 @@ public class JsonParserTest {
assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val); assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val);
} }
@Test
public void testParsePatientInBundle() {
String text = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
FhirContext ctx = FhirContext.forDev();
Bundle b = ctx.newJsonParser().parseBundle(text);
assertEquals(Patient.class, b.getEntries().get(0).getResource().getClass());
}
@Test @Test
public void testParseAndEncodeBundle() throws Exception { public void testParseAndEncodeBundle() throws Exception {
String content = IOUtils.toString(JsonParserTest.class.getResourceAsStream("/bundle-example.json")); String content = IOUtils.toString(JsonParserTest.class.getResourceAsStream("/bundle-example.json"));

View File

@ -0,0 +1,73 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.io.StringReader;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.rest.server.Constants;
public class GenericClientTest {
private static FhirContext myCtx;
private HttpClient myHttpClient;
private HttpResponse myHttpResponse;
@BeforeClass
public static void beforeClass() {
myCtx = FhirContext.forDev();
}
@Before
public void before() {
myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
myCtx.getRestfulClientFactory().setHttpClient(myHttpClient);
myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
}
@Test
public void testSearchByString() throws Exception {
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
IGenericClient client = myCtx.newRestfulGenericClient("http://example.com/fhir");
//@formatter:off
Bundle response = client.search()
.forResource("Patient")
.where(Patient.NAME.matches().value("james"))
.execute();
//@formatter:on
assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString());
assertEquals(Patient.class, response.getEntries().get(0).getResource().getClass());
}
}

View File

@ -0,0 +1,8 @@
package ca.uhn.fhir.model.dstu.api;
import ca.uhn.fhir.model.api.BaseResource;
public abstract class BaseResourceDstu extends BaseResource {
}

View File

@ -206,6 +206,10 @@ public class ResourceWithExtensionsA extends BaseResource {
} }
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.DSTU1;
}
} }

View File

@ -10,6 +10,7 @@ import javax.servlet.ServletException;
import org.hamcrest.core.StringContains; import org.hamcrest.core.StringContains;
import org.junit.Test; import org.junit.Test;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.api.BaseResource; import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
@ -221,6 +222,11 @@ public class ServerInvalidDefinitionTest {
public ContainedDt getContained() { public ContainedDt getContained() {
return null; return null;
} }
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.DSTU1;
}
}.getClass(); }.getClass();
} }

View File

@ -19,6 +19,7 @@ package ca.uhn.fhir.testmodel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.api.BaseResource; import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
@ -112,6 +113,10 @@ public class Patient extends BaseResource implements IResource {
} }
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.DSTU1;
}

View File

@ -34,6 +34,11 @@
<artifactId>hapi-fhir-structures-dstu</artifactId> <artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.9-SNAPSHOT</version> <version>0.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dev</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId> <artifactId>thymeleaf</artifactId>

View File

@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.thymeleaf.TemplateEngine; import org.thymeleaf.TemplateEngine;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ExtensionDt;
@ -83,8 +84,8 @@ public class Controller {
@Autowired @Autowired
private TesterConfig myConfig; private TesterConfig myConfig;
@Autowired private Map<FhirVersionEnum, FhirContext> myContexts = new HashMap<FhirVersionEnum, FhirContext>();
private FhirContext myCtx;
private List<String> myFilterHeaders; private List<String> myFilterHeaders;
@Autowired @Autowired
@ -107,7 +108,7 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
ResultType returnsResource = ResultType.RESOURCE; ResultType returnsResource = ResultType.RESOURCE;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@ -118,7 +119,7 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, "Loaded conformance", interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, "Loaded conformance", interceptor, theRequest);
ourLog.info(logPrefix(theModel) + "Displayed conformance profile"); ourLog.info(logPrefix(theModel) + "Displayed conformance profile");
@ -137,11 +138,11 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
RuntimeResourceDefinition def; RuntimeResourceDefinition def;
try { try {
def = getResourceType(theReq); def = getResourceType(theRequest, theReq);
} catch (ServletException e) { } catch (ServletException e) {
theModel.put("errorMsg", e.toString()); theModel.put("errorMsg", e.toString());
return "resource"; return "resource";
@ -163,7 +164,7 @@ public class Controller {
returnsResource = handleClientException(client, e, theModel); returnsResource = handleClientException(client, e, theModel);
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
ourLog.info(logPrefix(theModel) + "Deleted resource of type " + def.getName()); ourLog.info(logPrefix(theModel) + "Deleted resource of type " + def.getName());
@ -175,7 +176,7 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
Class<? extends IResource> resType = null; Class<? extends IResource> resType = null;
ResultType returnsResource = ResultType.TAGLIST; ResultType returnsResource = ResultType.TAGLIST;
@ -186,7 +187,7 @@ public class Controller {
if (isNotBlank(theReq.getParameter(PARAM_RESOURCE))) { if (isNotBlank(theReq.getParameter(PARAM_RESOURCE))) {
RuntimeResourceDefinition def; RuntimeResourceDefinition def;
try { try {
def = getResourceType(theReq); def = getResourceType(theRequest, theReq);
} catch (ServletException e) { } catch (ServletException e) {
theModel.put("errorMsg", e.toString()); theModel.put("errorMsg", e.toString());
return "resource"; return "resource";
@ -216,7 +217,7 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
return "result"; return "result";
} }
@ -244,7 +245,7 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
String url = defaultString(theReq.getParameter("page-url")); String url = defaultString(theReq.getParameter("page-url"));
if (!url.startsWith(theModel.get("base").toString())) { if (!url.startsWith(theModel.get("base").toString())) {
@ -268,7 +269,7 @@ public class Controller {
String outcomeDescription = "Bundle Page"; String outcomeDescription = "Bundle Page";
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
return "result"; return "result";
} }
@ -278,11 +279,11 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
RuntimeResourceDefinition def; RuntimeResourceDefinition def;
try { try {
def = getResourceType(theReq); def = getResourceType(theRequest, theReq);
} catch (ServletException e) { } catch (ServletException e) {
theModel.put("errorMsg", e.toString()); theModel.put("errorMsg", e.toString());
return "resource"; return "resource";
@ -313,26 +314,60 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
return "result"; return "result";
} }
@RequestMapping({ "/resource" }) @RequestMapping({ "/resource" })
public String actionResource(final ResourceRequest theRequest, final BindingResult theBindingResult, final ModelMap theModel) { public String actionResource(final ResourceRequest theRequest, final BindingResult theBindingResult, final ModelMap theModel) {
Conformance conformance = addCommonParams(theRequest, theModel); IResource conformance = addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
String resourceName = theRequest.getResource(); String resourceName = theRequest.getResource();
RuntimeResourceDefinition def = myCtx.getResourceDefinition(theRequest.getResource()); RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(theRequest.getResource());
TreeSet<String> includes = new TreeSet<String>(); TreeSet<String> includes = new TreeSet<String>();
TreeSet<String> sortParams = new TreeSet<String>(); TreeSet<String> sortParams = new TreeSet<String>();
List<RestQuery> queries = new ArrayList<Conformance.RestQuery>(); List<RestQuery> queries = new ArrayList<Conformance.RestQuery>();
boolean haveSearchParams = false; boolean haveSearchParams = false;
List<List<String>> queryIncludes = new ArrayList<List<String>>(); List<List<String>> queryIncludes = new ArrayList<List<String>>();
switch (theRequest.getFhirVersion(myConfig)) {
case DEV:
haveSearchParams = extractSearchParamsDev(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
break;
case DSTU1:
haveSearchParams = extractSearchParamsDstu1(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
break;
default:
throw new IllegalStateException("Unknown FHIR version: "+theRequest.getFhirVersion(myConfig));
}
theModel.put("includes", includes);
theModel.put("queries", queries);
theModel.put("haveSearchParams", haveSearchParams);
theModel.put("queryIncludes", queryIncludes);
theModel.put("sortParams", sortParams);
if (isNotBlank(theRequest.getUpdateId())) {
String updateId = theRequest.getUpdateId();
String updateVid = defaultIfEmpty(theRequest.getUpdateVid(), null);
IResource updateResource = (IResource) client.read(def.getImplementingClass(), new IdDt(resourceName, updateId, updateVid));
String updateResourceString = theRequest.newParser(getContext(theRequest)).setPrettyPrint(true).encodeResourceToString(updateResource);
theModel.put("updateResource", updateResourceString);
theModel.put("updateResourceId", updateId);
}
ourLog.info(logPrefix(theModel) + "Showing resource page: {}", resourceName);
return "resource";
}
private boolean extractSearchParamsDstu1(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams, List<List<String>> queryIncludes) {
Conformance conformance = (Conformance) theConformance;
for (Rest nextRest : conformance.getRest()) { for (Rest nextRest : conformance.getRest()) {
for (RestResource nextRes : nextRest.getResource()) { for (RestResource nextRes : nextRest.getResource()) {
if (nextRes.getType().getValue().equals(resourceName)) { if (nextRes.getType().getValue().equals(resourceName)) {
@ -376,90 +411,31 @@ public class Controller {
} }
} }
} }
theModel.put("includes", includes); return haveSearchParams;
theModel.put("queries", queries);
theModel.put("haveSearchParams", haveSearchParams);
theModel.put("queryIncludes", queryIncludes);
theModel.put("sortParams", sortParams);
if (isNotBlank(theRequest.getUpdateId())) {
String updateId = theRequest.getUpdateId();
String updateVid = defaultIfEmpty(theRequest.getUpdateVid(), null);
IResource updateResource = (IResource) client.read(def.getImplementingClass(), new IdDt(resourceName, updateId, updateVid));
String updateResourceString = theRequest.newParser(myCtx).setPrettyPrint(true).encodeResourceToString(updateResource);
theModel.put("updateResource", updateResourceString);
theModel.put("updateResourceId", updateId);
}
ourLog.info(logPrefix(theModel) + "Showing resource page: {}", resourceName);
return "resource";
} }
public static class CaptureInterceptor implements IClientInterceptor { private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams, List<List<String>> queryIncludes) {
ca.uhn.fhir.model.dev.resource.Conformance conformance = (ca.uhn.fhir.model.dev.resource.Conformance)theConformance;
private HttpRequestBase myLastRequest; for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) {
private HttpResponse myLastResponse; for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextRes : nextRest.getResource()) {
private String myResponseBody; if (nextRes.getTypeElement().getValue().equals(resourceName)) {
for (StringDt next : nextRes.getSearchInclude()) {
@Override if (next.isEmpty() == false) {
public void interceptRequest(HttpRequestBase theRequest) { includes.add(next.getValue());
assert myLastRequest == null; }
myLastRequest = theRequest; }
} for (ca.uhn.fhir.model.dev.resource.Conformance.RestResourceSearchParam next : nextRes.getSearchParam()) {
if (next.getTypeElement().getValueAsEnum() != ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum.COMPOSITE) {
@Override sortParams.add(next.getNameElement().getValue());
public void interceptResponse(HttpResponse theResponse) throws IOException { }
assert myLastResponse == null; }
myLastResponse = theResponse; if (nextRes.getSearchParam().size() > 0) {
haveSearchParams = true;
HttpEntity respEntity = theResponse.getEntity(); }
if (respEntity != null) {
final byte[] bytes;
try {
bytes = IOUtils.toByteArray(respEntity.getContent());
} catch (IllegalStateException e) {
throw new InternalErrorException(e);
} }
myResponseBody = new String(bytes, "UTF-8");
theResponse.setEntity(new MyEntityWrapper(respEntity, bytes));
} }
} }
return haveSearchParams;
public HttpRequestBase getLastRequest() {
return myLastRequest;
}
public HttpResponse getLastResponse() {
return myLastResponse;
}
private static class MyEntityWrapper extends HttpEntityWrapper {
private byte[] myBytes;
public MyEntityWrapper(HttpEntity theWrappedEntity, byte[] theBytes) {
super(theWrappedEntity);
myBytes = theBytes;
}
@Override
public InputStream getContent() throws IOException {
return new ByteArrayInputStream(myBytes);
}
@Override
public void writeTo(OutputStream theOutstream) throws IOException {
theOutstream.write(myBytes);
}
}
public String getLastResponseBody() {
return myResponseBody;
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -474,13 +450,13 @@ public class Controller {
clientCodeJsonWriter.write("base", (String) theModel.get("base")); clientCodeJsonWriter.write("base", (String) theModel.get("base"));
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
IUntypedQuery search = client.search(); IUntypedQuery search = client.search();
IQuery query; IQuery query;
if (isNotBlank(theReq.getParameter("resource"))) { if (isNotBlank(theReq.getParameter("resource"))) {
try { try {
query = search.forResource((Class<? extends IResource>)getResourceType(theReq).getImplementingClass()); query = search.forResource((Class<? extends IResource>)getResourceType(theRequest, theReq).getImplementingClass());
} catch (ServletException e) { } catch (ServletException e) {
theModel.put("errorMsg", e.toString()); theModel.put("errorMsg", e.toString());
return "resource"; return "resource";
@ -555,7 +531,7 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
clientCodeJsonWriter.writeEnd(); clientCodeJsonWriter.writeEnd();
clientCodeJsonWriter.close(); clientCodeJsonWriter.close();
@ -570,16 +546,16 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
String body = preProcessMessageBody(theRequest.getTransactionBody()); String body = preProcessMessageBody(theRequest.getTransactionBody());
Bundle bundle; Bundle bundle;
try { try {
if (body.startsWith("{")) { if (body.startsWith("{")) {
bundle = myCtx.newJsonParser().parseBundle(body); bundle = getContext(theRequest).newJsonParser().parseBundle(body);
} else if (body.startsWith("<")) { } else if (body.startsWith("<")) {
bundle = myCtx.newXmlParser().parseBundle(body); bundle = getContext(theRequest).newXmlParser().parseBundle(body);
} else { } else {
theModel.put("errorMsg", "Message body does not appear to be a valid FHIR resource instance document. Body should start with '<' (for XML encoding) or '{' (for JSON encoding)."); theModel.put("errorMsg", "Message body does not appear to be a valid FHIR resource instance document. Body should start with '<' (for XML encoding) or '{' (for JSON encoding).");
return "home"; return "home";
@ -600,7 +576,7 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, "Transaction", interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, "Transaction", interceptor, theRequest);
return "result"; return "result";
} }
@ -617,7 +593,7 @@ public class Controller {
return "result"; return "result";
} }
private Conformance addCommonParams(final HomeRequest theRequest, final ModelMap theModel) { private IResource addCommonParams(final HomeRequest theRequest, final ModelMap theModel) {
if (myConfig.getDebugTemplatesMode()) { if (myConfig.getDebugTemplatesMode()) {
myTemplateEngine.getCacheManager().clearAllCaches(); myTemplateEngine.getCacheManager().clearAllCaches();
} }
@ -655,11 +631,11 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
Class<? extends IResource> type = null; // def.getImplementingClass(); Class<? extends IResource> type = null; // def.getImplementingClass();
if ("history-type".equals(theMethod)) { if ("history-type".equals(theMethod)) {
RuntimeResourceDefinition def = myCtx.getResourceDefinition(theRequest.getResource()); RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(theRequest.getResource());
type = (Class<? extends IResource>) def.getImplementingClass(); type = (Class<? extends IResource>) def.getImplementingClass();
} }
@ -674,9 +650,9 @@ public class Controller {
IResource resource; IResource resource;
try { try {
if (body.startsWith("{")) { if (body.startsWith("{")) {
resource = myCtx.newJsonParser().parseResource(type, body); resource = getContext(theRequest).newJsonParser().parseResource(type, body);
} else if (body.startsWith("<")) { } else if (body.startsWith("<")) {
resource = myCtx.newXmlParser().parseResource(type, body); resource = getContext(theRequest).newXmlParser().parseResource(type, body);
} else { } else {
theModel.put("errorMsg", "Message body does not appear to be a valid FHIR resource instance document. Body should start with '<' (for XML encoding) or '{' (for JSON encoding)."); theModel.put("errorMsg", "Message body does not appear to be a valid FHIR resource instance document. Body should start with '<' (for XML encoding) or '{' (for JSON encoding).");
return; return;
@ -717,15 +693,15 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, outcomeDescription, interceptor, theRequest);
try { try {
if (validate) { if (validate) {
ourLog.info(logPrefix(theModel) + "Validated resource of type " + getResourceType(theReq).getName()); ourLog.info(logPrefix(theModel) + "Validated resource of type " + getResourceType(theRequest, theReq).getName());
} else if (update) { } else if (update) {
ourLog.info(logPrefix(theModel) + "Updated resource of type " + getResourceType(theReq).getName()); ourLog.info(logPrefix(theModel) + "Updated resource of type " + getResourceType(theRequest, theReq).getName());
} else { } else {
ourLog.info(logPrefix(theModel) + "Created resource of type " + getResourceType(theReq).getName()); ourLog.info(logPrefix(theModel) + "Created resource of type " + getResourceType(theRequest, theReq).getName());
} }
} catch (Exception e) { } catch (Exception e) {
ourLog.warn("Failed to determine resource type from request", e); ourLog.warn("Failed to determine resource type from request", e);
@ -737,12 +713,12 @@ public class Controller {
addCommonParams(theRequest, theModel); addCommonParams(theRequest, theModel);
CaptureInterceptor interceptor = new CaptureInterceptor(); CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(myCtx, myConfig, interceptor); GenericClient client = theRequest.newClient(getContext(theRequest), myConfig, interceptor);
String id = null; String id = null;
Class<? extends IResource> type = null; // def.getImplementingClass(); Class<? extends IResource> type = null; // def.getImplementingClass();
if ("history-type".equals(theMethod)) { if ("history-type".equals(theMethod)) {
RuntimeResourceDefinition def = myCtx.getResourceDefinition(theRequest.getResource()); RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(theRequest.getResource());
type = (Class<? extends IResource>) def.getImplementingClass(); type = (Class<? extends IResource>) def.getImplementingClass();
id = StringUtils.defaultString(theReq.getParameter("resource-history-id")); id = StringUtils.defaultString(theReq.getParameter("resource-history-id"));
} }
@ -770,7 +746,7 @@ public class Controller {
} }
long delay = System.currentTimeMillis() - start; long delay = System.currentTimeMillis() - start;
processAndAddLastClientInvocation(client, returnsResource, theModel, delay, theMethodDescription, interceptor); processAndAddLastClientInvocation(client, returnsResource, theModel, delay, theMethodDescription, interceptor, theRequest);
} }
@ -934,9 +910,19 @@ public class Controller {
return b.toString(); return b.toString();
} }
private RuntimeResourceDefinition getResourceType(HttpServletRequest theReq) throws ServletException { private FhirContext getContext(HomeRequest theRequest) {
FhirVersionEnum version = theRequest.getFhirVersion(myConfig);
FhirContext retVal = myContexts.get(version);
if (retVal==null) {
retVal = new FhirContext(version);
myContexts.put(version, retVal);
}
return retVal;
}
private RuntimeResourceDefinition getResourceType(HomeRequest theRequest, HttpServletRequest theReq) throws ServletException {
String resourceName = StringUtils.defaultString(theReq.getParameter(PARAM_RESOURCE)); String resourceName = StringUtils.defaultString(theReq.getParameter(PARAM_RESOURCE));
RuntimeResourceDefinition def = myCtx.getResourceDefinition(resourceName); RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(resourceName);
if (def == null) { if (def == null) {
throw new ServletException("Invalid resourceName: " + resourceName); throw new ServletException("Invalid resourceName: " + resourceName);
} }
@ -1017,8 +1003,18 @@ public class Controller {
return true; return true;
} }
private Conformance loadAndAddConf(final HomeRequest theRequest, final ModelMap theModel) { private IResource loadAndAddConf(final HomeRequest theRequest, final ModelMap theModel) {
IGenericClient client = myCtx.newRestfulGenericClient(theRequest.getServerBase(myConfig)); switch (theRequest.getFhirVersion(myConfig)) {
case DEV:
return loadAndAddConfDev(theRequest, theModel);
case DSTU1:
return loadAndAddConfDstu1(theRequest, theModel);
}
throw new IllegalStateException("Unknown version: "+theRequest.getFhirVersion(myConfig));
}
private Conformance loadAndAddConfDstu1(final HomeRequest theRequest, final ModelMap theModel) {
IGenericClient client = getContext(theRequest).newRestfulGenericClient(theRequest.getServerBase(myConfig));
Conformance conformance; Conformance conformance;
try { try {
@ -1029,7 +1025,7 @@ public class Controller {
conformance = new Conformance(); conformance = new Conformance();
} }
theModel.put("jsonEncodedConf", myCtx.newJsonParser().encodeResourceToString(conformance)); theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(conformance));
Map<String, Number> resourceCounts = new HashMap<String, Number>(); Map<String, Number> resourceCounts = new HashMap<String, Number>();
long total = 0; long total = 0;
@ -1076,13 +1072,72 @@ public class Controller {
return conformance; return conformance;
} }
private IResource loadAndAddConfDev(final HomeRequest theRequest, final ModelMap theModel) {
IGenericClient client = getContext(theRequest).newRestfulGenericClient(theRequest.getServerBase(myConfig));
ca.uhn.fhir.model.dev.resource.Conformance conformance;
try {
conformance = (ca.uhn.fhir.model.dev.resource.Conformance)client.conformance();
} catch (Exception e) {
ourLog.warn("Failed to load conformance statement", e);
theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString());
conformance = new ca.uhn.fhir.model.dev.resource.Conformance();
}
theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(conformance));
Map<String, Number> resourceCounts = new HashMap<String, Number>();
long total = 0;
for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) {
for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextResource : nextRest.getResource()) {
List<ExtensionDt> exts = nextResource.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL);
if (exts != null && exts.size() > 0) {
Number nextCount = ((DecimalDt) (exts.get(0).getValue())).getValueAsNumber();
resourceCounts.put(nextResource.getTypeElement().getValue(), nextCount);
total += nextCount.longValue();
}
}
}
theModel.put("resourceCounts", resourceCounts);
if (total > 0) {
for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) {
Collections.sort(nextRest.getResource(), new Comparator<ca.uhn.fhir.model.dev.resource.Conformance.RestResource>() {
@Override
public int compare(ca.uhn.fhir.model.dev.resource.Conformance.RestResource theO1, ca.uhn.fhir.model.dev.resource.Conformance.RestResource theO2) {
DecimalDt count1 = new DecimalDt();
List<ExtensionDt> count1exts = theO1.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL);
if (count1exts != null && count1exts.size() > 0) {
count1 = (DecimalDt) count1exts.get(0).getValue();
}
DecimalDt count2 = new DecimalDt();
List<ExtensionDt> count2exts = theO2.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL);
if (count2exts != null && count2exts.size() > 0) {
count2 = (DecimalDt) count2exts.get(0).getValue();
}
int retVal = count2.compareTo(count1);
if (retVal == 0) {
retVal = theO1.getTypeElement().getValue().compareTo(theO2.getTypeElement().getValue());
}
return retVal;
}
});
}
}
theModel.put("conf", conformance);
theModel.put("requiredParamExtension", ExtensionConstants.PARAM_IS_REQUIRED);
return conformance;
}
private String logPrefix(ModelMap theModel) { private String logPrefix(ModelMap theModel) {
return "[server=" + theModel.get("serverId") + "] - "; return "[server=" + theModel.get("serverId") + "] - ";
} }
private String parseNarrative(EncodingEnum theCtEnum, String theResultBody) { private String parseNarrative(HomeRequest theRequest, EncodingEnum theCtEnum, String theResultBody) {
try { try {
IResource resource = theCtEnum.newParser(myCtx).parseResource(theResultBody); IResource resource = theCtEnum.newParser(getContext(theRequest)).parseResource(theResultBody);
String retVal = resource.getText().getDiv().getValueAsString(); String retVal = resource.getText().getDiv().getValueAsString();
return StringUtils.defaultString(retVal); return StringUtils.defaultString(retVal);
} catch (Exception e) { } catch (Exception e) {
@ -1120,7 +1175,7 @@ public class Controller {
} }
private void processAndAddLastClientInvocation(GenericClient theClient, ResultType theResultType, ModelMap theModelMap, long theLatency, String outcomeDescription, private void processAndAddLastClientInvocation(GenericClient theClient, ResultType theResultType, ModelMap theModelMap, long theLatency, String outcomeDescription,
CaptureInterceptor theInterceptor) { CaptureInterceptor theInterceptor, HomeRequest theRequest) {
try { try {
HttpRequestBase lastRequest = theInterceptor.getLastRequest(); HttpRequestBase lastRequest = theInterceptor.getLastRequest();
HttpResponse lastResponse = theInterceptor.getLastResponse(); HttpResponse lastResponse = theInterceptor.getLastResponse();
@ -1151,21 +1206,21 @@ public class Controller {
switch (ctEnum) { switch (ctEnum) {
case JSON: case JSON:
if (theResultType == ResultType.RESOURCE) { if (theResultType == ResultType.RESOURCE) {
narrativeString = parseNarrative(ctEnum, resultBody); narrativeString = parseNarrative(theRequest, ctEnum, resultBody);
resultDescription.append("JSON resource"); resultDescription.append("JSON resource");
} else if (theResultType == ResultType.BUNDLE) { } else if (theResultType == ResultType.BUNDLE) {
resultDescription.append("JSON bundle"); resultDescription.append("JSON bundle");
bundle = myCtx.newJsonParser().parseBundle(resultBody); bundle = getContext(theRequest).newJsonParser().parseBundle(resultBody);
} }
break; break;
case XML: case XML:
default: default:
if (theResultType == ResultType.RESOURCE) { if (theResultType == ResultType.RESOURCE) {
narrativeString = parseNarrative(ctEnum, resultBody); narrativeString = parseNarrative(theRequest, ctEnum, resultBody);
resultDescription.append("XML resource"); resultDescription.append("XML resource");
} else if (theResultType == ResultType.BUNDLE) { } else if (theResultType == ResultType.BUNDLE) {
resultDescription.append("XML bundle"); resultDescription.append("XML bundle");
bundle = myCtx.newXmlParser().parseBundle(resultBody); bundle = getContext(theRequest).newXmlParser().parseBundle(resultBody);
} }
break; break;
} }
@ -1204,6 +1259,72 @@ public class Controller {
} }
public static class CaptureInterceptor implements IClientInterceptor {
private HttpRequestBase myLastRequest;
private HttpResponse myLastResponse;
private String myResponseBody;
public HttpRequestBase getLastRequest() {
return myLastRequest;
}
public HttpResponse getLastResponse() {
return myLastResponse;
}
public String getLastResponseBody() {
return myResponseBody;
}
@Override
public void interceptRequest(HttpRequestBase theRequest) {
assert myLastRequest == null;
myLastRequest = theRequest;
}
@Override
public void interceptResponse(HttpResponse theResponse) throws IOException {
assert myLastResponse == null;
myLastResponse = theResponse;
HttpEntity respEntity = theResponse.getEntity();
if (respEntity != null) {
final byte[] bytes;
try {
bytes = IOUtils.toByteArray(respEntity.getContent());
} catch (IllegalStateException e) {
throw new InternalErrorException(e);
}
myResponseBody = new String(bytes, "UTF-8");
theResponse.setEntity(new MyEntityWrapper(respEntity, bytes));
}
}
private static class MyEntityWrapper extends HttpEntityWrapper {
private byte[] myBytes;
public MyEntityWrapper(HttpEntity theWrappedEntity, byte[] theBytes) {
super(theWrappedEntity);
myBytes = theBytes;
}
@Override
public InputStream getContent() throws IOException {
return new ByteArrayInputStream(myBytes);
}
@Override
public void writeTo(OutputStream theOutstream) throws IOException {
theOutstream.write(myBytes);
}
}
}
private enum ResultType { private enum ResultType {
BUNDLE, NONE, RESOURCE, TAGLIST BUNDLE, NONE, RESOURCE, TAGLIST
} }

View File

@ -8,22 +8,32 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.springframework.beans.factory.annotation.Required; import org.springframework.beans.factory.annotation.Required;
import ca.uhn.fhir.context.FhirVersionEnum;
public class TesterConfig { public class TesterConfig {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TesterConfig.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TesterConfig.class);
public static final String SYSPROP_FORCE_SERVERS = "ca.uhn.fhir.to.TesterConfig_SYSPROP_FORCE_SERVERS"; public static final String SYSPROP_FORCE_SERVERS = "ca.uhn.fhir.to.TesterConfig_SYSPROP_FORCE_SERVERS";
private LinkedHashMap<String, String> myIdToServerName = new LinkedHashMap<String, String>(); private LinkedHashMap<String, String> myIdToServerName = new LinkedHashMap<String, String>();
private LinkedHashMap<String, FhirVersionEnum> myIdToFhirVersion = new LinkedHashMap<String, FhirVersionEnum>();
public LinkedHashMap<String, String> getIdToServerName() { private LinkedHashMap<String, String> myIdToServerBase = new LinkedHashMap<String, String>();
return myIdToServerName;
public boolean getDebugTemplatesMode() {
return true;
}
public LinkedHashMap<String, FhirVersionEnum> getIdToFhirVersion() {
return myIdToFhirVersion;
} }
public LinkedHashMap<String, String> getIdToServerBase() { public LinkedHashMap<String, String> getIdToServerBase() {
return myIdToServerBase; return myIdToServerBase;
} }
private LinkedHashMap<String, String> myIdToServerBase = new LinkedHashMap<String, String>(); public LinkedHashMap<String, String> getIdToServerName() {
return myIdToServerName;
}
@Required @Required
public void setServers(List<String> theServers) { public void setServers(List<String> theServers) {
@ -35,20 +45,26 @@ public class TesterConfig {
ourLog.warn("Forcing server confirguration because of system property: {}", force); ourLog.warn("Forcing server confirguration because of system property: {}", force);
servers = Collections.singletonList(force); servers = Collections.singletonList(force);
} }
for (String nextRaw : servers) { for (String nextRaw : servers) {
String[] nextSplit = nextRaw.split(","); String[] nextSplit = nextRaw.split(",");
Validate.notBlank(nextSplit[0], "theId can not be blank"); if (nextSplit.length == 3) {
Validate.notBlank(nextSplit[1], "theDisplayName can not be blank"); Validate.notBlank(nextSplit[0], "theId can not be blank");
Validate.notBlank(nextSplit[2], "theServerBase can not be blank"); Validate.notBlank(nextSplit[1], "theDisplayName can not be blank");
myIdToServerName.put(nextSplit[0].trim(), nextSplit[1].trim()); Validate.notBlank(nextSplit[2], "theServerBase can not be blank");
myIdToServerBase.put(nextSplit[0].trim(), nextSplit[2].trim()); myIdToServerName.put(nextSplit[0].trim(), nextSplit[1].trim());
myIdToServerBase.put(nextSplit[0].trim(), nextSplit[2].trim());
myIdToFhirVersion.put(nextSplit[0].trim(), FhirVersionEnum.DSTU1);
} else {
Validate.notBlank(nextSplit[0], "theId can not be blank");
Validate.notBlank(nextSplit[1], "theVersion can not be blank");
Validate.notBlank(nextSplit[2], "theDisplayName can not be blank");
Validate.notBlank(nextSplit[3], "theServerBase can not be blank");
myIdToServerName.put(nextSplit[0].trim(), nextSplit[2].trim());
myIdToServerBase.put(nextSplit[0].trim(), nextSplit[3].trim());
myIdToFhirVersion.put(nextSplit[0].trim(), FhirVersionEnum.valueOf(nextSplit[1].trim().toUpperCase()));
}
} }
} }
public boolean getDebugTemplatesMode() {
return true;
}
} }

View File

@ -8,6 +8,7 @@ import org.apache.http.client.methods.HttpRequestBase;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.client.GenericClient; import ca.uhn.fhir.rest.client.GenericClient;
import ca.uhn.fhir.rest.client.IClientInterceptor; import ca.uhn.fhir.rest.client.IClientInterceptor;
@ -58,6 +59,14 @@ public class HomeRequest {
return retVal; return retVal;
} }
public FhirVersionEnum getFhirVersion(TesterConfig theConfig) {
if (isBlank(myServerId) && !theConfig.getIdToFhirVersion().containsKey(myServerId)) {
return theConfig.getIdToFhirVersion().entrySet().iterator().next().getValue();
} else {
return theConfig.getIdToFhirVersion().get(myServerId);
}
}
public String getServerName(TesterConfig theConfig) { public String getServerName(TesterConfig theConfig) {
if (isBlank(myServerId) && !theConfig.getIdToServerName().containsKey(myServerId)) { if (isBlank(myServerId) && !theConfig.getIdToServerName().containsKey(myServerId)) {
return theConfig.getIdToServerName().entrySet().iterator().next().getValue(); return theConfig.getIdToServerName().entrySet().iterator().next().getValue();

View File

@ -11,13 +11,13 @@
<bean class="ca.uhn.fhir.to.TesterConfig"> <bean class="ca.uhn.fhir.to.TesterConfig">
<property name="servers"> <property name="servers">
<list> <list>
<!-- <value>test, TEST, http://uhnvesb01d.uhn.on.ca:25180/uhn-fhir-service-1.2/</value> --> <value>home , DSTU1 , Localhost Server DSTU1 , http://localhost:8887/fhir/contextDstu1</value>
<value>home , Localhost Server , http://localhost:8887/fhir/context </value> <value>home_dev , DEV , Localhost Server DEV , http://localhost:8887/fhir/contextDev</value>
<value>hi , Health Intersections , http://fhir.healthintersections.com.au/open</value> <value>hi , DSTU1 , Health Intersections , http://fhir.healthintersections.com.au/open</value>
<value>furore , Spark - Furore Reference Server , http://spark.furore.com/fhir</value> <value>furore , DSTU1 , Spark - Furore Reference Server , http://spark.furore.com/fhir</value>
<value>blaze , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value> <value>blaze , DSTU1 , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value>
<value>oridashi , Oridashi , http://demo.oridashi.com.au:8190</value> <value>oridashi , DSTU1 , Oridashi , http://demo.oridashi.com.au:8190</value>
<value>fhirbase , FHIRPlace (Health Samurai) , http://try-fhirplace.hospital-systems.com/ </value> <value>fhirbase , DSTU1 , FHIRPlace (Health Samurai) , http://try-fhirplace.hospital-systems.com/ </value>
</list> </list>
</property> </property>
</bean> </bean>

View File

@ -89,10 +89,10 @@
<ul class="nav nav-sidebar"> <ul class="nav nav-sidebar">
<th:block <th:block
th:each="resource, resIterStat : ${conf.restFirstRep.resource}"> th:each="resource, resIterStat : ${conf.restFirstRep.resource}">
<li th:class="${resourceName} == ${resource.type.valueAsString} ? 'active' : ''"> <li th:class="${resourceName} == ${resource.typeElement.valueAsString} ? 'active' : ''">
<a href="#" th:onclick="'doAction(this, \'resource\', \'' + ${resource.type.valueAsString} + '\');'"> <a href="#" th:onclick="'doAction(this, \'resource\', \'' + ${resource.typeElement.valueAsString} + '\');'">
<th:block th:text="${resource.type.valueAsString}" >Patient</th:block> <th:block th:text="${resource.typeElement.valueAsString}" >Patient</th:block>
<span class="badge" th:if="${resourceCounts[resource.type.valueAsString]} != null" th:text="${resourceCounts[resource.type.valueAsString]}"/> <span class="badge" th:if="${resourceCounts[resource.typeElement.valueAsString]} != null" th:text="${resourceCounts[resource.typeElement.valueAsString]}"/>
</a> </a>
</li> </li>
</th:block> </th:block>

View File

@ -10,10 +10,15 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.JpaConformanceProvider; import ca.uhn.fhir.jpa.provider.JpaConformanceProvider;
import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.provider.JpaSystemProvider;
import ca.uhn.fhir.jpa.rp.dev.DiagnosticReportResourceProvider;
import ca.uhn.fhir.jpa.rp.dev.ObservationResourceProvider;
import ca.uhn.fhir.jpa.rp.dev.OrganizationResourceProvider;
import ca.uhn.fhir.jpa.rp.dev.PatientResourceProvider;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
@ -37,111 +42,103 @@ import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider; import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.test.jpasrv.DiagnosticReportResourceProvider;
import ca.uhn.test.jpasrv.ObservationResourceProvider;
import ca.uhn.test.jpasrv.OrganizationResourceProvider;
import ca.uhn.test.jpasrv.PatientResourceProvider;
import ca.uhn.test.jpasrv.QuestionnaireResourceProvider;
public class OverlayTestApp { public class OverlayTestApp {
private static ClassPathXmlApplicationContext ourAppCtx;
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
int myPort = 8888; {
Server server = new Server(myPort); int myPort = 8888;
Server server = new Server(myPort);
WebAppContext root = new WebAppContext();
root.setContextPath("/");
root.setDescriptor("src/main/webapp/WEB-INF/web.xml");
root.setResourceBase("src/main/webapp");
root.setParentLoaderPriority(true);
server.setHandler(root);
server.start();
WebAppContext root = new WebAppContext();
ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml");
IFhirResourceDao<Patient> patientDao = appCtx.getBean("myPatientDao", IFhirResourceDao.class);
PatientResourceProvider patientRp = new PatientResourceProvider();
patientRp.setDao(patientDao);
IFhirResourceDao<Questionnaire> questionnaireDao = appCtx.getBean("myQuestionnaireDao", IFhirResourceDao.class);
QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider();
questionnaireRp.setDao(questionnaireDao);
IFhirResourceDao<Organization> organizationDao = appCtx.getBean("myOrganizationDao", IFhirResourceDao.class); root.setContextPath("/");
OrganizationResourceProvider organizationRp = new OrganizationResourceProvider(); root.setDescriptor("src/main/webapp/WEB-INF/web.xml");
organizationRp.setDao(organizationDao); root.setResourceBase("src/main/webapp");
IFhirResourceDao<DiagnosticReport> diagnosticReportDao = appCtx.getBean("myDiagnosticReportDao", IFhirResourceDao.class); root.setParentLoaderPriority(true);
DiagnosticReportResourceProvider diagnosticReportRp = new DiagnosticReportResourceProvider();
diagnosticReportRp.setDao(diagnosticReportDao);
IFhirResourceDao<Observation> observationDao = appCtx.getBean("myObservationDao", IFhirResourceDao.class); server.setHandler(root);
ObservationResourceProvider observationRp = new ObservationResourceProvider();
observationRp.setDao(observationDao);
IFhirSystemDao systemDao = appCtx.getBean("mySystemDao", IFhirSystemDao.class);
JpaSystemProvider systemProvider = new JpaSystemProvider(systemDao);
RestfulServer restServer = new RestfulServer(); server.start();
IResourceProvider rp = diagnosticReportRp; }
rp = new ProviderWithRequiredAndOptional();
ourAppCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dev.xml", "hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-spring-test-config.xml");
restServer.setResourceProviders(rp,patientRp, questionnaireRp, organizationRp,observationRp);
restServer.setProviders(systemProvider);
restServer.setPagingProvider(new FifoMemoryPagingProvider(10));
restServer.setImplementationDescription("This is a great server!!!!");
JpaConformanceProvider confProvider = new JpaConformanceProvider(restServer, systemDao);
restServer.setServerConformanceProvider(confProvider);
myPort = 8887;
server = new Server(myPort);
ServletContextHandler proxyHandler = new ServletContextHandler(); ServletContextHandler proxyHandler = new ServletContextHandler();
proxyHandler.setContextPath("/"); proxyHandler.setContextPath("/");
String base = "http://localhost:" + myPort + "/fhir/context"; /*
// base = "http://fhir.healthintersections.com.au/open"; * DEV resources
// base = "http://spark.furore.com/fhir"; */
RestfulServer restServerDev = new RestfulServer();
restServerDev.setPagingProvider(new FifoMemoryPagingProvider(10));
restServerDev.setImplementationDescription("This is a great server!!!!");
restServerDev.setFhirContext(ourAppCtx.getBean("myFhirContextDev", FhirContext.class));
List<IResourceProvider> rpsDev = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDev", List.class);
restServerDev.setResourceProviders(rpsDev);
JpaSystemProvider systemProvDev = (JpaSystemProvider) ourAppCtx.getBean("mySystemProviderDev", JpaSystemProvider.class);
restServerDev.setPlainProviders(systemProvDev);
ServletHolder servletHolder = new ServletHolder(); ServletHolder servletHolder = new ServletHolder();
servletHolder.setServlet(restServer); servletHolder.setServlet(restServerDev);
proxyHandler.addServlet(servletHolder, "/fhir/context/*"); proxyHandler.addServlet(servletHolder, "/fhir/contextDev/*");
/*
* DSTU resources
*/
RestfulServer restServerDstu1 = new RestfulServer();
restServerDstu1.setPagingProvider(new FifoMemoryPagingProvider(10));
restServerDstu1.setImplementationDescription("This is a great server!!!!");
restServerDstu1.setFhirContext(ourAppCtx.getBean("myFhirContextDstu1", FhirContext.class));
List<IResourceProvider> rpsDstu1 = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDstu1", List.class);
restServerDstu1.setResourceProviders(rpsDstu1);
JpaSystemProvider systemProvDstu1 = (JpaSystemProvider) ourAppCtx.getBean("mySystemProviderDstu1", JpaSystemProvider.class);
restServerDstu1.setPlainProviders(systemProvDstu1);
servletHolder = new ServletHolder();
servletHolder.setServlet(restServerDstu1);
proxyHandler.addServlet(servletHolder, "/fhir/contextDstu1/*");
int port = 8887;
Server server = new Server(port);
// base = "http://fhir.healthintersections.com.au/open";
// base = "http://spark.furore.com/fhir";
server.setHandler(proxyHandler); server.setHandler(proxyHandler);
server.start(); server.start();
if (true) { if (true) {
IGenericClient client = restServer.getFhirContext().newRestfulGenericClient(base); String base = "http://localhost:" + port + "/fhir/contextDstu1";
IGenericClient client = restServerDstu1.getFhirContext().newRestfulGenericClient(base);
client.setLogRequestAndResponse(true); client.setLogRequestAndResponse(true);
Organization o1 = new Organization(); Organization o1 = new Organization();
o1.getName().setValue("Some Org"); o1.getName().setValue("Some Org");
MethodOutcome create = client.create(o1); MethodOutcome create = client.create(o1);
IdDt orgId = create.getId(); IdDt orgId = create.getId();
Patient p1 = new Patient(); Patient p1 = new Patient();
p1.addIdentifier("foo:bar", "12345"); p1.addIdentifier("foo:bar", "12345");
p1.addName().addFamily("Smith").addGiven("John"); p1.addName().addFamily("Smith").addGiven("John");
p1.getManagingOrganization().setReference(orgId); p1.getManagingOrganization().setReference(orgId);
TagList list = new TagList(); TagList list = new TagList();
list.addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource"); list.addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource");
ResourceMetadataKeyEnum.TAG_LIST.put(p1, list); ResourceMetadataKeyEnum.TAG_LIST.put(p1, list);
client.create(p1); client.create(p1);
List<IResource> resources = restServer.getFhirContext().newJsonParser().parseBundle(IOUtils.toString(OverlayTestApp.class.getResourceAsStream("/test-server-seed-bundle.json"))).toListOfResources(); List<IResource> resources = restServerDstu1.getFhirContext().newJsonParser().parseBundle(IOUtils.toString(OverlayTestApp.class.getResourceAsStream("/test-server-seed-bundle.json"))).toListOfResources();
client.transaction(resources); client.transaction(resources);
client.create(p1); client.create(p1);
client.create(p1); client.create(p1);
client.create(p1); client.create(p1);
@ -156,38 +153,27 @@ public class OverlayTestApp {
client.create(p1); client.create(p1);
client.create(p1); client.create(p1);
client.create(p1); client.create(p1);
client.setLogRequestAndResponse(true); client.setLogRequestAndResponse(true);
client.create(p1); client.create(p1);
} }
} }
public static class ProviderWithRequiredAndOptional implements IResourceProvider { public static class ProviderWithRequiredAndOptional implements IResourceProvider {
@Description(shortDefinition="This is a query by date!") @Description(shortDefinition = "This is a query by date!")
@Search @Search
public List<DiagnosticReport> findDiagnosticReportsByPatient ( public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@RequiredParam(name=DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
@OptionalParam(name=DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@OptionalParam(name=DiagnosticReport.SP_DATE) DateRangeParam theDateRange,
@IncludeParam(allow= {"DiagnosticReport.result"}) Set<Include> theIncludes
) throws Exception {
return null; return null;
} }
@Description(shortDefinition="This is a query by issued.. blah blah foo bar blah blah") @Description(shortDefinition = "This is a query by issued.. blah blah foo bar blah blah")
@Search @Search
public List<DiagnosticReport> findDiagnosticReportsByPatientIssued ( public List<DiagnosticReport> findDiagnosticReportsByPatientIssued(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@RequiredParam(name=DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
@OptionalParam(name=DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@OptionalParam(name=DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange,
@IncludeParam(allow= {"DiagnosticReport.result"}) Set<Include> theIncludes
) throws Exception {
return null; return null;
} }
@ -196,8 +182,6 @@ public class OverlayTestApp {
return DiagnosticReport.class; return DiagnosticReport.class;
} }
} }
} }

View File

@ -1,224 +0,0 @@
package ca.uhn.fhir.jpa.test;
import java.util.List;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.JpaConformanceProvider;
import ca.uhn.fhir.jpa.provider.JpaSystemProvider;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
import ca.uhn.fhir.model.dstu.resource.Organization;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.annotation.IncludeParam;
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.api.MethodOutcome;
import ca.uhn.fhir.rest.client.IGenericClient;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.test.jpasrv.DiagnosticReportResourceProvider;
import ca.uhn.test.jpasrv.OrganizationResourceProvider;
import ca.uhn.test.jpasrv.PatientResourceProvider;
import ca.uhn.test.jpasrv.QuestionnaireResourceProvider;
//import com.gargoylesoftware.htmlunit.BrowserVersion;
//import com.gargoylesoftware.htmlunit.WebClient;
//import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class WebUiTest_ {
private static ClassPathXmlApplicationContext appCtx;
// @Test
public void homePage() throws Exception {
// final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24);
// final HtmlPage page = webClient.getPage("http://localhost:8888/");
// Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
//
// final String pageAsXml = page.asXml();
// Assert.assertTrue(pageAsXml.contains("<body class=\"composite\">"));
//
// final String pageAsText = page.asText();
// Assert.assertTrue(pageAsText.contains("Support for the HTTP and HTTPS protocols"));
//
// webClient.closeAllWindows();
}
@SuppressWarnings("unchecked")
@BeforeClass
public static void beforeClass() throws Exception {
int myPort = 8888;
Server server = new Server(myPort);
WebAppContext root = new WebAppContext();
root.setContextPath("/");
root.setDescriptor("src/main/webapp/WEB-INF/web.xml");
root.setResourceBase("src/main/webapp");
root.setParentLoaderPriority(true);
server.setHandler(root);
server.start();
appCtx = new ClassPathXmlApplicationContext("fhir-spring-test-config.xml");
IFhirResourceDao<Patient> patientDao = appCtx.getBean("myPatientDao", IFhirResourceDao.class);
PatientResourceProvider patientRp = new PatientResourceProvider();
patientRp.setDao(patientDao);
IFhirResourceDao<Questionnaire> questionnaireDao = appCtx.getBean("myQuestionnaireDao", IFhirResourceDao.class);
QuestionnaireResourceProvider questionnaireRp = new QuestionnaireResourceProvider();
questionnaireRp.setDao(questionnaireDao);
IFhirResourceDao<Organization> organizationDao = appCtx.getBean("myOrganizationDao", IFhirResourceDao.class);
OrganizationResourceProvider organizationRp = new OrganizationResourceProvider();
organizationRp.setDao(organizationDao);
IFhirResourceDao<DiagnosticReport> diagnosticReportDao = appCtx.getBean("myDiagnosticReportDao", IFhirResourceDao.class);
DiagnosticReportResourceProvider diagnosticReportRp = new DiagnosticReportResourceProvider();
diagnosticReportRp.setDao(diagnosticReportDao);
IFhirSystemDao systemDao = appCtx.getBean("mySystemDao", IFhirSystemDao.class);
JpaSystemProvider systemProvider = new JpaSystemProvider(systemDao);
RestfulServer restServer = new RestfulServer();
IResourceProvider rp = diagnosticReportRp;
rp = new ProviderWithRequiredAndOptional();
restServer.setResourceProviders(rp,patientRp, questionnaireRp, organizationRp);
restServer.setProviders(systemProvider);
restServer.setPagingProvider(new FifoMemoryPagingProvider(10));
restServer.setImplementationDescription("This is a great server!!!!");
JpaConformanceProvider confProvider = new JpaConformanceProvider(restServer, systemDao);
restServer.setServerConformanceProvider(confProvider);
myPort = 8887;
server = new Server(myPort);
ServletContextHandler proxyHandler = new ServletContextHandler();
proxyHandler.setContextPath("/");
String base = "http://localhost:" + myPort + "/fhir/context";
// base = "http://fhir.healthintersections.com.au/open";
// base = "http://spark.furore.com/fhir";
ServletHolder servletHolder = new ServletHolder();
servletHolder.setServlet(restServer);
proxyHandler.addServlet(servletHolder, "/fhir/context/*");
server.setHandler(proxyHandler);
server.start();
if (true) {
IGenericClient client = restServer.getFhirContext().newRestfulGenericClient(base);
client.setLogRequestAndResponse(true);
Organization o1 = new Organization();
o1.getName().setValue("Some Org");
MethodOutcome create = client.create().resource(o1).execute();
IdDt orgId = create.getId();
Patient p1 = new Patient();
p1.addIdentifier("foo:bar", "12345");
p1.addName().addFamily("Smith").addGiven("John");
p1.getManagingOrganization().setReference(orgId);
TagList list = new TagList();
list.addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource");
ResourceMetadataKeyEnum.TAG_LIST.put(p1, list);
client.create().resource(p1).execute();
List<IResource> resources = restServer.getFhirContext().newJsonParser().parseBundle(IOUtils.toString(WebUiTest_.class.getResourceAsStream("/test-server-seed-bundle.json"))).toListOfResources();
client.transaction().withResources(resources).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
client.create().resource(p1).execute();
}
}
public static class ProviderWithRequiredAndOptional implements IResourceProvider {
@Description(shortDefinition="This is a query by date!")
@Search
public List<DiagnosticReport> findDiagnosticReportsByPatient (
@RequiredParam(name=DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId,
@OptionalParam(name=DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@OptionalParam(name=DiagnosticReport.SP_DATE) DateRangeParam theDateRange,
@IncludeParam(allow= {"DiagnosticReport.result"}) Set<Include> theIncludes
) throws Exception {
return null;
}
@Description(shortDefinition="This is a query by issued.. blah blah foo bar blah blah")
@Search
public List<DiagnosticReport> findDiagnosticReportsByPatientIssued (
@RequiredParam(name=DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId,
@OptionalParam(name=DiagnosticReport.SP_NAME) TokenOrListParam theNames,
@OptionalParam(name=DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange,
@IncludeParam(allow= {"DiagnosticReport.result"}) Set<Include> theIncludes
) throws Exception {
return null;
}
@Override
public Class<? extends IResource> getResourceType() {
return DiagnosticReport.class;
}
}
}

View File

@ -16,46 +16,18 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
import java.net.URI; import java.util.List;
import java.math.BigDecimal;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.primitive.*;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.model.base.composite.*;
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dev.valueset.AddressUseEnum; import ca.uhn.fhir.model.dev.valueset.AddressUseEnum;
import ca.uhn.fhir.model.dev.valueset.AggregationModeEnum;
import ca.uhn.fhir.model.dev.valueset.BindingConformanceEnum;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.ConstraintSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.ContactPointSystemEnum;
import ca.uhn.fhir.model.dev.valueset.ContactPointUseEnum;
import ca.uhn.fhir.model.dev.valueset.DataTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EventTimingEnum;
import ca.uhn.fhir.model.dev.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.dev.valueset.NameUseEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.valueset.PropertyRepresentationEnum;
import ca.uhn.fhir.model.dev.valueset.QuantityComparatorEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.SlicingRulesEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.UnitsOfTimeEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
/** /**
* HAPI/FHIR <b>AddressDt</b> Datatype * HAPI/FHIR <b>AddressDt</b> Datatype

View File

@ -1,657 +0,0 @@
package ca.uhn.fhir.model.dev.resource;
import java.math.BigDecimal;
import java.net.URI;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.model.dev.composite.AddressDt;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dev.valueset.AdmitSourceEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCertaintyEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCriticalityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskStatusEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskTypeEnum;
import ca.uhn.fhir.model.dev.valueset.AlertStatusEnum;
import ca.uhn.fhir.model.dev.resource.AllergyIntolerance;
import ca.uhn.fhir.model.dev.valueset.AnimalSpeciesEnum;
import ca.uhn.fhir.model.dev.valueset.AnswerFormatEnum;
import ca.uhn.fhir.model.dev.resource.Appointment;
import ca.uhn.fhir.model.dev.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dev.composite.AttachmentDt;
import ca.uhn.fhir.model.dev.resource.CarePlan;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanGoalStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CausalityExpectationEnum;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.CompositionAttestationModeEnum;
import ca.uhn.fhir.model.dev.valueset.CompositionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConceptMapEquivalenceEnum;
import ca.uhn.fhir.model.dev.resource.Condition;
import ca.uhn.fhir.model.dev.valueset.ConditionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum;
import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.resource.Contract;
import ca.uhn.fhir.model.dev.valueset.ContractSubtypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTermTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.DataAbsentReasonEnum;
import ca.uhn.fhir.model.dev.resource.Device;
import ca.uhn.fhir.model.dev.resource.DiagnosticOrder;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderPriorityEnum;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.DiagnosticReport;
import ca.uhn.fhir.model.dev.valueset.DiagnosticReportStatusEnum;
import ca.uhn.fhir.model.dev.resource.DocumentManifest;
import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum;
import ca.uhn.fhir.model.dev.resource.DocumentReference;
import ca.uhn.fhir.model.dev.valueset.DocumentReferenceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.DocumentRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.ElementDefinitionDt;
import ca.uhn.fhir.model.dev.resource.Encounter;
import ca.uhn.fhir.model.dev.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterReasonCodesEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaAdditiveTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaTypeEnum;
import ca.uhn.fhir.model.dev.resource.EpisodeOfCare;
import ca.uhn.fhir.model.dev.valueset.ExcludeFoodModifierEnum;
import ca.uhn.fhir.model.dev.valueset.ExposureTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FHIRDefinedTypeEnum;
import ca.uhn.fhir.model.dev.resource.FamilyHistory;
import ca.uhn.fhir.model.dev.valueset.FilterOperatorEnum;
import ca.uhn.fhir.model.dev.valueset.FluidConsistencyTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FoodTypeEnum;
import ca.uhn.fhir.model.dev.resource.Group;
import ca.uhn.fhir.model.dev.valueset.GroupTypeEnum;
import ca.uhn.fhir.model.dev.valueset.HierarchicalRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.valueset.ImagingModalityEnum;
import ca.uhn.fhir.model.dev.resource.ImagingStudy;
import ca.uhn.fhir.model.dev.resource.Immunization;
import ca.uhn.fhir.model.dev.valueset.ImmunizationReasonCodesEnum;
import ca.uhn.fhir.model.dev.resource.ImmunizationRecommendation;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationStatusCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRouteCodesEnum;
import ca.uhn.fhir.model.dev.valueset.InstanceAvailabilityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.dev.valueset.LinkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ListModeEnum;
import ca.uhn.fhir.model.dev.resource.Location;
import ca.uhn.fhir.model.dev.valueset.LocationModeEnum;
import ca.uhn.fhir.model.dev.valueset.LocationStatusEnum;
import ca.uhn.fhir.model.dev.valueset.LocationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.dev.resource.Media;
import ca.uhn.fhir.model.dev.valueset.MediaTypeEnum;
import ca.uhn.fhir.model.dev.resource.Medication;
import ca.uhn.fhir.model.dev.resource.MedicationAdministration;
import ca.uhn.fhir.model.dev.valueset.MedicationAdministrationStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationDispense;
import ca.uhn.fhir.model.dev.valueset.MedicationDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.MedicationKindEnum;
import ca.uhn.fhir.model.dev.resource.MedicationPrescription;
import ca.uhn.fhir.model.dev.valueset.MedicationPrescriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationStatement;
import ca.uhn.fhir.model.dev.valueset.MessageEventEnum;
import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.MessageTransportEnum;
import ca.uhn.fhir.model.dev.resource.Microarray;
import ca.uhn.fhir.model.dev.valueset.ModalityEnum;
import ca.uhn.fhir.model.dev.resource.Namespace;
import ca.uhn.fhir.model.dev.valueset.NamespaceIdentifierTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NutrientModifierEnum;
import ca.uhn.fhir.model.dev.valueset.NutritionOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.Observation;
import ca.uhn.fhir.model.dev.valueset.ObservationInterpretationCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationReliabilityEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dev.resource.OperationDefinition;
import ca.uhn.fhir.model.dev.valueset.OperationKindEnum;
import ca.uhn.fhir.model.dev.resource.OperationOutcome;
import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum;
import ca.uhn.fhir.model.dev.resource.Order;
import ca.uhn.fhir.model.dev.valueset.OrderOutcomeStatusEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.valueset.OrganizationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantRequiredEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.model.dev.valueset.PatientRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.resource.Practitioner;
import ca.uhn.fhir.model.dev.valueset.PractitionerRoleEnum;
import ca.uhn.fhir.model.dev.valueset.PractitionerSpecialtyEnum;
import ca.uhn.fhir.model.dev.valueset.PriorityCodesEnum;
import ca.uhn.fhir.model.dev.resource.Procedure;
import ca.uhn.fhir.model.dev.valueset.ProcedureRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.dev.valueset.ProvenanceEntityRoleEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.QueryOutcomeEnum;
import ca.uhn.fhir.model.dev.resource.Questionnaire;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireAnswersStatusEnum;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireStatusEnum;
import ca.uhn.fhir.model.dev.composite.RangeDt;
import ca.uhn.fhir.model.dev.composite.RatioDt;
import ca.uhn.fhir.model.dev.valueset.ReactionSeverityEnum;
import ca.uhn.fhir.model.dev.resource.ReferralRequest;
import ca.uhn.fhir.model.dev.valueset.ReferralStatusEnum;
import ca.uhn.fhir.model.dev.resource.RelatedPerson;
import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ResponseTypeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum;
import ca.uhn.fhir.model.dev.composite.SampledDataDt;
import ca.uhn.fhir.model.dev.resource.Schedule;
import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventActionEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectLifecycleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectRoleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventOutcomeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventParticipantNetworkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventSourceTypeEnum;
import ca.uhn.fhir.model.dev.resource.SecurityGroup;
import ca.uhn.fhir.model.dev.resource.SequencingAnalysis;
import ca.uhn.fhir.model.dev.resource.SequencingLab;
import ca.uhn.fhir.model.dev.resource.Slot;
import ca.uhn.fhir.model.dev.valueset.SlotStatusEnum;
import ca.uhn.fhir.model.dev.resource.Specimen;
import ca.uhn.fhir.model.dev.valueset.SpecimenCollectionMethodEnum;
import ca.uhn.fhir.model.dev.valueset.SpecimenTreatmentProcedureEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.Substance;
import ca.uhn.fhir.model.dev.valueset.SubstanceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplementTypeEnum;
import ca.uhn.fhir.model.dev.resource.Supply;
import ca.uhn.fhir.model.dev.valueset.SupplyDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyItemTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.TextureModifierEnum;
import ca.uhn.fhir.model.dev.composite.TimingDt;
import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dev.valueset.ValueSetStatusEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.composite.AgeDt;
import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.MoneyDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
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.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.OidDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.TimeDt;
import ca.uhn.fhir.model.primitive.UriDt;
/**
* HAPI/FHIR <b>Alert</b> Resource
* ()
*
* <p>
* <b>Definition:</b>
* Prospective warnings of potential issues when providing care to the patient
* </p>
*
* <p>
* <b>Requirements:</b>
*
* </p>
*
* <p>
* <b>Profile Definition:</b>
* <a href="http://hl7.org/fhir/profiles/Alert">http://hl7.org/fhir/profiles/Alert</a>
* </p>
*
*/
@ResourceDef(name="Alert", profile="http://hl7.org/fhir/profiles/Alert", id="alert")
public class Alert
extends BaseResource implements IResource {
/**
* Search parameter constant for <b>subject</b>
* <p>
* Description: <b>The identity of a subject to list alerts for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Alert.subject</b><br/>
* </p>
*/
@SearchParamDefinition(name="subject", path="Alert.subject", description="The identity of a subject to list alerts for", type="reference" )
public static final String SP_SUBJECT = "subject";
/**
* <b>Fluent Client</b> search parameter constant for <b>subject</b>
* <p>
* Description: <b>The identity of a subject to list alerts for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Alert.subject</b><br/>
* </p>
*/
public static final ReferenceClientParam SUBJECT = new ReferenceClientParam(SP_SUBJECT);
/**
* Search parameter constant for <b>patient</b>
* <p>
* Description: <b>The identity of a subject to list alerts for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Alert.subject</b><br/>
* </p>
*/
@SearchParamDefinition(name="patient", path="Alert.subject", description="The identity of a subject to list alerts for", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>The identity of a subject to list alerts for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Alert.subject</b><br/>
* </p>
*/
public static final ReferenceClientParam PATIENT = new ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Alert.subject</b>".
*/
public static final Include INCLUDE_SUBJECT = new Include("Alert.subject");
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="",
formalDefinition="Identifier assigned to the alert for external use (outside the FHIR environment)"
)
private java.util.List<IdentifierDt> myIdentifier;
@Child(name="category", type=CodeableConceptDt.class, order=1, min=0, max=1)
@Description(
shortDefinition="",
formalDefinition="Allows an alert to be divided into different categories like clinical, administrative etc."
)
private CodeableConceptDt myCategory;
@Child(name="status", type=CodeDt.class, order=2, min=1, max=1)
@Description(
shortDefinition="AlertStatus",
formalDefinition="Supports basic workflow"
)
private BoundCodeDt<AlertStatusEnum> myStatus;
@Child(name="subject", order=3, min=1, max=1, type={
ca.uhn.fhir.model.dev.resource.Patient.class })
@Description(
shortDefinition="",
formalDefinition="The person who this alert concerns"
)
private ResourceReferenceDt mySubject;
@Child(name="author", order=4, min=0, max=1, type={
ca.uhn.fhir.model.dev.resource.Practitioner.class, ca.uhn.fhir.model.dev.resource.Patient.class, ca.uhn.fhir.model.dev.resource.Device.class })
@Description(
shortDefinition="",
formalDefinition="The person or device that created the alert"
)
private ResourceReferenceDt myAuthor;
@Child(name="note", type=StringDt.class, order=5, min=1, max=1)
@Description(
shortDefinition="",
formalDefinition="The textual component of the alert to display to the user"
)
private StringDt myNote;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myCategory, myStatus, mySubject, myAuthor, myNote);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myCategory, myStatus, mySubject, myAuthor, myNote);
}
/**
* Gets the value(s) for <b>identifier</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Identifier assigned to the alert for external use (outside the FHIR environment)
* </p>
*/
public java.util.List<IdentifierDt> getIdentifier() {
if (myIdentifier == null) {
myIdentifier = new java.util.ArrayList<IdentifierDt>();
}
return myIdentifier;
}
/**
* Sets the value(s) for <b>identifier</b> ()
*
* <p>
* <b>Definition:</b>
* Identifier assigned to the alert for external use (outside the FHIR environment)
* </p>
*/
public Alert setIdentifier(java.util.List<IdentifierDt> theValue) {
myIdentifier = theValue;
return this;
}
/**
* Adds and returns a new value for <b>identifier</b> ()
*
* <p>
* <b>Definition:</b>
* Identifier assigned to the alert for external use (outside the FHIR environment)
* </p>
*/
public IdentifierDt addIdentifier() {
IdentifierDt newType = new IdentifierDt();
getIdentifier().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>identifier</b> (),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* Identifier assigned to the alert for external use (outside the FHIR environment)
* </p>
*/
public IdentifierDt getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
return addIdentifier();
}
return getIdentifier().get(0);
}
/**
* Gets the value(s) for <b>category</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Allows an alert to be divided into different categories like clinical, administrative etc.
* </p>
*/
public CodeableConceptDt getCategory() {
if (myCategory == null) {
myCategory = new CodeableConceptDt();
}
return myCategory;
}
/**
* Sets the value(s) for <b>category</b> ()
*
* <p>
* <b>Definition:</b>
* Allows an alert to be divided into different categories like clinical, administrative etc.
* </p>
*/
public Alert setCategory(CodeableConceptDt theValue) {
myCategory = theValue;
return this;
}
/**
* Gets the value(s) for <b>status</b> (AlertStatus).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Supports basic workflow
* </p>
*/
public BoundCodeDt<AlertStatusEnum> getStatusElement() {
if (myStatus == null) {
myStatus = new BoundCodeDt<AlertStatusEnum>(AlertStatusEnum.VALUESET_BINDER);
}
return myStatus;
}
/**
* Gets the value(s) for <b>status</b> (AlertStatus).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Supports basic workflow
* </p>
*/
public String getStatus() {
return getStatusElement().getValue();
}
/**
* Sets the value(s) for <b>status</b> (AlertStatus)
*
* <p>
* <b>Definition:</b>
* Supports basic workflow
* </p>
*/
public Alert setStatus(BoundCodeDt<AlertStatusEnum> theValue) {
myStatus = theValue;
return this;
}
/**
* Sets the value(s) for <b>status</b> (AlertStatus)
*
* <p>
* <b>Definition:</b>
* Supports basic workflow
* </p>
*/
public Alert setStatus(AlertStatusEnum theValue) {
getStatusElement().setValueAsEnum(theValue);
return this;
}
/**
* Gets the value(s) for <b>subject</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The person who this alert concerns
* </p>
*/
public ResourceReferenceDt getSubject() {
if (mySubject == null) {
mySubject = new ResourceReferenceDt();
}
return mySubject;
}
/**
* Sets the value(s) for <b>subject</b> ()
*
* <p>
* <b>Definition:</b>
* The person who this alert concerns
* </p>
*/
public Alert setSubject(ResourceReferenceDt theValue) {
mySubject = theValue;
return this;
}
/**
* Gets the value(s) for <b>author</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The person or device that created the alert
* </p>
*/
public ResourceReferenceDt getAuthor() {
if (myAuthor == null) {
myAuthor = new ResourceReferenceDt();
}
return myAuthor;
}
/**
* Sets the value(s) for <b>author</b> ()
*
* <p>
* <b>Definition:</b>
* The person or device that created the alert
* </p>
*/
public Alert setAuthor(ResourceReferenceDt theValue) {
myAuthor = theValue;
return this;
}
/**
* Gets the value(s) for <b>note</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The textual component of the alert to display to the user
* </p>
*/
public StringDt getNoteElement() {
if (myNote == null) {
myNote = new StringDt();
}
return myNote;
}
/**
* Gets the value(s) for <b>note</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The textual component of the alert to display to the user
* </p>
*/
public String getNote() {
return getNoteElement().getValue();
}
/**
* Sets the value(s) for <b>note</b> ()
*
* <p>
* <b>Definition:</b>
* The textual component of the alert to display to the user
* </p>
*/
public Alert setNote(StringDt theValue) {
myNote = theValue;
return this;
}
/**
* Sets the value for <b>note</b> ()
*
* <p>
* <b>Definition:</b>
* The textual component of the alert to display to the user
* </p>
*/
public Alert setNote( String theString) {
myNote = new StringDt(theString);
return this;
}
@Override
public String getResourceName() {
return "Alert";
}
}

View File

@ -1,731 +0,0 @@
package ca.uhn.fhir.model.dev.resource;
import java.math.BigDecimal;
import java.net.URI;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.model.dev.composite.AddressDt;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dev.valueset.AdmitSourceEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCertaintyEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCriticalityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskStatusEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskTypeEnum;
import ca.uhn.fhir.model.dev.valueset.AlertStatusEnum;
import ca.uhn.fhir.model.dev.resource.AllergyIntolerance;
import ca.uhn.fhir.model.dev.valueset.AnimalSpeciesEnum;
import ca.uhn.fhir.model.dev.valueset.AnswerFormatEnum;
import ca.uhn.fhir.model.dev.resource.Appointment;
import ca.uhn.fhir.model.dev.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dev.composite.AttachmentDt;
import ca.uhn.fhir.model.dev.resource.CarePlan;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanGoalStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CausalityExpectationEnum;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.CompositionAttestationModeEnum;
import ca.uhn.fhir.model.dev.valueset.CompositionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConceptMapEquivalenceEnum;
import ca.uhn.fhir.model.dev.resource.Condition;
import ca.uhn.fhir.model.dev.valueset.ConditionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum;
import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.resource.Contract;
import ca.uhn.fhir.model.dev.valueset.ContractSubtypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTermTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.DataAbsentReasonEnum;
import ca.uhn.fhir.model.dev.resource.Device;
import ca.uhn.fhir.model.dev.resource.DiagnosticOrder;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderPriorityEnum;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.DiagnosticReport;
import ca.uhn.fhir.model.dev.valueset.DiagnosticReportStatusEnum;
import ca.uhn.fhir.model.dev.resource.DocumentManifest;
import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum;
import ca.uhn.fhir.model.dev.resource.DocumentReference;
import ca.uhn.fhir.model.dev.valueset.DocumentReferenceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.DocumentRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.ElementDefinitionDt;
import ca.uhn.fhir.model.dev.resource.Encounter;
import ca.uhn.fhir.model.dev.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterReasonCodesEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaAdditiveTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaTypeEnum;
import ca.uhn.fhir.model.dev.resource.EpisodeOfCare;
import ca.uhn.fhir.model.dev.valueset.ExcludeFoodModifierEnum;
import ca.uhn.fhir.model.dev.valueset.ExposureTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FHIRDefinedTypeEnum;
import ca.uhn.fhir.model.dev.resource.FamilyHistory;
import ca.uhn.fhir.model.dev.valueset.FilterOperatorEnum;
import ca.uhn.fhir.model.dev.valueset.FluidConsistencyTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FoodTypeEnum;
import ca.uhn.fhir.model.dev.resource.Group;
import ca.uhn.fhir.model.dev.valueset.GroupTypeEnum;
import ca.uhn.fhir.model.dev.valueset.HierarchicalRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.valueset.ImagingModalityEnum;
import ca.uhn.fhir.model.dev.resource.ImagingStudy;
import ca.uhn.fhir.model.dev.resource.Immunization;
import ca.uhn.fhir.model.dev.valueset.ImmunizationReasonCodesEnum;
import ca.uhn.fhir.model.dev.resource.ImmunizationRecommendation;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationStatusCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRouteCodesEnum;
import ca.uhn.fhir.model.dev.valueset.InstanceAvailabilityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.dev.valueset.LinkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ListModeEnum;
import ca.uhn.fhir.model.dev.resource.Location;
import ca.uhn.fhir.model.dev.valueset.LocationModeEnum;
import ca.uhn.fhir.model.dev.valueset.LocationStatusEnum;
import ca.uhn.fhir.model.dev.valueset.LocationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.dev.resource.Media;
import ca.uhn.fhir.model.dev.valueset.MediaTypeEnum;
import ca.uhn.fhir.model.dev.resource.Medication;
import ca.uhn.fhir.model.dev.resource.MedicationAdministration;
import ca.uhn.fhir.model.dev.valueset.MedicationAdministrationStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationDispense;
import ca.uhn.fhir.model.dev.valueset.MedicationDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.MedicationKindEnum;
import ca.uhn.fhir.model.dev.resource.MedicationPrescription;
import ca.uhn.fhir.model.dev.valueset.MedicationPrescriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationStatement;
import ca.uhn.fhir.model.dev.valueset.MessageEventEnum;
import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.MessageTransportEnum;
import ca.uhn.fhir.model.dev.resource.Microarray;
import ca.uhn.fhir.model.dev.valueset.ModalityEnum;
import ca.uhn.fhir.model.dev.resource.Namespace;
import ca.uhn.fhir.model.dev.valueset.NamespaceIdentifierTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NutrientModifierEnum;
import ca.uhn.fhir.model.dev.valueset.NutritionOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.Observation;
import ca.uhn.fhir.model.dev.valueset.ObservationInterpretationCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationReliabilityEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dev.resource.OperationDefinition;
import ca.uhn.fhir.model.dev.valueset.OperationKindEnum;
import ca.uhn.fhir.model.dev.resource.OperationOutcome;
import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum;
import ca.uhn.fhir.model.dev.resource.Order;
import ca.uhn.fhir.model.dev.valueset.OrderOutcomeStatusEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.valueset.OrganizationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantRequiredEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.model.dev.valueset.PatientRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.resource.Practitioner;
import ca.uhn.fhir.model.dev.valueset.PractitionerRoleEnum;
import ca.uhn.fhir.model.dev.valueset.PractitionerSpecialtyEnum;
import ca.uhn.fhir.model.dev.valueset.PriorityCodesEnum;
import ca.uhn.fhir.model.dev.resource.Procedure;
import ca.uhn.fhir.model.dev.valueset.ProcedureRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.dev.valueset.ProvenanceEntityRoleEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.QueryOutcomeEnum;
import ca.uhn.fhir.model.dev.resource.Questionnaire;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireAnswersStatusEnum;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireStatusEnum;
import ca.uhn.fhir.model.dev.composite.RangeDt;
import ca.uhn.fhir.model.dev.composite.RatioDt;
import ca.uhn.fhir.model.dev.valueset.ReactionSeverityEnum;
import ca.uhn.fhir.model.dev.resource.ReferralRequest;
import ca.uhn.fhir.model.dev.valueset.ReferralStatusEnum;
import ca.uhn.fhir.model.dev.resource.RelatedPerson;
import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ResponseTypeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum;
import ca.uhn.fhir.model.dev.composite.SampledDataDt;
import ca.uhn.fhir.model.dev.resource.Schedule;
import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventActionEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectLifecycleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectRoleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventOutcomeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventParticipantNetworkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventSourceTypeEnum;
import ca.uhn.fhir.model.dev.resource.SecurityGroup;
import ca.uhn.fhir.model.dev.resource.SequencingAnalysis;
import ca.uhn.fhir.model.dev.resource.SequencingLab;
import ca.uhn.fhir.model.dev.resource.Slot;
import ca.uhn.fhir.model.dev.valueset.SlotStatusEnum;
import ca.uhn.fhir.model.dev.resource.Specimen;
import ca.uhn.fhir.model.dev.valueset.SpecimenCollectionMethodEnum;
import ca.uhn.fhir.model.dev.valueset.SpecimenTreatmentProcedureEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.Substance;
import ca.uhn.fhir.model.dev.valueset.SubstanceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplementTypeEnum;
import ca.uhn.fhir.model.dev.resource.Supply;
import ca.uhn.fhir.model.dev.valueset.SupplyDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyItemTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.TextureModifierEnum;
import ca.uhn.fhir.model.dev.composite.TimingDt;
import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dev.valueset.ValueSetStatusEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.composite.AgeDt;
import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.MoneyDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
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.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.OidDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.TimeDt;
import ca.uhn.fhir.model.primitive.UriDt;
/**
* HAPI/FHIR <b>Availability</b> Resource
* ((informative) A container for slot(s) of time that may be available for booking appointments)
*
* <p>
* <b>Definition:</b>
*
* </p>
*
* <p>
* <b>Requirements:</b>
*
* </p>
*
* <p>
* <b>Profile Definition:</b>
* <a href="http://hl7.org/fhir/profiles/Availability">http://hl7.org/fhir/profiles/Availability</a>
* </p>
*
*/
@ResourceDef(name="Availability", profile="http://hl7.org/fhir/profiles/Availability", id="availability")
public class Availability
extends BaseResource implements IResource {
/**
* Search parameter constant for <b>actor</b>
* <p>
* Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find an availability for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Availability.actor</b><br/>
* </p>
*/
@SearchParamDefinition(name="actor", path="Availability.actor", description="The individual(HealthcareService, Practitioner, Location, ...) to find an availability for", type="reference" )
public static final String SP_ACTOR = "actor";
/**
* <b>Fluent Client</b> search parameter constant for <b>actor</b>
* <p>
* Description: <b>The individual(HealthcareService, Practitioner, Location, ...) to find an availability for</b><br/>
* Type: <b>reference</b><br/>
* Path: <b>Availability.actor</b><br/>
* </p>
*/
public static final ReferenceClientParam ACTOR = new ReferenceClientParam(SP_ACTOR);
/**
* Search parameter constant for <b>type</b>
* <p>
* Description: <b>The type of appointments that can be booked into associated slot(s)</b><br/>
* Type: <b>token</b><br/>
* Path: <b>Availability.type</b><br/>
* </p>
*/
@SearchParamDefinition(name="type", path="Availability.type", description="The type of appointments that can be booked into associated slot(s)", type="token" )
public static final String SP_TYPE = "type";
/**
* <b>Fluent Client</b> search parameter constant for <b>type</b>
* <p>
* Description: <b>The type of appointments that can be booked into associated slot(s)</b><br/>
* Type: <b>token</b><br/>
* Path: <b>Availability.type</b><br/>
* </p>
*/
public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE);
/**
* Search parameter constant for <b>date</b>
* <p>
* Description: <b>Search for availability resources that have a period that contains this date specified</b><br/>
* Type: <b>date</b><br/>
* Path: <b>Availability.planningHorizon</b><br/>
* </p>
*/
@SearchParamDefinition(name="date", path="Availability.planningHorizon", description="Search for availability resources that have a period that contains this date specified", type="date" )
public static final String SP_DATE = "date";
/**
* <b>Fluent Client</b> search parameter constant for <b>date</b>
* <p>
* Description: <b>Search for availability resources that have a period that contains this date specified</b><br/>
* Type: <b>date</b><br/>
* Path: <b>Availability.planningHorizon</b><br/>
* </p>
*/
public static final DateClientParam DATE = new DateClientParam(SP_DATE);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Availability.actor</b>".
*/
public static final Include INCLUDE_ACTOR = new Include("Availability.actor");
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Availability.planningHorizon</b>".
*/
public static final Include INCLUDE_PLANNINGHORIZON = new Include("Availability.planningHorizon");
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Availability.type</b>".
*/
public static final Include INCLUDE_TYPE = new Include("Availability.type");
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="External Ids for this item",
formalDefinition=""
)
private java.util.List<IdentifierDt> myIdentifier;
@Child(name="type", type=CodeableConceptDt.class, order=1, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="The schedule type can be used for the categorization of healthcare services or other appointment types",
formalDefinition=""
)
private java.util.List<CodeableConceptDt> myType;
@Child(name="actor", order=2, min=1, max=1, type={
IResource.class })
@Description(
shortDefinition="The resource this availability resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, Device, Patient or RelatedPerson",
formalDefinition=""
)
private ResourceReferenceDt myActor;
@Child(name="planningHorizon", type=PeriodDt.class, order=3, min=0, max=1)
@Description(
shortDefinition="The period of time that the slots that are attached to this availability resource cover (even if none exist). These cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates",
formalDefinition=""
)
private PeriodDt myPlanningHorizon;
@Child(name="comment", type=StringDt.class, order=4, min=0, max=1)
@Description(
shortDefinition="Comments on the availability to describe any extended information. Such as custom constraints on the slot(s) that may be associated",
formalDefinition=""
)
private StringDt myComment;
@Child(name="lastModified", type=DateTimeDt.class, order=5, min=0, max=1)
@Description(
shortDefinition="When this availability was created, or last revised",
formalDefinition=""
)
private DateTimeDt myLastModified;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myType, myActor, myPlanningHorizon, myComment, myLastModified);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myType, myActor, myPlanningHorizon, myComment, myLastModified);
}
/**
* Gets the value(s) for <b>identifier</b> (External Ids for this item).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public java.util.List<IdentifierDt> getIdentifier() {
if (myIdentifier == null) {
myIdentifier = new java.util.ArrayList<IdentifierDt>();
}
return myIdentifier;
}
/**
* Sets the value(s) for <b>identifier</b> (External Ids for this item)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setIdentifier(java.util.List<IdentifierDt> theValue) {
myIdentifier = theValue;
return this;
}
/**
* Adds and returns a new value for <b>identifier</b> (External Ids for this item)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public IdentifierDt addIdentifier() {
IdentifierDt newType = new IdentifierDt();
getIdentifier().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>identifier</b> (External Ids for this item),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public IdentifierDt getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
return addIdentifier();
}
return getIdentifier().get(0);
}
/**
* Gets the value(s) for <b>type</b> (The schedule type can be used for the categorization of healthcare services or other appointment types).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public java.util.List<CodeableConceptDt> getType() {
if (myType == null) {
myType = new java.util.ArrayList<CodeableConceptDt>();
}
return myType;
}
/**
* Sets the value(s) for <b>type</b> (The schedule type can be used for the categorization of healthcare services or other appointment types)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setType(java.util.List<CodeableConceptDt> theValue) {
myType = theValue;
return this;
}
/**
* Adds and returns a new value for <b>type</b> (The schedule type can be used for the categorization of healthcare services or other appointment types)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public CodeableConceptDt addType() {
CodeableConceptDt newType = new CodeableConceptDt();
getType().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>type</b> (The schedule type can be used for the categorization of healthcare services or other appointment types),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public CodeableConceptDt getTypeFirstRep() {
if (getType().isEmpty()) {
return addType();
}
return getType().get(0);
}
/**
* Gets the value(s) for <b>actor</b> (The resource this availability resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, Device, Patient or RelatedPerson).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public ResourceReferenceDt getActor() {
if (myActor == null) {
myActor = new ResourceReferenceDt();
}
return myActor;
}
/**
* Sets the value(s) for <b>actor</b> (The resource this availability resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, Device, Patient or RelatedPerson)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setActor(ResourceReferenceDt theValue) {
myActor = theValue;
return this;
}
/**
* Gets the value(s) for <b>planningHorizon</b> (The period of time that the slots that are attached to this availability resource cover (even if none exist). These cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public PeriodDt getPlanningHorizon() {
if (myPlanningHorizon == null) {
myPlanningHorizon = new PeriodDt();
}
return myPlanningHorizon;
}
/**
* Sets the value(s) for <b>planningHorizon</b> (The period of time that the slots that are attached to this availability resource cover (even if none exist). These cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a \"template\" for planning outside these dates)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setPlanningHorizon(PeriodDt theValue) {
myPlanningHorizon = theValue;
return this;
}
/**
* Gets the value(s) for <b>comment</b> (Comments on the availability to describe any extended information. Such as custom constraints on the slot(s) that may be associated).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public StringDt getCommentElement() {
if (myComment == null) {
myComment = new StringDt();
}
return myComment;
}
/**
* Gets the value(s) for <b>comment</b> (Comments on the availability to describe any extended information. Such as custom constraints on the slot(s) that may be associated).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public String getComment() {
return getCommentElement().getValue();
}
/**
* Sets the value(s) for <b>comment</b> (Comments on the availability to describe any extended information. Such as custom constraints on the slot(s) that may be associated)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setComment(StringDt theValue) {
myComment = theValue;
return this;
}
/**
* Sets the value for <b>comment</b> (Comments on the availability to describe any extended information. Such as custom constraints on the slot(s) that may be associated)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setComment( String theString) {
myComment = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for <b>lastModified</b> (When this availability was created, or last revised).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public DateTimeDt getLastModifiedElement() {
if (myLastModified == null) {
myLastModified = new DateTimeDt();
}
return myLastModified;
}
/**
* Gets the value(s) for <b>lastModified</b> (When this availability was created, or last revised).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Date getLastModified() {
return getLastModifiedElement().getValue();
}
/**
* Sets the value(s) for <b>lastModified</b> (When this availability was created, or last revised)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setLastModified(DateTimeDt theValue) {
myLastModified = theValue;
return this;
}
/**
* Sets the value for <b>lastModified</b> (When this availability was created, or last revised)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setLastModified( Date theDate, TemporalPrecisionEnum thePrecision) {
myLastModified = new DateTimeDt(theDate, thePrecision);
return this;
}
/**
* Sets the value for <b>lastModified</b> (When this availability was created, or last revised)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Availability setLastModifiedWithSecondsPrecision( Date theDate) {
myLastModified = new DateTimeDt(theDate);
return this;
}
@Override
public String getResourceName() {
return "Availability";
}
}

View File

@ -16,223 +16,50 @@
package ca.uhn.fhir.model.dev.resource; package ca.uhn.fhir.model.dev.resource;
import java.math.BigDecimal;
import java.net.URI; import java.net.URI;
import java.util.*; import java.util.Date;
import ca.uhn.fhir.model.api.*; import java.util.List;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.model.dev.composite.AddressDt; import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.dev.valueset.AdmitSourceEnum; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCategoryEnum; import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCertaintyEnum; import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCriticalityEnum; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskSeverityEnum; import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskStatusEnum; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskTypeEnum; import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dev.valueset.AlertStatusEnum; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dev.resource.AllergyIntolerance; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.dev.valueset.AnimalSpeciesEnum; import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.valueset.AnswerFormatEnum;
import ca.uhn.fhir.model.dev.resource.Appointment;
import ca.uhn.fhir.model.dev.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dev.composite.AttachmentDt;
import ca.uhn.fhir.model.dev.resource.CarePlan;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanGoalStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CausalityExpectationEnum;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt; import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt; import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.CompositionAttestationModeEnum; import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.valueset.CompositionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConceptMapEquivalenceEnum;
import ca.uhn.fhir.model.dev.resource.Condition;
import ca.uhn.fhir.model.dev.valueset.ConditionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum; import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum; import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum;
import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.resource.Contract;
import ca.uhn.fhir.model.dev.valueset.ContractSubtypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTermTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.DataAbsentReasonEnum;
import ca.uhn.fhir.model.dev.resource.Device;
import ca.uhn.fhir.model.dev.resource.DiagnosticOrder;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderPriorityEnum;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.DiagnosticReport;
import ca.uhn.fhir.model.dev.valueset.DiagnosticReportStatusEnum;
import ca.uhn.fhir.model.dev.resource.DocumentManifest;
import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum; import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum;
import ca.uhn.fhir.model.dev.resource.DocumentReference;
import ca.uhn.fhir.model.dev.valueset.DocumentReferenceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.DocumentRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.ElementDefinitionDt;
import ca.uhn.fhir.model.dev.resource.Encounter;
import ca.uhn.fhir.model.dev.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterReasonCodesEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaAdditiveTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaTypeEnum;
import ca.uhn.fhir.model.dev.resource.EpisodeOfCare;
import ca.uhn.fhir.model.dev.valueset.ExcludeFoodModifierEnum;
import ca.uhn.fhir.model.dev.valueset.ExposureTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FHIRDefinedTypeEnum;
import ca.uhn.fhir.model.dev.resource.FamilyHistory;
import ca.uhn.fhir.model.dev.valueset.FilterOperatorEnum;
import ca.uhn.fhir.model.dev.valueset.FluidConsistencyTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FoodTypeEnum;
import ca.uhn.fhir.model.dev.resource.Group;
import ca.uhn.fhir.model.dev.valueset.GroupTypeEnum;
import ca.uhn.fhir.model.dev.valueset.HierarchicalRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.valueset.ImagingModalityEnum;
import ca.uhn.fhir.model.dev.resource.ImagingStudy;
import ca.uhn.fhir.model.dev.resource.Immunization;
import ca.uhn.fhir.model.dev.valueset.ImmunizationReasonCodesEnum;
import ca.uhn.fhir.model.dev.resource.ImmunizationRecommendation;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationStatusCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRouteCodesEnum;
import ca.uhn.fhir.model.dev.valueset.InstanceAvailabilityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.dev.valueset.LinkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ListModeEnum;
import ca.uhn.fhir.model.dev.resource.Location;
import ca.uhn.fhir.model.dev.valueset.LocationModeEnum;
import ca.uhn.fhir.model.dev.valueset.LocationStatusEnum;
import ca.uhn.fhir.model.dev.valueset.LocationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.dev.resource.Media;
import ca.uhn.fhir.model.dev.valueset.MediaTypeEnum;
import ca.uhn.fhir.model.dev.resource.Medication;
import ca.uhn.fhir.model.dev.resource.MedicationAdministration;
import ca.uhn.fhir.model.dev.valueset.MedicationAdministrationStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationDispense;
import ca.uhn.fhir.model.dev.valueset.MedicationDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.MedicationKindEnum;
import ca.uhn.fhir.model.dev.resource.MedicationPrescription;
import ca.uhn.fhir.model.dev.valueset.MedicationPrescriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationStatement;
import ca.uhn.fhir.model.dev.valueset.MessageEventEnum;
import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum; import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.MessageTransportEnum;
import ca.uhn.fhir.model.dev.resource.Microarray;
import ca.uhn.fhir.model.dev.valueset.ModalityEnum;
import ca.uhn.fhir.model.dev.resource.Namespace;
import ca.uhn.fhir.model.dev.valueset.NamespaceIdentifierTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NutrientModifierEnum;
import ca.uhn.fhir.model.dev.valueset.NutritionOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.Observation;
import ca.uhn.fhir.model.dev.valueset.ObservationInterpretationCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationReliabilityEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dev.resource.OperationDefinition;
import ca.uhn.fhir.model.dev.valueset.OperationKindEnum;
import ca.uhn.fhir.model.dev.resource.OperationOutcome;
import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum;
import ca.uhn.fhir.model.dev.resource.Order;
import ca.uhn.fhir.model.dev.valueset.OrderOutcomeStatusEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.valueset.OrganizationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantRequiredEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.model.dev.valueset.PatientRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.resource.Practitioner;
import ca.uhn.fhir.model.dev.valueset.PractitionerRoleEnum;
import ca.uhn.fhir.model.dev.valueset.PractitionerSpecialtyEnum;
import ca.uhn.fhir.model.dev.valueset.PriorityCodesEnum;
import ca.uhn.fhir.model.dev.resource.Procedure;
import ca.uhn.fhir.model.dev.valueset.ProcedureRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.dev.valueset.ProvenanceEntityRoleEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.QueryOutcomeEnum;
import ca.uhn.fhir.model.dev.resource.Questionnaire;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireAnswersStatusEnum;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireStatusEnum;
import ca.uhn.fhir.model.dev.composite.RangeDt;
import ca.uhn.fhir.model.dev.composite.RatioDt;
import ca.uhn.fhir.model.dev.valueset.ReactionSeverityEnum;
import ca.uhn.fhir.model.dev.resource.ReferralRequest;
import ca.uhn.fhir.model.dev.valueset.ReferralStatusEnum;
import ca.uhn.fhir.model.dev.resource.RelatedPerson;
import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum; import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ResponseTypeEnum; import ca.uhn.fhir.model.dev.valueset.ResourceVersionPolicyEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum; import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum; import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum;
import ca.uhn.fhir.model.dev.composite.SampledDataDt;
import ca.uhn.fhir.model.dev.resource.Schedule;
import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum; import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventActionEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectLifecycleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectRoleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventOutcomeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventParticipantNetworkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventSourceTypeEnum;
import ca.uhn.fhir.model.dev.resource.SecurityGroup;
import ca.uhn.fhir.model.dev.resource.SequencingAnalysis;
import ca.uhn.fhir.model.dev.resource.SequencingLab;
import ca.uhn.fhir.model.dev.resource.Slot;
import ca.uhn.fhir.model.dev.valueset.SlotStatusEnum;
import ca.uhn.fhir.model.dev.resource.Specimen;
import ca.uhn.fhir.model.dev.valueset.SpecimenCollectionMethodEnum;
import ca.uhn.fhir.model.dev.valueset.SpecimenTreatmentProcedureEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.Substance;
import ca.uhn.fhir.model.dev.valueset.SubstanceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplementTypeEnum;
import ca.uhn.fhir.model.dev.resource.Supply;
import ca.uhn.fhir.model.dev.valueset.SupplyDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyItemTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum; import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.TextureModifierEnum;
import ca.uhn.fhir.model.dev.composite.TimingDt;
import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum; import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dev.valueset.ValueSetStatusEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.composite.AgeDt;
import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.MoneyDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.primitive.Base64BinaryDt; import ca.uhn.fhir.model.primitive.Base64BinaryDt;
import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.OidDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.TimeDt;
import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.gclient.DateClientParam;
import ca.uhn.fhir.rest.gclient.ReferenceClientParam;
import ca.uhn.fhir.rest.gclient.StringClientParam;
import ca.uhn.fhir.rest.gclient.TokenClientParam;
/** /**
@ -3326,7 +3153,7 @@ public class Conformance
shortDefinition="ResourceVersionPolicy", shortDefinition="ResourceVersionPolicy",
formalDefinition="Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources" formalDefinition="Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources"
) )
private CodeDt myVersioning; private BoundCodeDt<ResourceVersionPolicyEnum> myVersioning;
@Child(name="readHistory", type=BooleanDt.class, order=4, min=0, max=1) @Child(name="readHistory", type=BooleanDt.class, order=4, min=0, max=1)
@Description( @Description(
@ -3533,9 +3360,9 @@ public class Conformance
* Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources * Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources
* </p> * </p>
*/ */
public CodeDt getVersioningElement() { public BoundCodeDt<ResourceVersionPolicyEnum> getVersioningElement() {
if (myVersioning == null) { if (myVersioning == null) {
myVersioning = new CodeDt(); myVersioning = new BoundCodeDt<ResourceVersionPolicyEnum>(ResourceVersionPolicyEnum.VALUESET_BINDER);
} }
return myVersioning; return myVersioning;
} }
@ -3563,27 +3390,27 @@ public class Conformance
* Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources * Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources
* </p> * </p>
*/ */
public RestResource setVersioning(CodeDt theValue) { public RestResource setVersioning(BoundCodeDt<ResourceVersionPolicyEnum> theValue) {
myVersioning = theValue; myVersioning = theValue;
return this; return this;
} }
/** /**
* Sets the value for <b>versioning</b> (ResourceVersionPolicy) * Sets the value(s) for <b>versioning</b> (ResourceVersionPolicy)
* *
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources * Thi field is set to true to specify that the system does not support (server) or use (client) versioning for this resource type. If this is not set to true, the server must at least correctly track and populate the versionId meta-property on resources
* </p> * </p>
*/ */
public RestResource setVersioning( String theCode) { public RestResource setVersioning(ResourceVersionPolicyEnum theValue) {
myVersioning = new CodeDt(theCode); getVersioningElement().setValueAsEnum(theValue);
return this; return this;
} }
/** /**
* Gets the value(s) for <b>readHistory</b> (). * Gets the value(s) for <b>readHistory</b> ().
* creating it if it does * creating it if it does
@ -5802,5 +5629,9 @@ public class Conformance
public String getResourceName() { public String getResourceName() {
return "Conformance"; return "Conformance";
} }
public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() {
return ca.uhn.fhir.context.FhirVersionEnum.DEV;
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,223 +16,40 @@
package ca.uhn.fhir.model.dev.resource; package ca.uhn.fhir.model.dev.resource;
import java.math.BigDecimal;
import java.net.URI; import java.net.URI;
import java.util.*; import java.util.Date;
import ca.uhn.fhir.model.api.*; import java.util.List;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.model.dev.composite.AddressDt; import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum; import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.dev.valueset.AdmitSourceEnum; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCategoryEnum; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCertaintyEnum; import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCriticalityEnum; import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskSeverityEnum; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskStatusEnum; import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskTypeEnum; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.dev.valueset.AlertStatusEnum; import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dev.resource.AllergyIntolerance; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dev.valueset.AnimalSpeciesEnum; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.dev.valueset.AnswerFormatEnum;
import ca.uhn.fhir.model.dev.resource.Appointment;
import ca.uhn.fhir.model.dev.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dev.composite.AttachmentDt;
import ca.uhn.fhir.model.dev.resource.CarePlan;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanGoalStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CausalityExpectationEnum;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt; import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.CompositionAttestationModeEnum;
import ca.uhn.fhir.model.dev.valueset.CompositionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConceptMapEquivalenceEnum;
import ca.uhn.fhir.model.dev.resource.Condition;
import ca.uhn.fhir.model.dev.valueset.ConditionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum;
import ca.uhn.fhir.model.dev.composite.ContactPointDt; import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.resource.Contract;
import ca.uhn.fhir.model.dev.valueset.ContractSubtypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTermTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.DataAbsentReasonEnum;
import ca.uhn.fhir.model.dev.resource.Device;
import ca.uhn.fhir.model.dev.resource.DiagnosticOrder;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderPriorityEnum;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.DiagnosticReport;
import ca.uhn.fhir.model.dev.valueset.DiagnosticReportStatusEnum;
import ca.uhn.fhir.model.dev.resource.DocumentManifest;
import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum;
import ca.uhn.fhir.model.dev.resource.DocumentReference;
import ca.uhn.fhir.model.dev.valueset.DocumentReferenceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.DocumentRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.ElementDefinitionDt;
import ca.uhn.fhir.model.dev.resource.Encounter;
import ca.uhn.fhir.model.dev.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterReasonCodesEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaAdditiveTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaTypeEnum;
import ca.uhn.fhir.model.dev.resource.EpisodeOfCare;
import ca.uhn.fhir.model.dev.valueset.ExcludeFoodModifierEnum;
import ca.uhn.fhir.model.dev.valueset.ExposureTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FHIRDefinedTypeEnum;
import ca.uhn.fhir.model.dev.resource.FamilyHistory;
import ca.uhn.fhir.model.dev.valueset.FilterOperatorEnum;
import ca.uhn.fhir.model.dev.valueset.FluidConsistencyTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FoodTypeEnum;
import ca.uhn.fhir.model.dev.resource.Group;
import ca.uhn.fhir.model.dev.valueset.GroupTypeEnum;
import ca.uhn.fhir.model.dev.valueset.HierarchicalRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.valueset.ImagingModalityEnum;
import ca.uhn.fhir.model.dev.resource.ImagingStudy;
import ca.uhn.fhir.model.dev.resource.Immunization;
import ca.uhn.fhir.model.dev.valueset.ImmunizationReasonCodesEnum;
import ca.uhn.fhir.model.dev.resource.ImmunizationRecommendation;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationStatusCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRouteCodesEnum;
import ca.uhn.fhir.model.dev.valueset.InstanceAvailabilityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.dev.valueset.LinkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ListModeEnum;
import ca.uhn.fhir.model.dev.resource.Location;
import ca.uhn.fhir.model.dev.valueset.LocationModeEnum;
import ca.uhn.fhir.model.dev.valueset.LocationStatusEnum;
import ca.uhn.fhir.model.dev.valueset.LocationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.dev.resource.Media;
import ca.uhn.fhir.model.dev.valueset.MediaTypeEnum;
import ca.uhn.fhir.model.dev.resource.Medication;
import ca.uhn.fhir.model.dev.resource.MedicationAdministration;
import ca.uhn.fhir.model.dev.valueset.MedicationAdministrationStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationDispense;
import ca.uhn.fhir.model.dev.valueset.MedicationDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.MedicationKindEnum;
import ca.uhn.fhir.model.dev.resource.MedicationPrescription;
import ca.uhn.fhir.model.dev.valueset.MedicationPrescriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationStatement;
import ca.uhn.fhir.model.dev.valueset.MessageEventEnum;
import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.MessageTransportEnum;
import ca.uhn.fhir.model.dev.resource.Microarray;
import ca.uhn.fhir.model.dev.valueset.ModalityEnum;
import ca.uhn.fhir.model.dev.resource.Namespace;
import ca.uhn.fhir.model.dev.valueset.NamespaceIdentifierTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NutrientModifierEnum;
import ca.uhn.fhir.model.dev.valueset.NutritionOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.Observation;
import ca.uhn.fhir.model.dev.valueset.ObservationInterpretationCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationReliabilityEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dev.resource.OperationDefinition;
import ca.uhn.fhir.model.dev.valueset.OperationKindEnum; import ca.uhn.fhir.model.dev.valueset.OperationKindEnum;
import ca.uhn.fhir.model.dev.resource.OperationOutcome;
import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum; import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum;
import ca.uhn.fhir.model.dev.resource.Order;
import ca.uhn.fhir.model.dev.valueset.OrderOutcomeStatusEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.valueset.OrganizationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantRequiredEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.model.dev.valueset.PatientRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.resource.Practitioner;
import ca.uhn.fhir.model.dev.valueset.PractitionerRoleEnum;
import ca.uhn.fhir.model.dev.valueset.PractitionerSpecialtyEnum;
import ca.uhn.fhir.model.dev.valueset.PriorityCodesEnum;
import ca.uhn.fhir.model.dev.resource.Procedure;
import ca.uhn.fhir.model.dev.valueset.ProcedureRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.dev.valueset.ProvenanceEntityRoleEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.QueryOutcomeEnum;
import ca.uhn.fhir.model.dev.resource.Questionnaire;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireAnswersStatusEnum;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireStatusEnum;
import ca.uhn.fhir.model.dev.composite.RangeDt;
import ca.uhn.fhir.model.dev.composite.RatioDt;
import ca.uhn.fhir.model.dev.valueset.ReactionSeverityEnum;
import ca.uhn.fhir.model.dev.resource.ReferralRequest;
import ca.uhn.fhir.model.dev.valueset.ReferralStatusEnum;
import ca.uhn.fhir.model.dev.resource.RelatedPerson;
import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum; import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum; import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ResponseTypeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum;
import ca.uhn.fhir.model.dev.composite.SampledDataDt;
import ca.uhn.fhir.model.dev.resource.Schedule;
import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventActionEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectLifecycleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectRoleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventOutcomeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventParticipantNetworkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventSourceTypeEnum;
import ca.uhn.fhir.model.dev.resource.SecurityGroup;
import ca.uhn.fhir.model.dev.resource.SequencingAnalysis;
import ca.uhn.fhir.model.dev.resource.SequencingLab;
import ca.uhn.fhir.model.dev.resource.Slot;
import ca.uhn.fhir.model.dev.valueset.SlotStatusEnum;
import ca.uhn.fhir.model.dev.resource.Specimen;
import ca.uhn.fhir.model.dev.valueset.SpecimenCollectionMethodEnum;
import ca.uhn.fhir.model.dev.valueset.SpecimenTreatmentProcedureEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.Substance;
import ca.uhn.fhir.model.dev.valueset.SubstanceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplementTypeEnum;
import ca.uhn.fhir.model.dev.resource.Supply;
import ca.uhn.fhir.model.dev.valueset.SupplyDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyItemTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.TextureModifierEnum;
import ca.uhn.fhir.model.dev.composite.TimingDt;
import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dev.valueset.ValueSetStatusEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.composite.AgeDt;
import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.MoneyDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.OidDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.TimeDt;
import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.gclient.DateClientParam;
import ca.uhn.fhir.rest.gclient.ReferenceClientParam;
import ca.uhn.fhir.rest.gclient.StringClientParam;
import ca.uhn.fhir.rest.gclient.TokenClientParam;
/** /**
@ -2855,5 +2672,9 @@ public class OperationDefinition
public String getResourceName() { public String getResourceName() {
return "OperationDefinition"; return "OperationDefinition";
} }
public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() {
return ca.uhn.fhir.context.FhirVersionEnum.DEV;
}
} }

View File

@ -1,641 +0,0 @@
package ca.uhn.fhir.model.dev.resource;
import java.math.BigDecimal;
import java.net.URI;
import java.util.*;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.api.annotation.*;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.model.dev.composite.AddressDt;
import ca.uhn.fhir.model.dev.valueset.AdministrativeGenderEnum;
import ca.uhn.fhir.model.dev.valueset.AdmitSourceEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCertaintyEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskCriticalityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskStatusEnum;
import ca.uhn.fhir.model.dev.valueset.AdverseReactionRiskTypeEnum;
import ca.uhn.fhir.model.dev.valueset.AlertStatusEnum;
import ca.uhn.fhir.model.dev.resource.AllergyIntolerance;
import ca.uhn.fhir.model.dev.valueset.AnimalSpeciesEnum;
import ca.uhn.fhir.model.dev.valueset.AnswerFormatEnum;
import ca.uhn.fhir.model.dev.resource.Appointment;
import ca.uhn.fhir.model.dev.valueset.AppointmentStatusEnum;
import ca.uhn.fhir.model.dev.composite.AttachmentDt;
import ca.uhn.fhir.model.dev.resource.CarePlan;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanActivityStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanGoalStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CarePlanStatusEnum;
import ca.uhn.fhir.model.dev.valueset.CausalityExpectationEnum;
import ca.uhn.fhir.model.dev.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.valueset.CompositionAttestationModeEnum;
import ca.uhn.fhir.model.dev.valueset.CompositionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConceptMapEquivalenceEnum;
import ca.uhn.fhir.model.dev.resource.Condition;
import ca.uhn.fhir.model.dev.valueset.ConditionStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceEventModeEnum;
import ca.uhn.fhir.model.dev.valueset.ConformanceStatementStatusEnum;
import ca.uhn.fhir.model.dev.composite.ContactPointDt;
import ca.uhn.fhir.model.dev.resource.Contract;
import ca.uhn.fhir.model.dev.valueset.ContractSubtypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTermTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ContractTypeCodesEnum;
import ca.uhn.fhir.model.dev.valueset.DataAbsentReasonEnum;
import ca.uhn.fhir.model.dev.resource.Device;
import ca.uhn.fhir.model.dev.resource.DiagnosticOrder;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderPriorityEnum;
import ca.uhn.fhir.model.dev.valueset.DiagnosticOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.DiagnosticReport;
import ca.uhn.fhir.model.dev.valueset.DiagnosticReportStatusEnum;
import ca.uhn.fhir.model.dev.resource.DocumentManifest;
import ca.uhn.fhir.model.dev.valueset.DocumentModeEnum;
import ca.uhn.fhir.model.dev.resource.DocumentReference;
import ca.uhn.fhir.model.dev.valueset.DocumentReferenceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.DocumentRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.ElementDefinitionDt;
import ca.uhn.fhir.model.dev.resource.Encounter;
import ca.uhn.fhir.model.dev.valueset.EncounterClassEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterReasonCodesEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterStateEnum;
import ca.uhn.fhir.model.dev.valueset.EncounterTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaAdditiveTypeEnum;
import ca.uhn.fhir.model.dev.valueset.EnteralFormulaTypeEnum;
import ca.uhn.fhir.model.dev.resource.EpisodeOfCare;
import ca.uhn.fhir.model.dev.valueset.ExcludeFoodModifierEnum;
import ca.uhn.fhir.model.dev.valueset.ExposureTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FHIRDefinedTypeEnum;
import ca.uhn.fhir.model.dev.resource.FamilyHistory;
import ca.uhn.fhir.model.dev.valueset.FilterOperatorEnum;
import ca.uhn.fhir.model.dev.valueset.FluidConsistencyTypeEnum;
import ca.uhn.fhir.model.dev.valueset.FoodTypeEnum;
import ca.uhn.fhir.model.dev.resource.Group;
import ca.uhn.fhir.model.dev.valueset.GroupTypeEnum;
import ca.uhn.fhir.model.dev.valueset.HierarchicalRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.HumanNameDt;
import ca.uhn.fhir.model.dev.composite.IdentifierDt;
import ca.uhn.fhir.model.dev.valueset.ImagingModalityEnum;
import ca.uhn.fhir.model.dev.resource.ImagingStudy;
import ca.uhn.fhir.model.dev.resource.Immunization;
import ca.uhn.fhir.model.dev.valueset.ImmunizationReasonCodesEnum;
import ca.uhn.fhir.model.dev.resource.ImmunizationRecommendation;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationDateCriterionCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRecommendationStatusCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ImmunizationRouteCodesEnum;
import ca.uhn.fhir.model.dev.valueset.InstanceAvailabilityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.dev.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.dev.valueset.LinkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ListModeEnum;
import ca.uhn.fhir.model.dev.resource.Location;
import ca.uhn.fhir.model.dev.valueset.LocationModeEnum;
import ca.uhn.fhir.model.dev.valueset.LocationStatusEnum;
import ca.uhn.fhir.model.dev.valueset.LocationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.dev.resource.Media;
import ca.uhn.fhir.model.dev.valueset.MediaTypeEnum;
import ca.uhn.fhir.model.dev.resource.Medication;
import ca.uhn.fhir.model.dev.resource.MedicationAdministration;
import ca.uhn.fhir.model.dev.valueset.MedicationAdministrationStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationDispense;
import ca.uhn.fhir.model.dev.valueset.MedicationDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.MedicationKindEnum;
import ca.uhn.fhir.model.dev.resource.MedicationPrescription;
import ca.uhn.fhir.model.dev.valueset.MedicationPrescriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.MedicationStatement;
import ca.uhn.fhir.model.dev.valueset.MessageEventEnum;
import ca.uhn.fhir.model.dev.valueset.MessageSignificanceCategoryEnum;
import ca.uhn.fhir.model.dev.valueset.MessageTransportEnum;
import ca.uhn.fhir.model.dev.resource.Microarray;
import ca.uhn.fhir.model.dev.valueset.ModalityEnum;
import ca.uhn.fhir.model.dev.resource.Namespace;
import ca.uhn.fhir.model.dev.valueset.NamespaceIdentifierTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceStatusEnum;
import ca.uhn.fhir.model.dev.valueset.NamespaceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.NutrientModifierEnum;
import ca.uhn.fhir.model.dev.valueset.NutritionOrderStatusEnum;
import ca.uhn.fhir.model.dev.resource.Observation;
import ca.uhn.fhir.model.dev.valueset.ObservationInterpretationCodesEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationReliabilityEnum;
import ca.uhn.fhir.model.dev.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dev.resource.OperationDefinition;
import ca.uhn.fhir.model.dev.valueset.OperationKindEnum;
import ca.uhn.fhir.model.dev.resource.OperationOutcome;
import ca.uhn.fhir.model.dev.valueset.OperationParameterUseEnum;
import ca.uhn.fhir.model.dev.resource.Order;
import ca.uhn.fhir.model.dev.valueset.OrderOutcomeStatusEnum;
import ca.uhn.fhir.model.dev.resource.Organization;
import ca.uhn.fhir.model.dev.valueset.OrganizationTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantRequiredEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipantTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ParticipationStatusEnum;
import ca.uhn.fhir.model.dev.resource.Patient;
import ca.uhn.fhir.model.dev.valueset.PatientRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.composite.PeriodDt;
import ca.uhn.fhir.model.dev.resource.Practitioner;
import ca.uhn.fhir.model.dev.valueset.PractitionerRoleEnum;
import ca.uhn.fhir.model.dev.valueset.PractitionerSpecialtyEnum;
import ca.uhn.fhir.model.dev.valueset.PriorityCodesEnum;
import ca.uhn.fhir.model.dev.resource.Procedure;
import ca.uhn.fhir.model.dev.valueset.ProcedureRelationshipTypeEnum;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.dev.valueset.ProvenanceEntityRoleEnum;
import ca.uhn.fhir.model.dev.composite.QuantityDt;
import ca.uhn.fhir.model.dev.valueset.QueryOutcomeEnum;
import ca.uhn.fhir.model.dev.resource.Questionnaire;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireAnswersStatusEnum;
import ca.uhn.fhir.model.dev.valueset.QuestionnaireStatusEnum;
import ca.uhn.fhir.model.dev.composite.RangeDt;
import ca.uhn.fhir.model.dev.composite.RatioDt;
import ca.uhn.fhir.model.dev.valueset.ReactionSeverityEnum;
import ca.uhn.fhir.model.dev.resource.ReferralRequest;
import ca.uhn.fhir.model.dev.valueset.ReferralStatusEnum;
import ca.uhn.fhir.model.dev.resource.RelatedPerson;
import ca.uhn.fhir.model.dev.valueset.ResourceProfileStatusEnum;
import ca.uhn.fhir.model.dev.valueset.ResourceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.ResponseTypeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulConformanceModeEnum;
import ca.uhn.fhir.model.dev.valueset.RestfulSecurityServiceEnum;
import ca.uhn.fhir.model.dev.composite.SampledDataDt;
import ca.uhn.fhir.model.dev.resource.Schedule;
import ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventActionEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectLifecycleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectRoleEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventObjectTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventOutcomeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventParticipantNetworkTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SecurityEventSourceTypeEnum;
import ca.uhn.fhir.model.dev.resource.SecurityGroup;
import ca.uhn.fhir.model.dev.resource.SequencingAnalysis;
import ca.uhn.fhir.model.dev.resource.SequencingLab;
import ca.uhn.fhir.model.dev.resource.Slot;
import ca.uhn.fhir.model.dev.valueset.SlotStatusEnum;
import ca.uhn.fhir.model.dev.resource.Specimen;
import ca.uhn.fhir.model.dev.valueset.SpecimenCollectionMethodEnum;
import ca.uhn.fhir.model.dev.valueset.SpecimenTreatmentProcedureEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.model.dev.resource.Substance;
import ca.uhn.fhir.model.dev.valueset.SubstanceTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplementTypeEnum;
import ca.uhn.fhir.model.dev.resource.Supply;
import ca.uhn.fhir.model.dev.valueset.SupplyDispenseStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyItemTypeEnum;
import ca.uhn.fhir.model.dev.valueset.SupplyStatusEnum;
import ca.uhn.fhir.model.dev.valueset.SystemRestfulInteractionEnum;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dev.valueset.TextureModifierEnum;
import ca.uhn.fhir.model.dev.composite.TimingDt;
import ca.uhn.fhir.model.dev.valueset.TypeRestfulInteractionEnum;
import ca.uhn.fhir.model.dev.resource.ValueSet;
import ca.uhn.fhir.model.dev.valueset.ValueSetStatusEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.composite.AgeDt;
import ca.uhn.fhir.model.dev.composite.BoundCodeableConceptDt;
import ca.uhn.fhir.model.dev.composite.DurationDt;
import ca.uhn.fhir.model.dev.composite.MoneyDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
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.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.IntegerDt;
import ca.uhn.fhir.model.primitive.OidDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.TimeDt;
import ca.uhn.fhir.model.primitive.UriDt;
/**
* HAPI/FHIR <b>OperationOutcome</b> Resource
* ()
*
* <p>
* <b>Definition:</b>
* A collection of error, warning or information messages that result from a system action
* </p>
*
* <p>
* <b>Requirements:</b>
*
* </p>
*
* <p>
* <b>Profile Definition:</b>
* <a href="http://hl7.org/fhir/profiles/OperationOutcome">http://hl7.org/fhir/profiles/OperationOutcome</a>
* </p>
*
*/
@ResourceDef(name="OperationOutcome", profile="http://hl7.org/fhir/profiles/OperationOutcome", id="operationoutcome")
public class OperationOutcome
extends ca.uhn.fhir.model.base.resource.BaseOperationOutcome implements IResource {
@Child(name="issue", order=0, min=1, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="",
formalDefinition="An error, warning or information message that results from a system action"
)
private java.util.List<Issue> myIssue;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIssue);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIssue);
}
/**
* Gets the value(s) for <b>issue</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* An error, warning or information message that results from a system action
* </p>
*/
public java.util.List<Issue> getIssue() {
if (myIssue == null) {
myIssue = new java.util.ArrayList<Issue>();
}
return myIssue;
}
/**
* Sets the value(s) for <b>issue</b> ()
*
* <p>
* <b>Definition:</b>
* An error, warning or information message that results from a system action
* </p>
*/
public OperationOutcome setIssue(java.util.List<Issue> theValue) {
myIssue = theValue;
return this;
}
/**
* Adds and returns a new value for <b>issue</b> ()
*
* <p>
* <b>Definition:</b>
* An error, warning or information message that results from a system action
* </p>
*/
public Issue addIssue() {
Issue newType = new Issue();
getIssue().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>issue</b> (),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* An error, warning or information message that results from a system action
* </p>
*/
public Issue getIssueFirstRep() {
if (getIssue().isEmpty()) {
return addIssue();
}
return getIssue().get(0);
}
/**
* Block class for child element: <b>OperationOutcome.issue</b> ()
*
* <p>
* <b>Definition:</b>
* An error, warning or information message that results from a system action
* </p>
*/
@Block()
public static class Issue
extends BaseIssue implements IResourceBlock {
@Child(name="severity", type=CodeDt.class, order=0, min=1, max=1)
@Description(
shortDefinition="IssueSeverity",
formalDefinition="Indicates whether the issue indicates a variation from successful processing"
)
private BoundCodeDt<IssueSeverityEnum> mySeverity;
@Child(name="type", type=CodingDt.class, order=1, min=0, max=1)
@Description(
shortDefinition="IssueType",
formalDefinition="A code indicating the type of error, warning or information message."
)
private CodingDt myType;
@Child(name="details", type=StringDt.class, order=2, min=0, max=1)
@Description(
shortDefinition="",
formalDefinition="Additional description of the issue"
)
private StringDt myDetails;
@Child(name="location", type=StringDt.class, order=3, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="",
formalDefinition="A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised."
)
private java.util.List<StringDt> myLocation;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySeverity, myType, myDetails, myLocation);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySeverity, myType, myDetails, myLocation);
}
/**
* Gets the value(s) for <b>severity</b> (IssueSeverity).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Indicates whether the issue indicates a variation from successful processing
* </p>
*/
public BoundCodeDt<IssueSeverityEnum> getSeverityElement() {
if (mySeverity == null) {
mySeverity = new BoundCodeDt<IssueSeverityEnum>(IssueSeverityEnum.VALUESET_BINDER);
}
return mySeverity;
}
/**
* Gets the value(s) for <b>severity</b> (IssueSeverity).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Indicates whether the issue indicates a variation from successful processing
* </p>
*/
public String getSeverity() {
return getSeverityElement().getValue();
}
/**
* Sets the value(s) for <b>severity</b> (IssueSeverity)
*
* <p>
* <b>Definition:</b>
* Indicates whether the issue indicates a variation from successful processing
* </p>
*/
public Issue setSeverity(BoundCodeDt<IssueSeverityEnum> theValue) {
mySeverity = theValue;
return this;
}
/**
* Sets the value(s) for <b>severity</b> (IssueSeverity)
*
* <p>
* <b>Definition:</b>
* Indicates whether the issue indicates a variation from successful processing
* </p>
*/
public Issue setSeverity(IssueSeverityEnum theValue) {
getSeverityElement().setValueAsEnum(theValue);
return this;
}
/**
* Gets the value(s) for <b>type</b> (IssueType).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A code indicating the type of error, warning or information message.
* </p>
*/
public CodingDt getType() {
if (myType == null) {
myType = new CodingDt();
}
return myType;
}
/**
* Sets the value(s) for <b>type</b> (IssueType)
*
* <p>
* <b>Definition:</b>
* A code indicating the type of error, warning or information message.
* </p>
*/
public Issue setType(CodingDt theValue) {
myType = theValue;
return this;
}
/**
* Gets the value(s) for <b>details</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Additional description of the issue
* </p>
*/
public StringDt getDetailsElement() {
if (myDetails == null) {
myDetails = new StringDt();
}
return myDetails;
}
/**
* Gets the value(s) for <b>details</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Additional description of the issue
* </p>
*/
public String getDetails() {
return getDetailsElement().getValue();
}
/**
* Sets the value(s) for <b>details</b> ()
*
* <p>
* <b>Definition:</b>
* Additional description of the issue
* </p>
*/
public Issue setDetails(StringDt theValue) {
myDetails = theValue;
return this;
}
/**
* Sets the value for <b>details</b> ()
*
* <p>
* <b>Definition:</b>
* Additional description of the issue
* </p>
*/
public Issue setDetails( String theString) {
myDetails = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for <b>location</b> ().
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
* </p>
*/
public java.util.List<StringDt> getLocation() {
if (myLocation == null) {
myLocation = new java.util.ArrayList<StringDt>();
}
return myLocation;
}
/**
* Sets the value(s) for <b>location</b> ()
*
* <p>
* <b>Definition:</b>
* A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
* </p>
*/
public Issue setLocation(java.util.List<StringDt> theValue) {
myLocation = theValue;
return this;
}
/**
* Adds and returns a new value for <b>location</b> ()
*
* <p>
* <b>Definition:</b>
* A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
* </p>
*/
public StringDt addLocation() {
StringDt newType = new StringDt();
getLocation().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>location</b> (),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
* </p>
*/
public StringDt getLocationFirstRep() {
if (getLocation().isEmpty()) {
return addLocation();
}
return getLocation().get(0);
}
/**
* Adds a new value for <b>location</b> ()
*
* <p>
* <b>Definition:</b>
* A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Issue addLocation( String theString) {
if (myLocation == null) {
myLocation = new java.util.ArrayList<StringDt>();
}
myLocation.add(new StringDt(theString));
return this;
}
}
@Override
public String getResourceName() {
return "OperationOutcome";
}
}

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