Fixing unit tests

This commit is contained in:
jamesagnew 2014-04-03 14:30:49 -04:00
parent eda3995a72
commit 69461ef10e
49 changed files with 1020 additions and 1616 deletions

View File

@ -266,6 +266,10 @@
var pre = pres[j]; var pre = pres[j];
if (pre.innerHTML.match(/\/\*/)) { if (pre.innerHTML.match(/\/\*/)) {
pre.className = 'brush: java'; pre.className = 'brush: java';
} else if (pre.innerHTML.match(/^\/\//)) {
pre.className = 'brush: java';
} else if (pre.innerHTML.match(/^\{/)) {
pre.className = 'brush: jscript';
} else if (pre.innerHTML.match(/^\#/)) { } else if (pre.innerHTML.match(/^\#/)) {
pre.className = 'brush: bash'; pre.className = 'brush: bash';
} else if (pre.innerHTML.match(/\&lt\;\//)) { } else if (pre.innerHTML.match(/\&lt\;\//)) {

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;

View File

@ -26,6 +26,13 @@ public abstract class BaseRuntimeElementDefinition<T extends IElement> {
assert theImplementingClass != null; assert theImplementingClass != null;
myName = theName; myName = theName;
// TODO: remove this and fix for the model
if (myName.endsWith("Dt")) {
myName = myName.substring(0, myName.length() - 2);
}
myImplementingClass = theImplementingClass; myImplementingClass = theImplementingClass;
} }

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
@ -35,6 +35,7 @@ import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.composite.AttachmentDt;
import ca.uhn.fhir.model.dstu.composite.ContainedDt; import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
@ -128,6 +129,7 @@ class ModelScanner {
toScan.add(DateDt.class); toScan.add(DateDt.class);
toScan.add(CodeDt.class); toScan.add(CodeDt.class);
toScan.add(DecimalDt.class); toScan.add(DecimalDt.class);
toScan.add(AttachmentDt.class);
do { do {
for (Class<? extends IElement> nextClass : toScan) { for (Class<? extends IElement> nextClass : toScan) {

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Collections; import java.util.Collections;

View File

@ -19,7 +19,6 @@ import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition { public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition {
private Map<String, BaseRuntimeElementDefinition<?>> myAttributeNameToDefinition; private Map<String, BaseRuntimeElementDefinition<?>> myAttributeNameToDefinition;
private Map<Class<? extends IElement>, String> myDatatypeToAttributeName; private Map<Class<? extends IElement>, String> myDatatypeToAttributeName;
private Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> myDatatypeToDefinition; private Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> myDatatypeToDefinition;
@ -28,7 +27,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
// nothing // nothing
} }
@Override @Override
public BaseRuntimeElementDefinition<?> getChildByName(String theName) { public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
return myAttributeNameToDefinition.get(theName); return myAttributeNameToDefinition.get(theName);
@ -49,12 +47,15 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
return myDatatypeToDefinition.get(theType); return myDatatypeToDefinition.get(theType);
} }
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RuntimeChildUndeclaredExtensionDefinition.class);
@Override @Override
void sealAndInitialize(Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { void sealAndInitialize(Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>(); Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
myDatatypeToAttributeName = new HashMap<Class<? extends IElement>, String>(); myDatatypeToAttributeName = new HashMap<Class<? extends IElement>, String>();
for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) { for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) {
ourLog.info(next.getName());
if (next instanceof IRuntimeDatatypeDefinition) { if (next instanceof IRuntimeDatatypeDefinition) {
if (!((IRuntimeDatatypeDefinition) next).isSpecialization()) { if (!((IRuntimeDatatypeDefinition) next).isSpecialization()) {
String attrName = "value" + WordUtils.capitalize(next.getName()); String attrName = "value" + WordUtils.capitalize(next.getName());
@ -86,7 +87,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
myDatatypeToDefinition.put(ResourceReferenceDt.class, def); myDatatypeToDefinition.put(ResourceReferenceDt.class, def);
} }
@Override @Override
public IAccessor getAccessor() { public IAccessor getAccessor() {
return new IAccessor() { return new IAccessor() {
@ -97,9 +97,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
return Collections.singletonList(target.getValue()); return Collections.singletonList(target.getValue());
} }
return target.getUndeclaredExtensions(); return target.getUndeclaredExtensions();
}};
} }
};
}
@Override @Override
public IMutator getMutator() { public IMutator getMutator() {
@ -112,20 +112,18 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
} else { } else {
target.getUndeclaredExtensions().add((ExtensionDt) theValue); target.getUndeclaredExtensions().add((ExtensionDt) theValue);
} }
}};
} }
};
}
@Override @Override
public int getMax() { public int getMax() {
return 1; return 1;
} }
@Override @Override
public int getMin() { public int getMin() {
return 0; return 0;
} }
} }

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank;
import ca.uhn.fhir.model.api.ICompositeDatatype; import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank;
import java.util.Map; import java.util.Map;

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.context; package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.join;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;

View File

@ -68,7 +68,7 @@ public class AttachmentDt
shortDefinition="Human language of the content (BCP-47)", shortDefinition="Human language of the content (BCP-47)",
formalDefinition="The human language of the content. The value can be any valid value according to BCP 47" formalDefinition="The human language of the content. The value can be any valid value according to BCP 47"
) )
private CodeDt myLanguageElement; private CodeDt myLanguage;
@Child(name="data", type=Base64BinaryDt.class, order=2, min=0, max=1) @Child(name="data", type=Base64BinaryDt.class, order=2, min=0, max=1)
@Description( @Description(
@ -108,7 +108,7 @@ public class AttachmentDt
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myContentType, myLanguageElement, myData, myUrl, mySize, myHash, myTitle); return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myContentType, myLanguage, myData, myUrl, mySize, myHash, myTitle);
} }
@Override @Override
@ -118,7 +118,7 @@ public class AttachmentDt
@Override @Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myContentType, myLanguageElement, myData, myUrl, mySize, myHash, myTitle); return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myContentType, myLanguage, myData, myUrl, mySize, myHash, myTitle);
} }
/** /**
@ -175,11 +175,11 @@ public class AttachmentDt
* The human language of the content. The value can be any valid value according to BCP 47 * The human language of the content. The value can be any valid value according to BCP 47
* </p> * </p>
*/ */
public CodeDt getLanguageElement() { public CodeDt getLanguage() {
if (myLanguageElement == null) { if (myLanguage == null) {
myLanguageElement = new CodeDt(); myLanguage = new CodeDt();
} }
return myLanguageElement; return myLanguage;
} }
/** /**
@ -190,8 +190,8 @@ public class AttachmentDt
* The human language of the content. The value can be any valid value according to BCP 47 * The human language of the content. The value can be any valid value according to BCP 47
* </p> * </p>
*/ */
public AttachmentDt setLanguageElement(CodeDt theValue) { public AttachmentDt setLanguage(CodeDt theValue) {
myLanguageElement = theValue; myLanguage = theValue;
return this; return this;
} }
@ -203,8 +203,8 @@ public class AttachmentDt
* The human language of the content. The value can be any valid value according to BCP 47 * The human language of the content. The value can be any valid value according to BCP 47
* </p> * </p>
*/ */
public AttachmentDt setLanguageElement( String theCode) { public AttachmentDt setLanguage( String theCode) {
myLanguageElement = new CodeDt(theCode); myLanguage = new CodeDt(theCode);
return this; return this;
} }

View File

@ -180,19 +180,6 @@ public class QuantityDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value * The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public QuantityDt setValue( long theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p> * </p>
*/ */
public QuantityDt setValue( double theValue) { public QuantityDt setValue( double theValue) {
@ -213,6 +200,19 @@ public class QuantityDt
return this; return this;
} }
/**
* Sets the value for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public QuantityDt setValue( long theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>comparator</b> (< | <= | >= | > - how to understand the value). * Gets the value(s) for <b>comparator</b> (< | <= | >= | > - how to understand the value).

View File

@ -239,19 +239,6 @@ public class SampledDataDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The length of time between sampling times, measured in milliseconds * The length of time between sampling times, measured in milliseconds
* </p>
*/
public SampledDataDt setPeriod( long theValue) {
myPeriod = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>period</b> (Number of milliseconds between samples)
*
* <p>
* <b>Definition:</b>
* The length of time between sampling times, measured in milliseconds
* </p> * </p>
*/ */
public SampledDataDt setPeriod( double theValue) { public SampledDataDt setPeriod( double theValue) {
@ -272,6 +259,19 @@ public class SampledDataDt
return this; return this;
} }
/**
* Sets the value for <b>period</b> (Number of milliseconds between samples)
*
* <p>
* <b>Definition:</b>
* The length of time between sampling times, measured in milliseconds
* </p>
*/
public SampledDataDt setPeriod( long theValue) {
myPeriod = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>factor</b> (Multiply data by this before adding to origin). * Gets the value(s) for <b>factor</b> (Multiply data by this before adding to origin).
@ -309,19 +309,6 @@ public class SampledDataDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* A correction factor that is applied to the sampled data points before they are added to the origin * A correction factor that is applied to the sampled data points before they are added to the origin
* </p>
*/
public SampledDataDt setFactor( long theValue) {
myFactor = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>factor</b> (Multiply data by this before adding to origin)
*
* <p>
* <b>Definition:</b>
* A correction factor that is applied to the sampled data points before they are added to the origin
* </p> * </p>
*/ */
public SampledDataDt setFactor( double theValue) { public SampledDataDt setFactor( double theValue) {
@ -342,6 +329,19 @@ public class SampledDataDt
return this; return this;
} }
/**
* Sets the value for <b>factor</b> (Multiply data by this before adding to origin)
*
* <p>
* <b>Definition:</b>
* A correction factor that is applied to the sampled data points before they are added to the origin
* </p>
*/
public SampledDataDt setFactor( long theValue) {
myFactor = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>lowerLimit</b> (Lower limit of detection). * Gets the value(s) for <b>lowerLimit</b> (Lower limit of detection).
@ -379,19 +379,6 @@ public class SampledDataDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit) * The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit)
* </p>
*/
public SampledDataDt setLowerLimit( long theValue) {
myLowerLimit = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>lowerLimit</b> (Lower limit of detection)
*
* <p>
* <b>Definition:</b>
* The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit)
* </p> * </p>
*/ */
public SampledDataDt setLowerLimit( double theValue) { public SampledDataDt setLowerLimit( double theValue) {
@ -412,6 +399,19 @@ public class SampledDataDt
return this; return this;
} }
/**
* Sets the value for <b>lowerLimit</b> (Lower limit of detection)
*
* <p>
* <b>Definition:</b>
* The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit)
* </p>
*/
public SampledDataDt setLowerLimit( long theValue) {
myLowerLimit = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>upperLimit</b> (Upper limit of detection). * Gets the value(s) for <b>upperLimit</b> (Upper limit of detection).
@ -449,19 +449,6 @@ public class SampledDataDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit) * The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit)
* </p>
*/
public SampledDataDt setUpperLimit( long theValue) {
myUpperLimit = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>upperLimit</b> (Upper limit of detection)
*
* <p>
* <b>Definition:</b>
* The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit)
* </p> * </p>
*/ */
public SampledDataDt setUpperLimit( double theValue) { public SampledDataDt setUpperLimit( double theValue) {
@ -482,6 +469,19 @@ public class SampledDataDt
return this; return this;
} }
/**
* Sets the value for <b>upperLimit</b> (Upper limit of detection)
*
* <p>
* <b>Definition:</b>
* The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit)
* </p>
*/
public SampledDataDt setUpperLimit( long theValue) {
myUpperLimit = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>dimensions</b> (Number of sample points at each time point). * Gets the value(s) for <b>dimensions</b> (Number of sample points at each time point).

View File

@ -376,19 +376,6 @@ public class ScheduleDt
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* How long each repetition should last * How long each repetition should last
* </p>
*/
public Repeat setDuration( long theValue) {
myDuration = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>duration</b> (Repeating or event-related duration)
*
* <p>
* <b>Definition:</b>
* How long each repetition should last
* </p> * </p>
*/ */
public Repeat setDuration( double theValue) { public Repeat setDuration( double theValue) {
@ -409,6 +396,19 @@ public class ScheduleDt
return this; return this;
} }
/**
* Sets the value for <b>duration</b> (Repeating or event-related duration)
*
* <p>
* <b>Definition:</b>
* How long each repetition should last
* </p>
*/
public Repeat setDuration( long theValue) {
myDuration = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>units</b> (s | min | h | d | wk | mo | a - unit of time (UCUM)). * Gets the value(s) for <b>units</b> (s | min | h | d | wk | mo | a - unit of time (UCUM)).

View File

@ -1753,19 +1753,6 @@ public class Claim extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* *
* </p>
*/
public Service setFee( long theValue) {
myFee = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>fee</b> (Professional fee)
*
* <p>
* <b>Definition:</b>
*
* </p> * </p>
*/ */
public Service setFee( double theValue) { public Service setFee( double theValue) {
@ -1786,6 +1773,19 @@ public class Claim extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>fee</b> (Professional fee)
*
* <p>
* <b>Definition:</b>
*
* </p>
*/
public Service setFee( long theValue) {
myFee = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>location</b> (Service Location). * Gets the value(s) for <b>location</b> (Service Location).
@ -1991,19 +1991,6 @@ public class Claim extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The amount to reimbuse for a laboratory service. * The amount to reimbuse for a laboratory service.
* </p>
*/
public ServiceLab setFee( long theValue) {
myFee = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>fee</b> (Lab fee)
*
* <p>
* <b>Definition:</b>
* The amount to reimbuse for a laboratory service.
* </p> * </p>
*/ */
public ServiceLab setFee( double theValue) { public ServiceLab setFee( double theValue) {
@ -2024,6 +2011,19 @@ public class Claim extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>fee</b> (Lab fee)
*
* <p>
* <b>Definition:</b>
* The amount to reimbuse for a laboratory service.
* </p>
*/
public ServiceLab setFee( long theValue) {
myFee = new DecimalDt(theValue);
return this;
}
} }

View File

@ -996,24 +996,6 @@ public class GVFVariant extends BaseResource implements IResource {
* Frequency of the variant * Frequency of the variant
* </p> * </p>
* *
* @return Returns a reference to this object, to allow for simple chaining.
*/
public GVFVariant addVariantFreq( long theValue) {
if (myVariantFreq == null) {
myVariantFreq = new java.util.ArrayList<DecimalDt>();
}
myVariantFreq.add(new DecimalDt(theValue));
return this;
}
/**
* Adds a new value for <b>variantFreq</b> (Variant frequency)
*
* <p>
* <b>Definition:</b>
* Frequency of the variant
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining. * @return Returns a reference to this object, to allow for simple chaining.
*/ */
public GVFVariant addVariantFreq( double theValue) { public GVFVariant addVariantFreq( double theValue) {
@ -1042,6 +1024,24 @@ public class GVFVariant extends BaseResource implements IResource {
return this; return this;
} }
/**
* Adds a new value for <b>variantFreq</b> (Variant frequency)
*
* <p>
* <b>Definition:</b>
* Frequency of the variant
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public GVFVariant addVariantFreq( long theValue) {
if (myVariantFreq == null) {
myVariantFreq = new java.util.ArrayList<DecimalDt>();
}
myVariantFreq.add(new DecimalDt(theValue));
return this;
}
/** /**
* Gets the value(s) for <b>variantEffect</b> (Variant effect). * Gets the value(s) for <b>variantEffect</b> (Variant effect).

View File

@ -763,19 +763,6 @@ public class GeneExpression extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Expression level of the gene in RPKM * Expression level of the gene in RPKM
* </p>
*/
public RnaSeq setExpression( long theValue) {
myExpression = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>expression</b> (Expression level of the gene in RPKM)
*
* <p>
* <b>Definition:</b>
* Expression level of the gene in RPKM
* </p> * </p>
*/ */
public RnaSeq setExpression( double theValue) { public RnaSeq setExpression( double theValue) {
@ -796,6 +783,19 @@ public class GeneExpression extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>expression</b> (Expression level of the gene in RPKM)
*
* <p>
* <b>Definition:</b>
* Expression level of the gene in RPKM
* </p>
*/
public RnaSeq setExpression( long theValue) {
myExpression = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>isoform</b> (Isoform of the gene). * Gets the value(s) for <b>isoform</b> (Isoform of the gene).
@ -981,19 +981,6 @@ public class GeneExpression extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Expression level of the isoform in RPKM * Expression level of the isoform in RPKM
* </p>
*/
public RnaSeqIsoform setExpression( long theValue) {
myExpression = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>expression</b> (Expression level of the isoform in RPKM)
*
* <p>
* <b>Definition:</b>
* Expression level of the isoform in RPKM
* </p> * </p>
*/ */
public RnaSeqIsoform setExpression( double theValue) { public RnaSeqIsoform setExpression( double theValue) {
@ -1014,6 +1001,19 @@ public class GeneExpression extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>expression</b> (Expression level of the isoform in RPKM)
*
* <p>
* <b>Definition:</b>
* Expression level of the isoform in RPKM
* </p>
*/
public RnaSeqIsoform setExpression( long theValue) {
myExpression = new DecimalDt(theValue);
return this;
}
} }

View File

@ -828,19 +828,6 @@ public class Location extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below) * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)
* </p>
*/
public Position setLongitude( long theValue) {
myLongitude = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>longitude</b> (Longitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)
* </p> * </p>
*/ */
public Position setLongitude( double theValue) { public Position setLongitude( double theValue) {
@ -861,6 +848,19 @@ public class Location extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>longitude</b> (Longitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)
* </p>
*/
public Position setLongitude( long theValue) {
myLongitude = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>latitude</b> (Latitude as expressed in KML). * Gets the value(s) for <b>latitude</b> (Latitude as expressed in KML).
@ -898,19 +898,6 @@ public class Location extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below) * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)
* </p>
*/
public Position setLatitude( long theValue) {
myLatitude = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>latitude</b> (Latitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)
* </p> * </p>
*/ */
public Position setLatitude( double theValue) { public Position setLatitude( double theValue) {
@ -931,6 +918,19 @@ public class Location extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>latitude</b> (Latitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)
* </p>
*/
public Position setLatitude( long theValue) {
myLatitude = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>altitude</b> (Altitude as expressed in KML). * Gets the value(s) for <b>altitude</b> (Altitude as expressed in KML).
@ -968,19 +968,6 @@ public class Location extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below) * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)
* </p>
*/
public Position setAltitude( long theValue) {
myAltitude = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>altitude</b> (Altitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)
* </p> * </p>
*/ */
public Position setAltitude( double theValue) { public Position setAltitude( double theValue) {
@ -1001,6 +988,19 @@ public class Location extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>altitude</b> (Altitude as expressed in KML)
*
* <p>
* <b>Definition:</b>
* Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)
* </p>
*/
public Position setAltitude( long theValue) {
myAltitude = new DecimalDt(theValue);
return this;
}
} }

View File

@ -956,19 +956,6 @@ public class Microarray extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* Intensity(expression) of the gene * Intensity(expression) of the gene
* </p>
*/
public Sample setIntensity( long theValue) {
myIntensity = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>intensity</b> (Intensity)
*
* <p>
* <b>Definition:</b>
* Intensity(expression) of the gene
* </p> * </p>
*/ */
public Sample setIntensity( double theValue) { public Sample setIntensity( double theValue) {
@ -989,6 +976,19 @@ public class Microarray extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>intensity</b> (Intensity)
*
* <p>
* <b>Definition:</b>
* Intensity(expression) of the gene
* </p>
*/
public Sample setIntensity( long theValue) {
myIntensity = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>isControl</b> (Control). * Gets the value(s) for <b>isControl</b> (Control).

View File

@ -1,939 +0,0 @@
package ca.uhn.fhir.model.dstu.resource;
import java.util.Date;
import java.util.List;
import ca.uhn.fhir.model.api.BaseElement;
import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
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.HumanNameDt;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.dstu.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
import ca.uhn.fhir.model.primitive.DateTimeDt;
/**
* HAPI/FHIR <b>Person</b> Resource
* (Person involved in healthcare)
*
* <p>
* <b>Definition:</b>
* A person who is involved in the healthcare process
* </p>
*
* <p>
* <b>Requirements:</b>
* Need to track persons potentially across multiple roles
* </p>
*
* <p>
* <b>Profile Definition:</b>
* <a href="http://hl7.org/fhir/profiles/Person">http://hl7.org/fhir/profiles/Person</a>
* </p>
*
*/
@ResourceDef(name="Person", profile="http://hl7.org/fhir/profiles/Person", id="person")
public class Person extends BaseResource implements IResource {
/**
* Search parameter constant for <b>identifier</b>
* <p>
* Description: <b>A patient Identifier</b><br/>
* Type: <b>token</b><br/>
* Path: <b>identifier</b><br/>
* </p>
*/
public static final String SP_IDENTIFIER = "identifier";
/**
* Search parameter constant for <b>name</b>
* <p>
* Description: <b>a portion of name in any name part</b><br/>
* Type: <b>string</b><br/>
* Path: <b>name</b><br/>
* </p>
*/
public static final String SP_NAME = "name";
/**
* Search parameter constant for <b>phonetic</b>
* <p>
* Description: <b>a portion of name using some kind of phonetic matching algorithm</b><br/>
* Type: <b>string</b><br/>
* Path: <b>phonetic</b><br/>
* </p>
*/
public static final String SP_PHONETIC = "phonetic";
/**
* Search parameter constant for <b>telecom</b>
* <p>
* Description: <b>the value in any kind of contact</b><br/>
* Type: <b>string</b><br/>
* Path: <b>telecom</b><br/>
* </p>
*/
public static final String SP_TELECOM = "telecom";
/**
* Search parameter constant for <b>address</b>
* <p>
* Description: <b>an address in any kind of address/part</b><br/>
* Type: <b>string</b><br/>
* Path: <b>address</b><br/>
* </p>
*/
public static final String SP_ADDRESS = "address";
/**
* Search parameter constant for <b>gender</b>
* <p>
* Description: <b>gender of the person</b><br/>
* Type: <b>token</b><br/>
* Path: <b>gender</b><br/>
* </p>
*/
public static final String SP_GENDER = "gender";
/**
* Search parameter constant for <b>language</b>
* <p>
* Description: <b>language code (irrespective of use value)</b><br/>
* Type: <b>token</b><br/>
* Path: <b>language</b><br/>
* </p>
*/
public static final String SP_LANGUAGE = "language";
/**
* Search parameter constant for <b>birthdate</b>
* <p>
* Description: <b>the patient's date of birth</b><br/>
* Type: <b>date</b><br/>
* Path: <b>birthdate</b><br/>
* </p>
*/
public static final String SP_BIRTHDATE = "birthdate";
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="A Human identifier for this person",
formalDefinition="Identifier for a person within a particular scope."
)
private java.util.List<IdentifierDt> myIdentifier;
@Child(name="name", type=HumanNameDt.class, order=1, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="A name associated with the person",
formalDefinition="A name associated with the person"
)
private java.util.List<HumanNameDt> myName;
@Child(name="telecom", type=ContactDt.class, order=2, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="A contact detail for the person",
formalDefinition="A contact detail for the person, e.g. a telephone number or an email address."
)
private java.util.List<ContactDt> myTelecom;
@Child(name="gender", type=CodingDt.class, order=3, min=0, max=1)
@Description(
shortDefinition="Administrative Gender",
formalDefinition="Administrative Gender"
)
private CodingDt myGender;
@Child(name="birthDate", type=DateTimeDt.class, order=4, min=0, max=1)
@Description(
shortDefinition="The birth date for the person",
formalDefinition="The birth date for the person."
)
private DateTimeDt myBirthDate;
@Child(name="deceased", type=BooleanDt.class, order=5, min=0, max=1)
@Description(
shortDefinition="Indicates if the Person is deceased or not",
formalDefinition="Indicates if the Person is deceased or not"
)
private BooleanDt myDeceased;
@Child(name="address", type=AddressDt.class, order=6, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="One or more addresses for the person",
formalDefinition="One or more addresses for the person"
)
private java.util.List<AddressDt> myAddress;
@Child(name="maritalStatus", type=CodeableConceptDt.class, order=7, min=0, max=1)
@Description(
shortDefinition="Marital (civil) status of the person",
formalDefinition="This field contains the patient's marital (civil) status."
)
private BoundCodeableConceptDt<MaritalStatusCodesEnum> myMaritalStatus;
@Child(name="language", order=8, min=0, max=Child.MAX_UNLIMITED)
@Description(
shortDefinition="The person's proficiency level of a language",
formalDefinition="A language spoken by the person, with proficiency"
)
private java.util.List<Language> myLanguageElement;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myName, myTelecom, myGender, myBirthDate, myDeceased, myAddress, myMaritalStatus, myLanguageElement);
}
@Override
public java.util.List<IElement> getAllPopulatedChildElements() {
return getAllPopulatedChildElementsOfType(null);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myName, myTelecom, myGender, myBirthDate, myDeceased, myAddress, myMaritalStatus, myLanguageElement);
}
/**
* Gets the value(s) for <b>identifier</b> (A Human identifier for this person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </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> (A Human identifier for this person)
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </p>
*/
public Person setIdentifier(java.util.List<IdentifierDt> theValue) {
myIdentifier = theValue;
return this;
}
/**
* Adds and returns a new value for <b>identifier</b> (A Human identifier for this person)
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </p>
*/
public IdentifierDt addIdentifier() {
IdentifierDt newType = new IdentifierDt();
getIdentifier().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>identifier</b> (A Human identifier for this person),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </p>
*/
public IdentifierDt getIdentifierFirstRep() {
if (getIdentifier().isEmpty()) {
return addIdentifier();
}
return getIdentifier().get(0);
}
/**
* Adds a new value for <b>identifier</b> (A Human identifier for this person)
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Person addIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) {
if (myIdentifier == null) {
myIdentifier = new java.util.ArrayList<IdentifierDt>();
}
myIdentifier.add(new IdentifierDt(theUse, theSystem, theValue, theLabel));
return this;
}
/**
* Adds a new value for <b>identifier</b> (A Human identifier for this person)
*
* <p>
* <b>Definition:</b>
* Identifier for a person within a particular scope.
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Person addIdentifier( String theSystem, String theValue) {
if (myIdentifier == null) {
myIdentifier = new java.util.ArrayList<IdentifierDt>();
}
myIdentifier.add(new IdentifierDt(theSystem, theValue));
return this;
}
/**
* Gets the value(s) for <b>name</b> (A name associated with the person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A name associated with the person
* </p>
*/
public java.util.List<HumanNameDt> getName() {
if (myName == null) {
myName = new java.util.ArrayList<HumanNameDt>();
}
return myName;
}
/**
* Sets the value(s) for <b>name</b> (A name associated with the person)
*
* <p>
* <b>Definition:</b>
* A name associated with the person
* </p>
*/
public Person setName(java.util.List<HumanNameDt> theValue) {
myName = theValue;
return this;
}
/**
* Adds and returns a new value for <b>name</b> (A name associated with the person)
*
* <p>
* <b>Definition:</b>
* A name associated with the person
* </p>
*/
public HumanNameDt addName() {
HumanNameDt newType = new HumanNameDt();
getName().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>name</b> (A name associated with the person),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* A name associated with the person
* </p>
*/
public HumanNameDt getNameFirstRep() {
if (getName().isEmpty()) {
return addName();
}
return getName().get(0);
}
/**
* Gets the value(s) for <b>telecom</b> (A contact detail for the person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A contact detail for the person, e.g. a telephone number or an email address.
* </p>
*/
public java.util.List<ContactDt> getTelecom() {
if (myTelecom == null) {
myTelecom = new java.util.ArrayList<ContactDt>();
}
return myTelecom;
}
/**
* Sets the value(s) for <b>telecom</b> (A contact detail for the person)
*
* <p>
* <b>Definition:</b>
* A contact detail for the person, e.g. a telephone number or an email address.
* </p>
*/
public Person setTelecom(java.util.List<ContactDt> theValue) {
myTelecom = theValue;
return this;
}
/**
* Adds and returns a new value for <b>telecom</b> (A contact detail for the person)
*
* <p>
* <b>Definition:</b>
* A contact detail for the person, e.g. a telephone number or an email address.
* </p>
*/
public ContactDt addTelecom() {
ContactDt newType = new ContactDt();
getTelecom().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>telecom</b> (A contact detail for the person),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* A contact detail for the person, e.g. a telephone number or an email address.
* </p>
*/
public ContactDt getTelecomFirstRep() {
if (getTelecom().isEmpty()) {
return addTelecom();
}
return getTelecom().get(0);
}
/**
* Gets the value(s) for <b>gender</b> (Administrative Gender).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Administrative Gender
* </p>
*/
public CodingDt getGender() {
if (myGender == null) {
myGender = new CodingDt();
}
return myGender;
}
/**
* Sets the value(s) for <b>gender</b> (Administrative Gender)
*
* <p>
* <b>Definition:</b>
* Administrative Gender
* </p>
*/
public Person setGender(CodingDt theValue) {
myGender = theValue;
return this;
}
/**
* Gets the value(s) for <b>birthDate</b> (The birth date for the person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The birth date for the person.
* </p>
*/
public DateTimeDt getBirthDate() {
if (myBirthDate == null) {
myBirthDate = new DateTimeDt();
}
return myBirthDate;
}
/**
* Sets the value(s) for <b>birthDate</b> (The birth date for the person)
*
* <p>
* <b>Definition:</b>
* The birth date for the person.
* </p>
*/
public Person setBirthDate(DateTimeDt theValue) {
myBirthDate = theValue;
return this;
}
/**
* Sets the value for <b>birthDate</b> (The birth date for the person)
*
* <p>
* <b>Definition:</b>
* The birth date for the person.
* </p>
*/
public Person setBirthDate( Date theDate, TemporalPrecisionEnum thePrecision) {
myBirthDate = new DateTimeDt(theDate, thePrecision);
return this;
}
/**
* Sets the value for <b>birthDate</b> (The birth date for the person)
*
* <p>
* <b>Definition:</b>
* The birth date for the person.
* </p>
*/
public Person setBirthDateWithSecondsPrecision( Date theDate) {
myBirthDate = new DateTimeDt(theDate);
return this;
}
/**
* Gets the value(s) for <b>deceased</b> (Indicates if the Person is deceased or not).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Indicates if the Person is deceased or not
* </p>
*/
public BooleanDt getDeceased() {
if (myDeceased == null) {
myDeceased = new BooleanDt();
}
return myDeceased;
}
/**
* Sets the value(s) for <b>deceased</b> (Indicates if the Person is deceased or not)
*
* <p>
* <b>Definition:</b>
* Indicates if the Person is deceased or not
* </p>
*/
public Person setDeceased(BooleanDt theValue) {
myDeceased = theValue;
return this;
}
/**
* Sets the value for <b>deceased</b> (Indicates if the Person is deceased or not)
*
* <p>
* <b>Definition:</b>
* Indicates if the Person is deceased or not
* </p>
*/
public Person setDeceased( boolean theBoolean) {
myDeceased = new BooleanDt(theBoolean);
return this;
}
/**
* Gets the value(s) for <b>address</b> (One or more addresses for the person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* One or more addresses for the person
* </p>
*/
public java.util.List<AddressDt> getAddress() {
if (myAddress == null) {
myAddress = new java.util.ArrayList<AddressDt>();
}
return myAddress;
}
/**
* Sets the value(s) for <b>address</b> (One or more addresses for the person)
*
* <p>
* <b>Definition:</b>
* One or more addresses for the person
* </p>
*/
public Person setAddress(java.util.List<AddressDt> theValue) {
myAddress = theValue;
return this;
}
/**
* Adds and returns a new value for <b>address</b> (One or more addresses for the person)
*
* <p>
* <b>Definition:</b>
* One or more addresses for the person
* </p>
*/
public AddressDt addAddress() {
AddressDt newType = new AddressDt();
getAddress().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>address</b> (One or more addresses for the person),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* One or more addresses for the person
* </p>
*/
public AddressDt getAddressFirstRep() {
if (getAddress().isEmpty()) {
return addAddress();
}
return getAddress().get(0);
}
/**
* Gets the value(s) for <b>maritalStatus</b> (Marital (civil) status of the person).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* This field contains the patient's marital (civil) status.
* </p>
*/
public BoundCodeableConceptDt<MaritalStatusCodesEnum> getMaritalStatus() {
if (myMaritalStatus == null) {
myMaritalStatus = new BoundCodeableConceptDt<MaritalStatusCodesEnum>(MaritalStatusCodesEnum.VALUESET_BINDER);
}
return myMaritalStatus;
}
/**
* Sets the value(s) for <b>maritalStatus</b> (Marital (civil) status of the person)
*
* <p>
* <b>Definition:</b>
* This field contains the patient's marital (civil) status.
* </p>
*/
public Person setMaritalStatus(BoundCodeableConceptDt<MaritalStatusCodesEnum> theValue) {
myMaritalStatus = theValue;
return this;
}
/**
* Sets the value(s) for <b>maritalStatus</b> (Marital (civil) status of the person)
*
* <p>
* <b>Definition:</b>
* This field contains the patient's marital (civil) status.
* </p>
*/
public Person setMaritalStatus(MaritalStatusCodesEnum theValue) {
getMaritalStatus().setValueAsEnum(theValue);
return this;
}
/**
* Gets the value(s) for <b>language</b> (The person's proficiency level of a language).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A language spoken by the person, with proficiency
* </p>
*/
public java.util.List<Language> getLanguageElement() {
if (myLanguageElement == null) {
myLanguageElement = new java.util.ArrayList<Language>();
}
return myLanguageElement;
}
/**
* Sets the value(s) for <b>language</b> (The person's proficiency level of a language)
*
* <p>
* <b>Definition:</b>
* A language spoken by the person, with proficiency
* </p>
*/
public Person setLanguageElement(java.util.List<Language> theValue) {
myLanguageElement = theValue;
return this;
}
/**
* Adds and returns a new value for <b>language</b> (The person's proficiency level of a language)
*
* <p>
* <b>Definition:</b>
* A language spoken by the person, with proficiency
* </p>
*/
public Language addLanguageElement() {
Language newType = new Language();
getLanguageElement().add(newType);
return newType;
}
/**
* Gets the first repetition for <b>language</b> (The person's proficiency level of a language),
* creating it if it does not already exist.
*
* <p>
* <b>Definition:</b>
* A language spoken by the person, with proficiency
* </p>
*/
public Language getLanguageElementFirstRep() {
if (getLanguageElement().isEmpty()) {
return addLanguageElement();
}
return getLanguageElement().get(0);
}
/**
* Block class for child element: <b>Person.language</b> (The person's proficiency level of a language)
*
* <p>
* <b>Definition:</b>
* A language spoken by the person, with proficiency
* </p>
*/
@Block(name="Person.language")
public static class Language extends BaseElement implements IResourceBlock {
@Child(name="language", type=CodeableConceptDt.class, order=0, min=1, max=1)
@Description(
shortDefinition="Language with optional region",
formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case. E.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English"
)
private CodeableConceptDt myLanguageElement;
@Child(name="mode", type=CodeableConceptDt.class, order=1, min=0, max=1)
@Description(
shortDefinition="Language method of expression",
formalDefinition="A value representing the person's method of expression of this language. Examples: expressed spoken, expressed written, expressed signed, received spoken, received written, received signed"
)
private CodeableConceptDt myMode;
@Child(name="proficiencyLevel", type=CodeableConceptDt.class, order=2, min=0, max=1)
@Description(
shortDefinition="Proficiency level of the language",
formalDefinition="A code that describes how well the language is spoken"
)
private CodeableConceptDt myProficiencyLevel;
@Child(name="preference", type=BooleanDt.class, order=3, min=0, max=1)
@Description(
shortDefinition="Language preference indicator",
formalDefinition="Indicates whether or not the Person prefers this language (over other languages he masters up a certain level)"
)
private BooleanDt myPreference;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLanguageElement, myMode, myProficiencyLevel, myPreference);
}
@Override
public java.util.List<IElement> getAllPopulatedChildElements() {
return getAllPopulatedChildElementsOfType(null);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myLanguageElement, myMode, myProficiencyLevel, myPreference);
}
/**
* Gets the value(s) for <b>language</b> (Language with optional region).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case. E.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English
* </p>
*/
public CodeableConceptDt getLanguageElement() {
if (myLanguageElement == null) {
myLanguageElement = new CodeableConceptDt();
}
return myLanguageElement;
}
/**
* Sets the value(s) for <b>language</b> (Language with optional region)
*
* <p>
* <b>Definition:</b>
* The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case. E.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English
* </p>
*/
public Language setLanguageElement(CodeableConceptDt theValue) {
myLanguageElement = theValue;
return this;
}
/**
* Gets the value(s) for <b>mode</b> (Language method of expression).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A value representing the person's method of expression of this language. Examples: expressed spoken, expressed written, expressed signed, received spoken, received written, received signed
* </p>
*/
public CodeableConceptDt getMode() {
if (myMode == null) {
myMode = new CodeableConceptDt();
}
return myMode;
}
/**
* Sets the value(s) for <b>mode</b> (Language method of expression)
*
* <p>
* <b>Definition:</b>
* A value representing the person's method of expression of this language. Examples: expressed spoken, expressed written, expressed signed, received spoken, received written, received signed
* </p>
*/
public Language setMode(CodeableConceptDt theValue) {
myMode = theValue;
return this;
}
/**
* Gets the value(s) for <b>proficiencyLevel</b> (Proficiency level of the language).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A code that describes how well the language is spoken
* </p>
*/
public CodeableConceptDt getProficiencyLevel() {
if (myProficiencyLevel == null) {
myProficiencyLevel = new CodeableConceptDt();
}
return myProficiencyLevel;
}
/**
* Sets the value(s) for <b>proficiencyLevel</b> (Proficiency level of the language)
*
* <p>
* <b>Definition:</b>
* A code that describes how well the language is spoken
* </p>
*/
public Language setProficiencyLevel(CodeableConceptDt theValue) {
myProficiencyLevel = theValue;
return this;
}
/**
* Gets the value(s) for <b>preference</b> (Language preference indicator).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Indicates whether or not the Person prefers this language (over other languages he masters up a certain level)
* </p>
*/
public BooleanDt getPreference() {
if (myPreference == null) {
myPreference = new BooleanDt();
}
return myPreference;
}
/**
* Sets the value(s) for <b>preference</b> (Language preference indicator)
*
* <p>
* <b>Definition:</b>
* Indicates whether or not the Person prefers this language (over other languages he masters up a certain level)
* </p>
*/
public Language setPreference(BooleanDt theValue) {
myPreference = theValue;
return this;
}
/**
* Sets the value for <b>preference</b> (Language preference indicator)
*
* <p>
* <b>Definition:</b>
* Indicates whether or not the Person prefers this language (over other languages he masters up a certain level)
* </p>
*/
public Language setPreference( boolean theBoolean) {
myPreference = new BooleanDt(theBoolean);
return this;
}
}
}

View File

@ -392,19 +392,6 @@ public class Remittance extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The percent of the service fee which would be elegible for coverage * The percent of the service fee which would be elegible for coverage
* </p>
*/
public Service setRate( long theValue) {
myRate = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>rate</b> (Benefit Rate %)
*
* <p>
* <b>Definition:</b>
* The percent of the service fee which would be elegible for coverage
* </p> * </p>
*/ */
public Service setRate( double theValue) { public Service setRate( double theValue) {
@ -425,6 +412,19 @@ public class Remittance extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>rate</b> (Benefit Rate %)
*
* <p>
* <b>Definition:</b>
* The percent of the service fee which would be elegible for coverage
* </p>
*/
public Service setRate( long theValue) {
myRate = new DecimalDt(theValue);
return this;
}
/** /**
* Gets the value(s) for <b>benefit</b> (Benefit amount). * Gets the value(s) for <b>benefit</b> (Benefit amount).
@ -462,19 +462,6 @@ public class Remittance extends BaseResource implements IResource {
* <p> * <p>
* <b>Definition:</b> * <b>Definition:</b>
* The amount payable for a submitted service (includes both professional and lab fees.) * The amount payable for a submitted service (includes both professional and lab fees.)
* </p>
*/
public Service setBenefit( long theValue) {
myBenefit = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>benefit</b> (Benefit amount)
*
* <p>
* <b>Definition:</b>
* The amount payable for a submitted service (includes both professional and lab fees.)
* </p> * </p>
*/ */
public Service setBenefit( double theValue) { public Service setBenefit( double theValue) {
@ -495,6 +482,19 @@ public class Remittance extends BaseResource implements IResource {
return this; return this;
} }
/**
* Sets the value for <b>benefit</b> (Benefit amount)
*
* <p>
* <b>Definition:</b>
* The amount payable for a submitted service (includes both professional and lab fees.)
* </p>
*/
public Service setBenefit( long theValue) {
myBenefit = new DecimalDt(theValue);
return this;
}
} }

View File

@ -717,24 +717,6 @@ public class Test extends BaseResource implements IResource {
* *
* </p> * </p>
* *
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Test addDecimalErr( long theValue) {
if (myDecimalErr == null) {
myDecimalErr = new java.util.ArrayList<DecimalDt>();
}
myDecimalErr.add(new DecimalDt(theValue));
return this;
}
/**
* Adds a new value for <b>decimalErr</b> (Decimals with invalid content)
*
* <p>
* <b>Definition:</b>
*
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining. * @return Returns a reference to this object, to allow for simple chaining.
*/ */
public Test addDecimalErr( double theValue) { public Test addDecimalErr( double theValue) {
@ -763,6 +745,24 @@ public class Test extends BaseResource implements IResource {
return this; return this;
} }
/**
* Adds a new value for <b>decimalErr</b> (Decimals with invalid content)
*
* <p>
* <b>Definition:</b>
*
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Test addDecimalErr( long theValue) {
if (myDecimalErr == null) {
myDecimalErr = new java.util.ArrayList<DecimalDt>();
}
myDecimalErr.add(new DecimalDt(theValue));
return this;
}
/** /**
* Gets the value(s) for <b>decimalCorr</b> (Decimals with correct content). * Gets the value(s) for <b>decimalCorr</b> (Decimals with correct content).
@ -831,24 +831,6 @@ public class Test extends BaseResource implements IResource {
* *
* </p> * </p>
* *
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Test addDecimalCorr( long theValue) {
if (myDecimalCorr == null) {
myDecimalCorr = new java.util.ArrayList<DecimalDt>();
}
myDecimalCorr.add(new DecimalDt(theValue));
return this;
}
/**
* Adds a new value for <b>decimalCorr</b> (Decimals with correct content)
*
* <p>
* <b>Definition:</b>
*
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining. * @return Returns a reference to this object, to allow for simple chaining.
*/ */
public Test addDecimalCorr( double theValue) { public Test addDecimalCorr( double theValue) {
@ -877,6 +859,24 @@ public class Test extends BaseResource implements IResource {
return this; return this;
} }
/**
* Adds a new value for <b>decimalCorr</b> (Decimals with correct content)
*
* <p>
* <b>Definition:</b>
*
* </p>
*
* @return Returns a reference to this object, to allow for simple chaining.
*/
public Test addDecimalCorr( long theValue) {
if (myDecimalCorr == null) {
myDecimalCorr = new java.util.ArrayList<DecimalDt>();
}
myDecimalCorr.add(new DecimalDt(theValue));
return this;
}
/** /**
* Gets the value(s) for <b>b64Err</b> (Binaries with invalid content). * Gets the value(s) for <b>b64Err</b> (Binaries with invalid content).

View File

@ -1,6 +1,10 @@
package ca.uhn.fhir.model.primitive; package ca.uhn.fhir.model.primitive;
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.*; import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.DAY;
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MILLI;
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MONTH;
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.SECOND;
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.YEAR;
import java.text.ParseException; import java.text.ParseException;
import java.util.Calendar; import java.util.Calendar;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.model.primitive; package ca.uhn.fhir.model.primitive;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.defaultString;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.model.primitive; package ca.uhn.fhir.model.primitive;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.defaultString;
import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.model.api.annotation.SimpleSetter;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.parser; package ca.uhn.fhir.parser;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.parser; package ca.uhn.fhir.parser;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.Reader; import java.io.Reader;
import java.io.StringWriter; import java.io.StringWriter;

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.method; package ca.uhn.fhir.rest.method;
import static org.apache.commons.lang3.StringUtils.*; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Collections; import java.util.Collections;

View File

@ -34,7 +34,7 @@ new FhirContextIntro().encodeMsg();
FhirContext ctx = new FhirContext(Patient.class, Observation.class); FhirContext ctx = new FhirContext(Patient.class, Observation.class);
//START SNIPPET: encodeMsg //START SNIPPET: encodeMsg
/* /**
* FHIR model types in HAPI are simple POJOs. To create a new * FHIR model types in HAPI are simple POJOs. To create a new
* one, invoke the default constructor and then * one, invoke the default constructor and then
* start populating values. * start populating values.
@ -53,10 +53,7 @@ name.addFamily("Tester");
name.addGiven("John"); name.addGiven("John");
name.addGiven("Q"); name.addGiven("Q");
/* // We can now use a parser to encode this resource into a string.
* We can now use a parser to encode this resource into
* a string.
*/
String encoded = ctx.newXmlParser().encodeResourceToString(patient); String encoded = ctx.newXmlParser().encodeResourceToString(patient);
System.out.println(encoded); System.out.println(encoded);
//END SNIPPET: encodeMsg //END SNIPPET: encodeMsg
@ -75,9 +72,7 @@ System.out.println(encoded);
FhirContext ctx = new FhirContext(Patient.class, Observation.class); FhirContext ctx = new FhirContext(Patient.class, Observation.class);
//START SNIPPET: parseMsg //START SNIPPET: parseMsg
/* // The following is an example Patient resource
* The following is an example Patient resource
*/
String msgString = "<Patient xmlns=\"http://hl7.org/fhir\">" String msgString = "<Patient xmlns=\"http://hl7.org/fhir\">"
+ "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal</div></text>" + "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal</div></text>"
+ "<identifier><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>" + "<identifier><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>"
@ -86,26 +81,20 @@ String msgString = "<Patient xmlns=\"http://hl7.org/fhir\">"
+ "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />" + "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />"
+ "</Patient>"; + "</Patient>";
/* // The hapi context object is used to create a new XML parser
* The hapi context object is used to create a new XML parser // instance. The parser can then be used to parse (or unmarshall) the
* instance. The parser can then be used to parse (or unmarshall) the // string message into a Patient object
* string message into a Patient object
*/
IParser parser = ctx.newXmlParser(); IParser parser = ctx.newXmlParser();
Patient patient = parser.parseResource(Patient.class, msgString); Patient patient = parser.parseResource(Patient.class, msgString);
/* // The patient object has accessor methods to retrieve all of the
* The patient object has accessor methods to retrieve all of the // data which has been parsed into the instance. All of the
* data which has been parsed into the instance. All of the // FHIR datatypes are represented by classes which end in "Dt".
* FHIR datatypes are represented by classes which end in "Dt".
*/
StringDt patientId = patient.getIdentifier().get(0).getValue(); StringDt patientId = patient.getIdentifier().get(0).getValue();
StringDt familyName = patient.getName().get(0).getFamily().get(0); StringDt familyName = patient.getName().get(0).getFamily().get(0);
CodeDt gender = patient.getGender().getCoding().get(0).getCode(); CodeDt gender = patient.getGender().getCoding().get(0).getCode();
/* // The various datatype classes have accessors called getValue()
* The various datatype classes have accessors called getValue()
*/
System.out.println(patientId.getValue()); // PRP1660 System.out.println(patientId.getValue()); // PRP1660
System.out.println(familyName.getValue()); // Cardinal System.out.println(familyName.getValue()); // Cardinal
System.out.println(gender.getValue()); // M System.out.println(gender.getValue()); // M

View File

@ -25,10 +25,8 @@ obs.setIssued(new InstantDt(new Date()));
obs.setIssued(new Date(), TemporalPrecisionEnum.MILLI); obs.setIssued(new Date(), TemporalPrecisionEnum.MILLI);
obs.setIssuedWithMillisPrecision(new Date()); obs.setIssuedWithMillisPrecision(new Date());
/* // The InstantDt also lets you work with the instant as a Java Date
* The InstantDt also lets you work with the instant as a Java Date // object or as a FHIR String.
* object or as a FHIR String.
*/
Date date = obs.getIssued().getValue(); // A date object Date date = obs.getIssued().getValue(); // A date object
String dateString = obs.getIssued().getValueAsString(); // "2014-03-08T12:59:58.068-05:00" String dateString = obs.getIssued().getValueAsString(); // "2014-03-08T12:59:58.068-05:00"
// END SNIPPET: datatypes // END SNIPPET: datatypes
@ -43,18 +41,14 @@ public void nonNull() {
// START SNIPPET: nonNull // START SNIPPET: nonNull
Observation observation = new Observation(); Observation observation = new Observation();
/* // None of these calls will return null, but instead create their respective
* None of these calls will return null, but instead create their respective // child elements.
* child elements.
*/
IdentifierDt identifierDt = observation.getIdentifier(); IdentifierDt identifierDt = observation.getIdentifier();
PeriodDt periodDt = observation.getIdentifier().getPeriod(); PeriodDt periodDt = observation.getIdentifier().getPeriod();
DateTimeDt activeDt = observation.getIdentifier().getPeriod().getStart(); DateTimeDt activeDt = observation.getIdentifier().getPeriod().getStart();
/* // DateTimeDt is a FHIR primitive however, so the following will return null
* DateTimeDt is a FHIR primitive however, so the following will return null // unless a value has been placed there.
* unless a value has been placed there.
*/
Date active = observation.getIdentifier().getPeriod().getStart().getValue(); Date active = observation.getIdentifier().getPeriod().getStart().getValue();
// END SNIPPET: nonNull // END SNIPPET: nonNull

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -25,6 +25,7 @@
<menu name="Welcome"> <menu name="Welcome">
<item name="Welcome" href="index.html" /> <item name="Welcome" href="index.html" />
<item name="Download" href="./download.html" />
</menu> </menu>
<menu name="Documentation"> <menu name="Documentation">

View File

@ -46,7 +46,7 @@
<p> <p>
To get started with HAPI FHIR, first download a copy and add it To get started with HAPI FHIR, first download a copy and add it
to your project. See the <a href="doc_download.html">Download Page</a> to your project. See the <a href="./download.html">Download Page</a>
for instructions. for instructions.
</p> </p>

View File

@ -26,12 +26,30 @@
</section> </section>
<section name="Why HAPI FHIR?"> <section name="What is HAPI FHIR?">
<p> <p>
HAPI FHIR is a simple-but-powerful library for adding FHIR messaging to your application. It HAPI FHIR is a simple-but-powerful library for adding FHIR messaging to your application. It
is pure Java (1.6+ compatible), and licensed under the business-friendly Apache Software is pure Java (1.6+ compatible), and licensed under the business-friendly Apache Software
License, version 2.0. License, version 2.0.
</p> </p>
<subsection name="Multiple Usage Patterns">
<p>
HAPI is designed with one main intent: providing a flexible way of adding
FHIR capability to applications. We at <a href="http://www.uhn.ca">University Health Network</a>
developed HAPI-FHIR to allow us to
build up our own unified FHIR RESTful server which exposes data backed by
a number of systems and repositories, so it is designed to be flexible
above all else.
</p>
<p>
The library is designed to support several main usage patterns:
<img src="images/hapi-usage.png" alt="HAPI Usage Patterns"/>
</p>
</subsection>
<subsection name="The Data Model">
<p> <p>
The HAPI API makes it very easy to create FHIR resources: The HAPI API makes it very easy to create FHIR resources:
</p> </p>
@ -44,7 +62,11 @@ patient.addName().addFamily("Smith").addGiven("John").addGiven("Q").addSuffix("J
patient.setGender(AdministrativeGenderCodesEnum.M);]]></source> patient.setGender(AdministrativeGenderCodesEnum.M);]]></source>
<p> <p>
This library supports both XML and JSON encoding natively: Both XML and JSON encoding are suported natively using a simple API
to pick between them. XML support is built on top of the lightning-fast
<a href="http://docs.oracle.com/javase/tutorial/jaxp/stax/why.html">STaX/JSR 173</a>
API, and JSON support is provided using the new
<a href="https://jcp.org/en/jsr/detail?id=353">javax.json/JSR-353</a> API.
</p> </p>
<source><![CDATA[FhirContext ctx = new FhirContext(); <source><![CDATA[FhirContext ctx = new FhirContext();
@ -75,6 +97,8 @@ String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);
<source><![CDATA[MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir"); <source><![CDATA[MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir");
IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135"); IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135");
List<Patient> clients = client.findPatientsByIdentifier(searchParam);]]></source> List<Patient> clients = client.findPatientsByIdentifier(searchParam);]]></source>
</subsection>
</section> </section>
</body> </body>

View File

@ -30,7 +30,7 @@ public class CustomThymeleafNarrativeGeneratorTest {
String actual = narrative.getDiv().getValueAsString(); String actual = narrative.getDiv().getValueAsString();
ourLog.info(actual); ourLog.info(actual);
assertThat(actual, containsString("<h1>Name</h1><div> given <b>FAM1 </b></div><h1>Address</h1><div><span>line1 </span><br/><span>line2 </span><br/></div></div>")); assertThat(actual, containsString("<h1>Name</h1><div class=\"nameElement\"> given <b>FAM1 </b></div><h1>Address</h1><div><span>line1 </span><br/><span>line2 </span><br/></div></div>"));
} }
} }

View File

@ -89,7 +89,7 @@
<baseResourceName>organization</baseResourceName> <baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName> <baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName> <baseResourceName>patient</baseResourceName>
<baseResourceName>person</baseResourceName> <!--<baseResourceName>person</baseResourceName>-->
<baseResourceName>practitioner</baseResourceName> <baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName> <baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName> <baseResourceName>profile</baseResourceName>

View File

@ -1,312 +0,0 @@
package ca.uhn.fhir.tinder;
import static org.apache.commons.lang.StringUtils.capitalize;
import static org.apache.commons.lang.StringUtils.isBlank;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoFailureException;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.dstu.resource.Profile;
import ca.uhn.fhir.model.dstu.resource.Profile.ExtensionDefn;
import ca.uhn.fhir.model.dstu.resource.Profile.Structure;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElement;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElementDefinition;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElementDefinitionType;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureSearchParam;
import ca.uhn.fhir.model.dstu.valueset.DataTypeEnum;
import ca.uhn.fhir.model.dstu.valueset.SlicingRulesEnum;
import ca.uhn.fhir.tinder.model.AnyChild;
import ca.uhn.fhir.tinder.model.BaseElement;
import ca.uhn.fhir.tinder.model.BaseRootType;
import ca.uhn.fhir.tinder.model.Child;
import ca.uhn.fhir.tinder.model.Extension;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.ResourceBlock;
import ca.uhn.fhir.tinder.model.SearchParameter;
import ca.uhn.fhir.tinder.model.SimpleChild;
import ca.uhn.fhir.tinder.model.Slicing;
public class CopyOfProfileParser extends BaseStructureParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CopyOfProfileParser.class);
private ExtensionDefn findExtension(Profile theProfile, String theCode) {
for (ExtensionDefn next : theProfile.getExtensionDefn()) {
if (theCode.equals(next.getCode().getValue())) {
return next;
}
}
return null;
}
@Override
protected String getFilenameSuffix() {
return "";
}
@Override
protected String getTemplate() {
return "/vm/resource.vm";
}
public void parseBaseResources(List<String> theBaseResourceNames) throws MojoFailureException {
FhirContext fhirContext = new FhirContext(Profile.class);
for (String nextFileName : theBaseResourceNames) {
ourLog.info("Parsing file: {}", nextFileName);
Profile profile;
try {
profile = (Profile) fhirContext.newXmlParser().parseResource(IOUtils.toString(new FileReader(nextFileName)));
} catch (Exception e) {
throw new MojoFailureException("Failed to load or parse file: " + nextFileName, e);
}
try {
parseSingleProfile(profile, "");
} catch (Exception e) {
throw new MojoFailureException("Failed to process file: " + nextFileName, e);
}
}
// for (int i = 0; i < theBaseResourceNames.size(); i++) {
// theBaseResourceNames.set(i,
// theBaseResourceNames.get(i).toLowerCase());
// }
//
// try {
//
// Bundle bundle =
// fhirContext.newXmlParser().parseBundle(IOUtils.toString(getClass().getResourceAsStream("/prof/allprofiles.xml")));
// TreeSet<String> allProfiles = new TreeSet<String>();
// for (BundleEntry nextResource : bundle.getEntries() ) {
// Profile nextProfile = (Profile) nextResource.getResource();
// allProfiles.add(nextProfile.getName().getValue());
// if
// (theBaseResourceNames.contains(nextProfile.getName().getValue().toLowerCase())){
// parseSingleProfile(nextProfile,
// bundle.getLinkBase().getValueNotNull());
// }
// }
//
// ourLog.info("Base profiles found: {}", allProfiles);
//
// } catch (Exception e) {
// throw new MojoFailureException("Failed to load base resources", e);
// }
}
public BaseRootType parseSingleProfile(Profile theProfile, String theUrlTOThisProfile) throws Exception {
BaseRootType retVal = null;
for (Structure nextStructure : theProfile.getStructure()) {
int elemIdx = 0;
boolean extensionsSliced = false;
SlicingRulesEnum extensionsSlicingIsOpen = SlicingRulesEnum.OPEN;
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
for (StructureElement next : nextStructure.getElement()) {
BaseElement elem;
if (elemIdx == 0) {
retVal = new Resource();
retVal.setProfile(theProfile.getIdentifier().getValue());
if (retVal.getProfile() == null) {
retVal.setProfile(theUrlTOThisProfile);
}
for (StructureSearchParam nextParam : nextStructure.getSearchParam()) {
SearchParameter param = new SearchParameter();
param.setName(nextParam.getName().getValue());
param.setPath(nextParam.getXpath().getValue());
param.setType(nextParam.getType().getValue());
param.setDescription(nextParam.getDocumentation().getValue());
retVal.getSearchParameters().add(param);
}
addResource(retVal);
elem = retVal;
// below StringUtils.isBlank(type) || type.startsWith("=")
} else {
if (next.getDefinition().getType().size() > 0 && next.getDefinition().getType().get(0).getCode().getValue().equals("Extension")) {
if (!next.getSlicing().isEmpty()) {
if (!"url".equals(next.getSlicing().getDiscriminator().getValue())) {
throw new ConfigurationException("Invalid extension slicing discriminator (must be 'url'): " + next.getSlicing().getDiscriminator().getValue());
}
extensionsSliced = true;
if (StringUtils.isNotBlank(next.getSlicing().getRules().getValueAsString())) {
extensionsSlicingIsOpen = next.getSlicing().getRules().getValueAsEnum();
if (extensionsSlicingIsOpen == null) {
throw new ConfigurationException("Invalid extension slicing rules: " + next.getSlicing().getRules().getValueAsString());
}
}
continue;
} else {
if (!extensionsSliced) {
continue;
}
if (next.getDefinition().getType().size() != 1) {
throw new ConfigurationException("Extension definition '" + next.getName().getValue() + "' has multiple type blocks. This is not supported.");
}
String extUrl = next.getDefinition().getType().get(0).getProfile().getValueAsString();
elem = new Extension(next.getName().getValue(), extUrl, "CodeDt");
}
} else {
if (next.getDefinition().getType().isEmpty()) {
elem = new ResourceBlock();
// } else if (type.startsWith("@")) {
// elem = new ResourceBlockCopy();
} else if (next.getDefinition().getType().get(0).getCode().getValue().equals("*")) {
elem = new AnyChild();
} else {
elem = new SimpleChild();
}
}
}
elem.setName(next.getPath().getValue());
elem.setElementNameAndDeriveParentElementName(next.getPath().getValue());
boolean allResourceReferences = next.getDefinition().getType().size() > 0;
for (StructureElementDefinitionType nextType : next.getDefinition().getType()) {
if (nextType.getCode().getValueAsEnum() != DataTypeEnum.RESOURCEREFERENCE) {
allResourceReferences = false;
}
}
elem.setResourceRef(allResourceReferences);
StructureElementDefinition definition = next.getDefinition();
BaseElement parentElement = elements.get(elem.getElementParentName());
Slicing childIsSliced = parentElement != null ? parentElement.getChildElementNameToSlicing().get(elem.getName()) : null;
if (next.getSlicing().getDiscriminator().getValue() != null) {
Slicing slicing = new Slicing();
slicing.setDiscriminator(next.getSlicing().getDiscriminator().getValue());
if (parentElement.getChildElementNameToSlicing().get(elem.getName()) != null) {
throw new ConfigurationException("Found multiple slicing definitions for path: " + next.getPath().getValue());
}
parentElement.getChildElementNameToSlicing().put(elem.getName(), slicing);
continue;
}
/*
* Profiles come with a number of standard elements which are generally ignored because they are boilerplate, unless the definition is somehow changing their behaviour (e.g. through
* slices)
*/
if (next.getPath().getValue().endsWith(".contained")) {
continue;
}
if (next.getPath().getValue().endsWith(".text")) {
continue;
}
if (next.getPath().getValue().endsWith(".extension")) {
if (childIsSliced != null) {
if (!"url".equals(childIsSliced.getDiscriminator())) {
throw new ConfigurationException("Extensions must be sliced on 'url' discriminator. Found: " + next.getSlicing().getDiscriminator().getValue());
}
if (next.getDefinition().getType().size() != 1 || next.getDefinition().getType().get(0).getCode().getValueAsEnum() != DataTypeEnum.EXTENSION) {
throw new ConfigurationException("Extension slices must have a single type with a code of 'Extension'");
}
String name = next.getName().getValue();
if (StringUtils.isBlank(name)) {
throw new ConfigurationException("Extension slices must have a 'name' defined, none found at path: " + next.getPath());
}
elem.setName(name);
elem.setElementName(name);
String profile = next.getDefinition().getType().get(0).getProfile().getValueAsString();
if (isBlank(profile)) {
throw new ConfigurationException("Extension slice for " + next.getPath().getValue() + " has no profile specified in its type");
}
if (profile.startsWith("#")) {
Profile.ExtensionDefn extension = findExtension(theProfile, profile.substring(1));
if (extension == null) {
throw new ConfigurationException("Unknown local extension reference: " + profile);
}
ourLog.info("Element at path {} is using extension {}", next.getPath(), profile);
definition = extension.getDefinition();
String extensionUrl = theUrlTOThisProfile + profile;
elem.setExtensionUrl(extensionUrl);
} else {
// TODO: implement this
throw new ConfigurationException("Extensions specified outside of the given profile are not yet supported");
}
} else {
continue;
}
}
if (next.getPath().getValue().endsWith(".modifierExtension")) {
continue;
}
for (StructureElementDefinitionType nextType : definition.getType()) {
if (nextType.getCode().getValueAsEnum() == DataTypeEnum.RESOURCEREFERENCE) {
if (nextType.getProfile().getValueAsString().startsWith("http://hl7.org/fhir/profiles/")) {
elem.getType().add(capitalize(nextType.getProfile().getValueAsString().substring("http://hl7.org/fhir/profiles/".length())));
} else {
// TODO: implement this.. we need to be able to
// reference other profiles
throw new ConfigurationException("Profile type not yet supported");
}
} else {
elem.getType().add(capitalize(nextType.getCode().getValue()) + "Dt");
}
}
elem.setBinding(definition.getBinding().getName().getValue());
elem.setShortName(definition.getShort().getValue());
elem.setDefinition(definition.getFormal().getValue());
elem.setRequirement(definition.getRequirements().getValue());
elem.setCardMin(definition.getMin().getValueAsString());
elem.setCardMax(definition.getMax().getValue());
if (elem instanceof Child) {
Child child = (Child) elem;
elements.put(elem.getName(), elem);
if (parentElement == null) {
throw new Exception("Can't find element " + elem.getElementParentName() + " - Valid values are: " + elements.keySet());
}
parentElement.addChild(child);
/*
* Find simple setters
*/
scanForSimpleSetters(child);
} else {
BaseRootType res = (BaseRootType) elem;
elements.put(res.getName(), res);
}
elemIdx++;
}
}
return retVal;
}
public static void main(String[] args) throws Exception {
String str = IOUtils.toString(Profile.class.getResourceAsStream("/tmp.txt"));
str = IOUtils.toString(new FileReader("../hapi-tinder-test/src/test/resources/profile/organization.xml"));
Profile prof = new FhirContext(Profile.class).newXmlParser().parseResource(Profile.class, str);
CopyOfProfileParser pp = new CopyOfProfileParser();
pp.parseSingleProfile(prof, "http://foo");
pp.markResourcesForImports();
pp.writeAll(new File("target/gen/test/resource"), "test");
}
}

View File

@ -51,9 +51,9 @@ public abstract class Child extends BaseElement {
if ("Class".equals(elementName)) { if ("Class".equals(elementName)) {
elementName = "ClassElement"; elementName = "ClassElement";
} }
if ("Language".equals(elementName)) { // if ("Language".equals(elementName)) {
elementName = "LanguageElement"; // elementName = "LanguageElement";
} // }
return elementName; return elementName;
} }

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0.jar" sourcepath="M2_REPO/javax/json/javax.json-api/1.0/javax.json-api-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar" sourcepath="M2_REPO/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-base/0.1/hapi-fhir-base-0.1.jar" sourcepath="M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-base/0.1/hapi-fhir-base-0.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-base/0.1/hapi-fhir-base-0.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar" sourcepath="M2_REPO/org/glassfish/javax.json/1.0.4/javax.json-1.0.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0.jar" sourcepath="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar" sourcepath="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar" sourcepath="M2_REPO/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.9/commons-codec-1.9.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.9/commons-codec-1.9-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.4/commons-io-2.4.jar" sourcepath="M2_REPO/commons-io/commons-io/2.4/commons-io-2.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.jar" sourcepath="M2_REPO/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-core/1.1.1/logback-core-1.1.1.jar" sourcepath="M2_REPO/ch/qos/logback/logback-core/1.1.1/logback-core-1.1.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/ch/qos/logback/logback-core/1.1.1/logback-core-1.1.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
</classpath>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>restful-server-example</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
#Thu Apr 03 09:37:42 EDT 2014
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.compliance=1.6

View File

@ -0,0 +1,55 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.example</groupId>
<artifactId>restful-server-example</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<name>Sample RESTful Server</name>
<dependencies>
<!-- This dependency includes all neccesary HAPI FHIR classes -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.1</version>
</dependency>
<!-- HAPI-FHIR uses Logback for logging support. The logback library is
included automatically by Maven as a part of the hapi-fhir-base dependency,
but you also need to include a logging library. Logback is used here, but
log4j would also be fine. -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Needed for JEE/Servlet support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,46 @@
package ca.uhn.example.rest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.servlet.annotation.WebServlet;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
/**
* In this example, we are using Servlet 3.0 annotations to define
* the URL pattern for this servlet, but we could also
* define this in a web.xml file.
*/
@WebServlet(urlPatterns= {"/fhir/*"}, displayName="FHIR Server")
public class ExampleRestfulServlet extends RestfulServer {
private static final long serialVersionUID = 1L;
/**
* Constructor
*/
public ExampleRestfulServlet() {
// Use a narrative generator
setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
}
/**
* Restful servers must provide an implementation of this method, which
* returns all resource providers to be used by this server. In the example
* below, we are creating a RESTful server which is able to serve
* Patient and Observation resources.
*/
@Override
public Collection<IResourceProvider> getResourceProviders() {
List<IResourceProvider> retVal = new ArrayList<IResourceProvider>();
retVal.add(new RestfulPatientResourceProvider());
retVal.add(new RestfulObservationResourceProvider());
return retVal;
}
}

View File

@ -0,0 +1,88 @@
package ca.uhn.example.rest;
import java.util.Collections;
import java.util.List;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Read;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.server.IResourceProvider;
//START SNIPPET: provider
/**
* All resource providers must implement IResourceProvider
*/
public class RestfulObservationResourceProvider implements IResourceProvider {
/**
* The getResourceType method comes from IResourceProvider, and must
* be overridden to indicate what type of resource this provider
* supplies.
*/
@Override
public Class<Patient> getResourceType() {
return Patient.class;
}
/**
* The "@Read" annotation indicates that this method supports the
* read operation. It takes one argument, the Resource type being returned.
*
* @param theId
* The read operation takes one parameter, which must be of type
* IdDt and must be annotated with the "@Read.IdParam" annotation.
* @return
* Returns a resource matching this identifier, or null if none exists.
*/
@Read()
public Patient getResourceById(@IdParam IdDt theId) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00002");
patient.addName().addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderCodesEnum.F);
return patient;
}
/**
* The "@Search" annotation indicates that this method supports the
* search operation. You may have many different method annotated with
* this annotation, to support many different search criteria. This
* example searches by family name.
*
* @param theIdentifier
* This operation takes one parameter which is the search criteria. It is
* annotated with the "@Required" annotation. This annotation takes one argument,
* a string containing the name of the search criteria. The datatype here
* is StringDt, but there are other possible parameter types depending on the
* specific search criteria.
* @return
* This method returns a list of Patients. This list may contain multiple
* matching resources, or it may also be empty.
*/
@Search()
public List<Patient> getPatient(@RequiredParam(name = Patient.SP_FAMILY) StringDt theFamilyName) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setUse(IdentifierUseEnum.OFFICIAL);
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00001");
patient.addName();
patient.getName().get(0).addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.getGender().setText("M");
return Collections.singletonList(patient);
}
}
//END SNIPPET: provider

View File

@ -0,0 +1,91 @@
package ca.uhn.example.rest;
import java.util.Collections;
import java.util.List;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Read;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.server.IResourceProvider;
//START SNIPPET: provider
/**
* All resource providers must implement IResourceProvider
*/
public class RestfulPatientResourceProvider implements IResourceProvider {
/**
* The getResourceType method comes from IResourceProvider, and must
* be overridden to indicate what type of resource this provider
* supplies.
*/
@Override
public Class<Patient> getResourceType() {
return Patient.class;
}
/**
* The "@Read" annotation indicates that this method supports the
* read operation. Read operations should return a single resource
* instance.
*
* @param theId
* The read operation takes one parameter, which must be of type
* IdDt and must be annotated with the "@Read.IdParam" annotation.
* @return
* Returns a resource matching this identifier, or null if none exists.
*/
@Read()
public Patient getResourceById(@IdParam IdDt theId) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00002");
patient.addName().addFamily("Test");
patient.getName().get(0).addGiven("PatientOne");
patient.setGender(AdministrativeGenderCodesEnum.F);
return patient;
}
/**
* The "@Search" annotation indicates that this method supports the
* search operation. You may have many different method annotated with
* this annotation, to support many different search criteria. This
* example searches by family name.
*
* @param theIdentifier
* This operation takes one parameter which is the search criteria. It is
* annotated with the "@Required" annotation. This annotation takes one argument,
* a string containing the name of the search criteria. The datatype here
* is StringDt, but there are other possible parameter types depending on the
* specific search criteria.
* @return
* This method returns a list of Patients. This list may contain multiple
* matching resources, or it may also be empty.
*/
@Search()
public List<Patient> getPatient(@RequiredParam(name = Patient.SP_FAMILY) StringDt theFamilyName) {
Patient patient = new Patient();
patient.addIdentifier();
patient.getIdentifier().get(0).setUse(IdentifierUseEnum.OFFICIAL);
patient.getIdentifier().get(0).setSystem(new UriDt("urn:hapitest:mrns"));
patient.getIdentifier().get(0).setValue("00001");
patient.addName();
patient.getName().get(0).addFamily(theFamilyName.getValue());
patient.getName().get(0).addGiven("PatientOne");
patient.getGender().setText("M");
return Collections.singletonList(patient);
}
}
//END SNIPPET: provider

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://java.sun.com/xml/ns/javaee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="3.0">
<xsd:annotation>
<xsd:documentation>
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
The contents of this file are subject to the terms of either the
GNU General Public License Version 2 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with
the License. You can obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL.html or
glassfish/bootstrap/legal/LICENSE.txt. See the License for the
specific language governing permissions and limitations under the
License.
When distributing the software, include this License Header
Notice in each file and include the License file at
glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
particular file as subject to the "Classpath" exception as
provided by Sun in the GPL Version 2 section of the License file
that accompanied this code. If applicable, add the following
below the License Header, with the fields enclosed by brackets []
replaced by your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the
CDDL or only the GPL Version 2, indicate your decision by adding
"[Contributor] elects to include this software in this
distribution under the [CDDL or GPL Version 2] license." If you
don't indicate a single choice of license, a recipient has the
option to distribute your version of this file under either the
CDDL, the GPL Version 2 or to extend the choice of license to its
licensees as provided above. However, if you add GPL Version 2
code and therefore, elected the GPL Version 2 license, then the
option applies only if the new code is made subject to such
option by the copyright holder.
</xsd:documentation>
</xsd:annotation>
<xsd:annotation>
<xsd:documentation>
<![CDATA[[
This is the XML Schema for the Servlet 3.0 deployment descriptor.
The deployment descriptor must be named "WEB-INF/web.xml" in the
web application's war file. All Servlet deployment descriptors
must indicate the web application schema by using the Java EE
namespace:
http://java.sun.com/xml/ns/javaee
and by indicating the version of the schema by
using the version element as shown below:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="..."
version="3.0">
...
</web-app>
The instance documents may indicate the published version of
the schema using the xsi:schemaLocation attribute for Java EE
namespace with the following location:
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
]]>
</xsd:documentation>
</xsd:annotation>
<xsd:annotation>
<xsd:documentation>
The following conventions apply to all Java EE
deployment descriptor elements unless indicated otherwise.
- In elements that specify a pathname to a file within the
same JAR file, relative filenames (i.e., those not
starting with "/") are considered relative to the root of
the JAR file's namespace. Absolute filenames (i.e., those
starting with "/") also specify names in the root of the
JAR file's namespace. In general, relative names are
preferred. The exception is .war files where absolute
names are preferred for consistency with the Servlet API.
</xsd:documentation>
</xsd:annotation>
<xsd:include schemaLocation="web-common_3_0.xsd"/>
<!-- **************************************************** -->
<xsd:element name="web-app"
type="javaee:web-appType">
<xsd:annotation>
<xsd:documentation>
The web-app element is the root of the deployment
descriptor for a web application. Note that the sub-elements
of this element can be in the arbitrary order. Because of
that, the multiplicity of the elements of distributable,
session-config, welcome-file-list, jsp-config, login-config,
and locale-encoding-mapping-list was changed from "?" to "*"
in this schema. However, the deployment descriptor instance
file must not contain multiple elements of session-config,
jsp-config, and login-config. When there are multiple elements of
welcome-file-list or locale-encoding-mapping-list, the container
must concatenate the element contents. The multiple occurence
of the element distributable is redundant and the container
treats that case exactly in the same way when there is only
one distributable.
</xsd:documentation>
</xsd:annotation>
<xsd:unique name="web-common-servlet-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The servlet element contains the name of a servlet.
The name must be unique within the web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:servlet"/>
<xsd:field xpath="javaee:servlet-name"/>
</xsd:unique>
<xsd:unique name="web-common-filter-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The filter element contains the name of a filter.
The name must be unique within the web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:filter"/>
<xsd:field xpath="javaee:filter-name"/>
</xsd:unique>
<xsd:unique name="web-common-ejb-local-ref-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The ejb-local-ref-name element contains the name of an EJB
reference. The EJB reference is an entry in the web
application's environment and is relative to the
java:comp/env context. The name must be unique within
the web application.
It is recommended that name is prefixed with "ejb/".
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:ejb-local-ref"/>
<xsd:field xpath="javaee:ejb-ref-name"/>
</xsd:unique>
<xsd:unique name="web-common-ejb-ref-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The ejb-ref-name element contains the name of an EJB
reference. The EJB reference is an entry in the web
application's environment and is relative to the
java:comp/env context. The name must be unique within
the web application.
It is recommended that name is prefixed with "ejb/".
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:ejb-ref"/>
<xsd:field xpath="javaee:ejb-ref-name"/>
</xsd:unique>
<xsd:unique name="web-common-resource-env-ref-uniqueness">
<xsd:annotation>
<xsd:documentation>
The resource-env-ref-name element specifies the name of
a resource environment reference; its value is the
environment entry name used in the web application code.
The name is a JNDI name relative to the java:comp/env
context and must be unique within a web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:resource-env-ref"/>
<xsd:field xpath="javaee:resource-env-ref-name"/>
</xsd:unique>
<xsd:unique name="web-common-message-destination-ref-uniqueness">
<xsd:annotation>
<xsd:documentation>
The message-destination-ref-name element specifies the name of
a message destination reference; its value is the
environment entry name used in the web application code.
The name is a JNDI name relative to the java:comp/env
context and must be unique within a web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:message-destination-ref"/>
<xsd:field xpath="javaee:message-destination-ref-name"/>
</xsd:unique>
<xsd:unique name="web-common-res-ref-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The res-ref-name element specifies the name of a
resource manager connection factory reference. The name
is a JNDI name relative to the java:comp/env context.
The name must be unique within a web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:resource-ref"/>
<xsd:field xpath="javaee:res-ref-name"/>
</xsd:unique>
<xsd:unique name="web-common-env-entry-name-uniqueness">
<xsd:annotation>
<xsd:documentation>
The env-entry-name element contains the name of a web
application's environment entry. The name is a JNDI
name relative to the java:comp/env context. The name
must be unique within a web application.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:env-entry"/>
<xsd:field xpath="javaee:env-entry-name"/>
</xsd:unique>
<xsd:key name="web-common-role-name-key">
<xsd:annotation>
<xsd:documentation>
A role-name-key is specified to allow the references
from the security-role-refs.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:security-role"/>
<xsd:field xpath="javaee:role-name"/>
</xsd:key>
<xsd:keyref name="web-common-role-name-references"
refer="javaee:web-common-role-name-key">
<xsd:annotation>
<xsd:documentation>
The keyref indicates the references from
security-role-ref to a specified role-name.
</xsd:documentation>
</xsd:annotation>
<xsd:selector xpath="javaee:servlet/javaee:security-role-ref"/>
<xsd:field xpath="javaee:role-link"/>
</xsd:keyref>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,12 @@
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ./web-app_3_0.xsd">
<!--
Nothing needs to be here, since the servlet class contains
annotations describing its mapping.
-->
</web-app>

View File

@ -0,0 +1 @@
/classes