Enumerated types
This commit is contained in:
parent
42d8037a06
commit
1fab951815
|
@ -219,14 +219,14 @@ class ModelScanner {
|
||||||
scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef);
|
scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < 0) {
|
// while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < 0) {
|
||||||
BaseRuntimeDeclaredChildDefinition elementDef = orderToElementDef.remove(orderToElementDef.firstKey());
|
// BaseRuntimeDeclaredChildDefinition elementDef = orderToElementDef.remove(orderToElementDef.firstKey());
|
||||||
if (elementDef.getElementName().equals("identifier")) {
|
// if (elementDef.getElementName().equals("identifier")) {
|
||||||
orderToElementDef.put(theIdentifierOrder, elementDef);
|
// orderToElementDef.put(theIdentifierOrder, elementDef);
|
||||||
} else {
|
// } else {
|
||||||
throw new ConfigurationException("Don't know how to handle element: " + elementDef.getElementName());
|
// throw new ConfigurationException("Don't know how to handle element: " + elementDef.getElementName());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
TreeSet<Integer> orders = new TreeSet<Integer>();
|
TreeSet<Integer> orders = new TreeSet<Integer>();
|
||||||
orders.addAll(orderToElementDef.keySet());
|
orders.addAll(orderToElementDef.keySet());
|
||||||
|
@ -247,6 +247,8 @@ class ModelScanner {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void scanCompositeElementForChildren(Class<? extends ICompositeElement> theClass, BaseRuntimeElementCompositeDefinition<?> theDefinition, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef, TreeMap<Integer,BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
|
private void scanCompositeElementForChildren(Class<? extends ICompositeElement> theClass, BaseRuntimeElementCompositeDefinition<?> theDefinition, Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef, TreeMap<Integer,BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
|
||||||
|
int baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1;
|
||||||
|
|
||||||
for (Field next : theClass.getDeclaredFields()) {
|
for (Field next : theClass.getDeclaredFields()) {
|
||||||
|
|
||||||
Narrative hasNarrative = next.getAnnotation(Narrative.class);
|
Narrative hasNarrative = next.getAnnotation(Narrative.class);
|
||||||
|
@ -268,7 +270,7 @@ class ModelScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
String elementName = element.name();
|
String elementName = element.name();
|
||||||
int order = element.order();
|
int order = element.order() + baseElementOrder;
|
||||||
int min = element.min();
|
int min = element.min();
|
||||||
int max = element.max();
|
int max = element.max();
|
||||||
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderMap = theOrderToElementDef;
|
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderMap = theOrderToElementDef;
|
||||||
|
@ -294,7 +296,7 @@ class ModelScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderMap.containsKey(order)) {
|
if (orderMap.containsKey(order)) {
|
||||||
throw new ConfigurationException("Detected duplicate field order '" + order + "' for element named '" + elementName + "' in type '" + theClass.getCanonicalName() + "'");
|
throw new ConfigurationException("Detected duplicate field order '" + element.order() + "' for element named '" + elementName + "' in type '" + theClass.getCanonicalName() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementNames.contains(elementName)) {
|
if (elementNames.contains(elementName)) {
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package ca.uhn.fhir.model.api;
|
|
||||||
|
|
||||||
|
|
||||||
public class BaseCompositeDatatype extends BaseDatatype implements ICompositeDatatype {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
package ca.uhn.fhir.model.api;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class BaseDatatype implements IDatatype {
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,6 +15,4 @@ public abstract class BaseElement implements IElement, ISupportsUndeclaredExtens
|
||||||
return myUndeclaredExtensions;
|
return myUndeclaredExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package ca.uhn.fhir.model.api;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract class BasePrimitiveDatatype<T> extends BaseDatatype implements IPrimitiveDatatype<T> {
|
|
||||||
|
|
||||||
// nothing yet
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||||
|
|
||||||
|
public class BaseResource extends BaseElement implements IResource {
|
||||||
|
|
||||||
|
@Child(name="text", order=0, min=0, max=1)
|
||||||
|
private XhtmlDt myText;
|
||||||
|
|
||||||
|
public XhtmlDt getText() {
|
||||||
|
if (myText == null) {
|
||||||
|
myText = new XhtmlDt();
|
||||||
|
}
|
||||||
|
return myText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(XhtmlDt theText) {
|
||||||
|
myText = theText;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,14 @@ public class UndeclaredExtension extends BaseElement {
|
||||||
private String myUrl;
|
private String myUrl;
|
||||||
private IElement myValue;
|
private IElement myValue;
|
||||||
|
|
||||||
|
public UndeclaredExtension() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UndeclaredExtension(String theUrl) {
|
||||||
|
myUrl=theUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return myUrl;
|
return myUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class ValueSetEnumeration {
|
||||||
|
|
||||||
|
private static final Map<Class<? extends ValueSetEnumeration>, CodeMap> myClassToCodeMap = new HashMap<>();
|
||||||
|
|
||||||
|
private final String myCode;
|
||||||
|
private final int myOrdinal;
|
||||||
|
|
||||||
|
public ValueSetEnumeration(String theCode, String theValueSetIdentifier) {
|
||||||
|
myCode = theCode;
|
||||||
|
|
||||||
|
CodeMap codeMap = myClassToCodeMap.get(getClass());
|
||||||
|
if (codeMap == null) {
|
||||||
|
codeMap = new CodeMap(theValueSetIdentifier);
|
||||||
|
myClassToCodeMap.put(getClass(), codeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
myOrdinal = codeMap.nextOrdinal();
|
||||||
|
codeMap.addCode(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class CodeMap
|
||||||
|
{
|
||||||
|
private Map<String, ValueSetEnumeration> myCodeMap = new HashMap<String, ValueSetEnumeration>();
|
||||||
|
private String myValueSetIdentifier;
|
||||||
|
private int myNextOrdinal = 0;
|
||||||
|
|
||||||
|
public CodeMap(String theValueSetIdentifier) {
|
||||||
|
myValueSetIdentifier = theValueSetIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNextOrdinal() {
|
||||||
|
return myNextOrdinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextOrdinal() {
|
||||||
|
return myNextOrdinal++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCode(ValueSetEnumeration theValueSetEnumeration) {
|
||||||
|
myCodeMap.put(theValueSetEnumeration.getCode(), theValueSetEnumeration);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return myCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="Address")
|
@DatatypeDef(name="Address")
|
||||||
public class AddressDt extends BaseCompositeDatatype {
|
public class AddressDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="use", type=CodeDt.class, order=0, min=0, max=1)
|
@Child(name="use", type=CodeDt.class, order=0, min=0, max=1)
|
||||||
private CodeDt myUse;
|
private CodeDt myUse;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="Contact")
|
@DatatypeDef(name="Contact")
|
||||||
public class ContactDt extends BaseCompositeDatatype {
|
public class ContactDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="system", type=CodeDt.class, order=0, min=0, max=1)
|
@Child(name="system", type=CodeDt.class, order=0, min=0, max=1)
|
||||||
private CodeDt mySystem;
|
private CodeDt mySystem;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="HumanName")
|
@DatatypeDef(name="HumanName")
|
||||||
public class HumanNameDt extends BaseCompositeDatatype {
|
public class HumanNameDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="use", type=CodeDt.class, order=0, min=0, max=1)
|
@Child(name="use", type=CodeDt.class, order=0, min=0, max=1)
|
||||||
private CodeDt myUse;
|
private CodeDt myUse;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="Narrative")
|
@DatatypeDef(name="Narrative")
|
||||||
public class NarrativeDt extends BaseCompositeDatatype {
|
public class NarrativeDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="status", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="status", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myStatus;
|
private CodeDt myStatus;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="Quantity")
|
@DatatypeDef(name="Quantity")
|
||||||
public class QuantityDt extends BaseCompositeDatatype {
|
public class QuantityDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="value", type=DecimalDt.class, order=0, min=0, max=1)
|
@Child(name="value", type=DecimalDt.class, order=0, min=0, max=1)
|
||||||
private DecimalDt myValue;
|
private DecimalDt myValue;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Device")
|
@ResourceDef(name="Device")
|
||||||
public class Device implements IResource {
|
public class Device extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Group")
|
@ResourceDef(name="Group")
|
||||||
public class Group implements IResource {
|
public class Group extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||||
private IdentifierDt myIdentifier;
|
private IdentifierDt myIdentifier;
|
||||||
|
@ -327,7 +327,7 @@ public class Group implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Group.characteristic")
|
@Block(name="Group.characteristic")
|
||||||
public static class Characteristic implements IResourceBlock {
|
public static class Characteristic extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||||
private CodeableConceptDt myCode;
|
private CodeableConceptDt myCode;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Location")
|
@ResourceDef(name="Location")
|
||||||
public class Location implements IResource {
|
public class Location extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||||
private IdentifierDt myIdentifier;
|
private IdentifierDt myIdentifier;
|
||||||
|
@ -472,7 +472,7 @@ public class Location implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Location.position")
|
@Block(name="Location.position")
|
||||||
public static class Position implements IResourceBlock {
|
public static class Position extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="longitude", type=DecimalDt.class, order=0, min=1, max=1)
|
@Child(name="longitude", type=DecimalDt.class, order=0, min=1, max=1)
|
||||||
private DecimalDt myLongitude;
|
private DecimalDt myLongitude;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Medication")
|
@ResourceDef(name="Medication")
|
||||||
public class Medication implements IResource {
|
public class Medication extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="name", type=StringDt.class, order=0, min=0, max=1)
|
@Child(name="name", type=StringDt.class, order=0, min=0, max=1)
|
||||||
private StringDt myName;
|
private StringDt myName;
|
||||||
|
@ -293,7 +293,7 @@ public class Medication implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Medication.product")
|
@Block(name="Medication.product")
|
||||||
public static class Product implements IResourceBlock {
|
public static class Product extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="form", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
@Child(name="form", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
||||||
private CodeableConceptDt myForm;
|
private CodeableConceptDt myForm;
|
||||||
|
@ -373,7 +373,7 @@ public class Medication implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Medication.product.ingredient")
|
@Block(name="Medication.product.ingredient")
|
||||||
public static class ProductIngredient implements IResourceBlock {
|
public static class ProductIngredient extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="item", order=0, min=1, max=1)
|
@Child(name="item", order=0, min=1, max=1)
|
||||||
@ChildResource(types= {
|
@ChildResource(types= {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Observation")
|
@ResourceDef(name="Observation")
|
||||||
public class Observation implements IResource {
|
public class Observation extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="name", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
@Child(name="name", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||||
private CodeableConceptDt myName;
|
private CodeableConceptDt myName;
|
||||||
|
@ -600,7 +600,7 @@ public class Observation implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Observation.referenceRange")
|
@Block(name="Observation.referenceRange")
|
||||||
public static class ReferenceRange implements IResourceBlock {
|
public static class ReferenceRange extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="low", type=QuantityDt.class, order=0, min=0, max=1)
|
@Child(name="low", type=QuantityDt.class, order=0, min=0, max=1)
|
||||||
private QuantityDt myLow;
|
private QuantityDt myLow;
|
||||||
|
@ -747,7 +747,7 @@ public class Observation implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Observation.related")
|
@Block(name="Observation.related")
|
||||||
public static class Related implements IResourceBlock {
|
public static class Related extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="type", type=CodeDt.class, order=0, min=0, max=1)
|
@Child(name="type", type=CodeDt.class, order=0, min=0, max=1)
|
||||||
private CodeDt myType;
|
private CodeDt myType;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Organization")
|
@ResourceDef(name="Organization")
|
||||||
public class Organization implements IResource {
|
public class Organization extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
@ -362,7 +362,7 @@ public class Organization implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Organization.contact")
|
@Block(name="Organization.contact")
|
||||||
public static class Contact implements IResourceBlock {
|
public static class Contact extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="purpose", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
@Child(name="purpose", type=CodeableConceptDt.class, order=0, min=0, max=1)
|
||||||
private CodeableConceptDt myPurpose;
|
private CodeableConceptDt myPurpose;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Patient")
|
@ResourceDef(name="Patient")
|
||||||
public class Patient implements IResource {
|
public class Patient extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
@ -624,7 +624,7 @@ public class Patient implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Patient.contact")
|
@Block(name="Patient.contact")
|
||||||
public static class Contact implements IResourceBlock {
|
public static class Contact extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="relationship", type=CodeableConceptDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="relationship", type=CodeableConceptDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<CodeableConceptDt> myRelationship;
|
private List<CodeableConceptDt> myRelationship;
|
||||||
|
@ -840,7 +840,7 @@ public class Patient implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Patient.animal")
|
@Block(name="Patient.animal")
|
||||||
public static class Animal implements IResourceBlock {
|
public static class Animal extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="species", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
@Child(name="species", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||||
private CodeableConceptDt mySpecies;
|
private CodeableConceptDt mySpecies;
|
||||||
|
@ -954,7 +954,7 @@ public class Patient implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Patient.link")
|
@Block(name="Patient.link")
|
||||||
public static class Link implements IResourceBlock {
|
public static class Link extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="other", order=0, min=1, max=1)
|
@Child(name="other", order=0, min=1, max=1)
|
||||||
@ChildResource(types= {
|
@ChildResource(types= {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Practitioner")
|
@ResourceDef(name="Practitioner")
|
||||||
public class Practitioner implements IResource {
|
public class Practitioner extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
@ -527,7 +527,7 @@ public class Practitioner implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Practitioner.qualification")
|
@Block(name="Practitioner.qualification")
|
||||||
public static class Qualification implements IResourceBlock {
|
public static class Qualification extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
@Child(name="code", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||||
private CodeableConceptDt myCode;
|
private CodeableConceptDt myCode;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Profile")
|
@ResourceDef(name="Profile")
|
||||||
public class Profile implements IResource {
|
public class Profile extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=StringDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=StringDt.class, order=0, min=0, max=1)
|
||||||
private StringDt myIdentifier;
|
private StringDt myIdentifier;
|
||||||
|
@ -664,7 +664,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.mapping")
|
@Block(name="Profile.mapping")
|
||||||
public static class Mapping implements IResourceBlock {
|
public static class Mapping extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="identity", type=IdDt.class, order=0, min=1, max=1)
|
@Child(name="identity", type=IdDt.class, order=0, min=1, max=1)
|
||||||
private IdDt myIdentity;
|
private IdDt myIdentity;
|
||||||
|
@ -844,7 +844,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure")
|
@Block(name="Profile.structure")
|
||||||
public static class Structure implements IResourceBlock {
|
public static class Structure extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="type", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="type", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myType;
|
private CodeDt myType;
|
||||||
|
@ -1078,7 +1078,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element")
|
@Block(name="Profile.structure.element")
|
||||||
public static class StructureElement implements IResourceBlock {
|
public static class StructureElement extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="path", type=StringDt.class, order=0, min=1, max=1)
|
@Child(name="path", type=StringDt.class, order=0, min=1, max=1)
|
||||||
private StringDt myPath;
|
private StringDt myPath;
|
||||||
|
@ -1279,7 +1279,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.slicing")
|
@Block(name="Profile.structure.element.slicing")
|
||||||
public static class StructureElementSlicing implements IResourceBlock {
|
public static class StructureElementSlicing extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="discriminator", type=IdDt.class, order=0, min=1, max=1)
|
@Child(name="discriminator", type=IdDt.class, order=0, min=1, max=1)
|
||||||
private IdDt myDiscriminator;
|
private IdDt myDiscriminator;
|
||||||
|
@ -1404,7 +1404,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.definition")
|
@Block(name="Profile.structure.element.definition")
|
||||||
public static class StructureElementDefinition implements IResourceBlock {
|
public static class StructureElementDefinition extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="short", type=StringDt.class, order=0, min=1, max=1)
|
@Child(name="short", type=StringDt.class, order=0, min=1, max=1)
|
||||||
private StringDt myShort;
|
private StringDt myShort;
|
||||||
|
@ -2100,7 +2100,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.definition.type")
|
@Block(name="Profile.structure.element.definition.type")
|
||||||
public static class StructureElementDefinitionType implements IResourceBlock {
|
public static class StructureElementDefinitionType extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myCode;
|
private CodeDt myCode;
|
||||||
|
@ -2214,7 +2214,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.definition.constraint")
|
@Block(name="Profile.structure.element.definition.constraint")
|
||||||
public static class StructureElementDefinitionConstraint implements IResourceBlock {
|
public static class StructureElementDefinitionConstraint extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="key", type=IdDt.class, order=0, min=1, max=1)
|
@Child(name="key", type=IdDt.class, order=0, min=1, max=1)
|
||||||
private IdDt myKey;
|
private IdDt myKey;
|
||||||
|
@ -2438,7 +2438,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.definition.binding")
|
@Block(name="Profile.structure.element.definition.binding")
|
||||||
public static class StructureElementDefinitionBinding implements IResourceBlock {
|
public static class StructureElementDefinitionBinding extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
||||||
private StringDt myName;
|
private StringDt myName;
|
||||||
|
@ -2640,7 +2640,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.element.definition.mapping")
|
@Block(name="Profile.structure.element.definition.mapping")
|
||||||
public static class StructureElementDefinitionMapping implements IResourceBlock {
|
public static class StructureElementDefinitionMapping extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="identity", type=IdDt.class, order=0, min=1, max=1)
|
@Child(name="identity", type=IdDt.class, order=0, min=1, max=1)
|
||||||
private IdDt myIdentity;
|
private IdDt myIdentity;
|
||||||
|
@ -2745,7 +2745,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.structure.searchParam")
|
@Block(name="Profile.structure.searchParam")
|
||||||
public static class StructureSearchParam implements IResourceBlock {
|
public static class StructureSearchParam extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
||||||
private StringDt myName;
|
private StringDt myName;
|
||||||
|
@ -2959,7 +2959,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.extensionDefn")
|
@Block(name="Profile.extensionDefn")
|
||||||
public static class ExtensionDefn implements IResourceBlock {
|
public static class ExtensionDefn extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myCode;
|
private CodeDt myCode;
|
||||||
|
@ -3164,7 +3164,7 @@ public class Profile implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Profile.query")
|
@Block(name="Profile.query")
|
||||||
public static class Query implements IResourceBlock {
|
public static class Query extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
@Child(name="name", type=StringDt.class, order=0, min=1, max=1)
|
||||||
private StringDt myName;
|
private StringDt myName;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Specimen")
|
@ResourceDef(name="Specimen")
|
||||||
public class Specimen implements IResource {
|
public class Specimen extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
@ -359,7 +359,7 @@ public class Specimen implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Specimen.source")
|
@Block(name="Specimen.source")
|
||||||
public static class Source implements IResourceBlock {
|
public static class Source extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="relationship", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="relationship", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myRelationship;
|
private CodeDt myRelationship;
|
||||||
|
@ -443,7 +443,7 @@ public class Specimen implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Specimen.collection")
|
@Block(name="Specimen.collection")
|
||||||
public static class Collection implements IResourceBlock {
|
public static class Collection extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="collector", order=0, min=0, max=1)
|
@Child(name="collector", order=0, min=0, max=1)
|
||||||
@ChildResource(types= {
|
@ChildResource(types= {
|
||||||
|
@ -673,7 +673,7 @@ public class Specimen implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Specimen.treatment")
|
@Block(name="Specimen.treatment")
|
||||||
public static class Treatment implements IResourceBlock {
|
public static class Treatment extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="description", type=StringDt.class, order=0, min=0, max=1)
|
@Child(name="description", type=StringDt.class, order=0, min=0, max=1)
|
||||||
private StringDt myDescription;
|
private StringDt myDescription;
|
||||||
|
@ -801,7 +801,7 @@ public class Specimen implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Specimen.container")
|
@Block(name="Specimen.container")
|
||||||
public static class Container implements IResourceBlock {
|
public static class Container extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<IdentifierDt> myIdentifier;
|
private List<IdentifierDt> myIdentifier;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Substance")
|
@ResourceDef(name="Substance")
|
||||||
public class Substance implements IResource {
|
public class Substance extends BaseElement implements IResource {
|
||||||
|
|
||||||
@Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
@Child(name="type", type=CodeableConceptDt.class, order=0, min=1, max=1)
|
||||||
private CodeableConceptDt myType;
|
private CodeableConceptDt myType;
|
||||||
|
@ -191,7 +191,7 @@ public class Substance implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Substance.instance")
|
@Block(name="Substance.instance")
|
||||||
public static class Instance implements IResourceBlock {
|
public static class Instance extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||||
private IdentifierDt myIdentifier;
|
private IdentifierDt myIdentifier;
|
||||||
|
@ -316,7 +316,7 @@ public class Substance implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="Substance.ingredient")
|
@Block(name="Substance.ingredient")
|
||||||
public static class Ingredient implements IResourceBlock {
|
public static class Ingredient extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="quantity", type=RatioDt.class, order=0, min=0, max=1)
|
@Child(name="quantity", type=RatioDt.class, order=0, min=0, max=1)
|
||||||
private RatioDt myQuantity;
|
private RatioDt myQuantity;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="ValueSet")
|
@ResourceDef(name="ValueSet")
|
||||||
public class ValueSet implements IResource {
|
public class ValueSet extends BaseResource implements IResource {
|
||||||
|
|
||||||
@Child(name="identifier", type=StringDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=StringDt.class, order=0, min=0, max=1)
|
||||||
private StringDt myIdentifier;
|
private StringDt myIdentifier;
|
||||||
|
@ -81,21 +81,6 @@ public class ValueSet implements IResource {
|
||||||
@Child(name="expansion", order=13, min=0, max=1)
|
@Child(name="expansion", order=13, min=0, max=1)
|
||||||
private Expansion myExpansion;
|
private Expansion myExpansion;
|
||||||
|
|
||||||
@Child(name="text", order=14, min=0, max=1)
|
|
||||||
private NarrativeDt myText;
|
|
||||||
|
|
||||||
|
|
||||||
public NarrativeDt getText() {
|
|
||||||
if(myText==null) {
|
|
||||||
myText=new NarrativeDt();
|
|
||||||
}
|
|
||||||
return myText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(NarrativeDt theText) {
|
|
||||||
myText = theText;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value(s) for <b>identifier</b> (Logical id to reference this value set).
|
* Gets the value(s) for <b>identifier</b> (Logical id to reference this value set).
|
||||||
* creating it if it does
|
* creating it if it does
|
||||||
|
@ -604,7 +589,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.define")
|
@Block(name="ValueSet.define")
|
||||||
public static class Define implements IResourceBlock {
|
public static class Define extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="system", type=UriDt.class, order=0, min=1, max=1)
|
@Child(name="system", type=UriDt.class, order=0, min=1, max=1)
|
||||||
private UriDt mySystem;
|
private UriDt mySystem;
|
||||||
|
@ -761,7 +746,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.define.concept")
|
@Block(name="ValueSet.define.concept")
|
||||||
public static class DefineConcept implements IResourceBlock {
|
public static class DefineConcept extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="code", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myCode;
|
private CodeDt myCode;
|
||||||
|
@ -964,7 +949,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.compose")
|
@Block(name="ValueSet.compose")
|
||||||
public static class Compose implements IResourceBlock {
|
public static class Compose extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="import", type=UriDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="import", type=UriDt.class, order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<UriDt> myImport;
|
private List<UriDt> myImport;
|
||||||
|
@ -1077,7 +1062,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.compose.include")
|
@Block(name="ValueSet.compose.include")
|
||||||
public static class ComposeInclude implements IResourceBlock {
|
public static class ComposeInclude extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="system", type=UriDt.class, order=0, min=1, max=1)
|
@Child(name="system", type=UriDt.class, order=0, min=1, max=1)
|
||||||
private UriDt mySystem;
|
private UriDt mySystem;
|
||||||
|
@ -1234,7 +1219,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.compose.include.filter")
|
@Block(name="ValueSet.compose.include.filter")
|
||||||
public static class ComposeIncludeFilter implements IResourceBlock {
|
public static class ComposeIncludeFilter extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="property", type=CodeDt.class, order=0, min=1, max=1)
|
@Child(name="property", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private CodeDt myProperty;
|
private CodeDt myProperty;
|
||||||
|
@ -1350,7 +1335,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.expansion")
|
@Block(name="ValueSet.expansion")
|
||||||
public static class Expansion implements IResourceBlock {
|
public static class Expansion extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
@Child(name="identifier", type=IdentifierDt.class, order=0, min=0, max=1)
|
||||||
private IdentifierDt myIdentifier;
|
private IdentifierDt myIdentifier;
|
||||||
|
@ -1463,7 +1448,7 @@ public class ValueSet implements IResource {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="ValueSet.expansion.contains")
|
@Block(name="ValueSet.expansion.contains")
|
||||||
public static class ExpansionContains implements IResourceBlock {
|
public static class ExpansionContains extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
@Child(name="system", type=UriDt.class, order=0, min=0, max=1)
|
@Child(name="system", type=UriDt.class, order=0, min=0, max=1)
|
||||||
private UriDt mySystem;
|
private UriDt mySystem;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
|
||||||
@DatatypeDef(name="Attachment")
|
@DatatypeDef(name="Attachment")
|
||||||
public class AttachmentDt extends BaseCompositeDatatype {
|
public class AttachmentDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="contentType", order=0, min=1)
|
@Child(name="contentType", order=0, min=1)
|
||||||
private CodeDt myContentType;
|
private CodeDt myContentType;
|
||||||
|
|
|
@ -2,11 +2,12 @@ package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
|
||||||
@DatatypeDef(name = "base64Binary")
|
@DatatypeDef(name = "base64Binary")
|
||||||
public class Base64BinaryDt extends BasePrimitiveDatatype<byte[]> {
|
public class Base64BinaryDt extends BaseElement implements IPrimitiveDatatype<byte[]> {
|
||||||
|
|
||||||
private byte[] myValue;
|
private byte[] myValue;
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,12 @@ import javax.xml.bind.DatatypeConverter;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.FastDateFormat;
|
import org.apache.commons.lang3.time.FastDateFormat;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
public abstract class BaseDateTimeDt extends BasePrimitiveDatatype<Date> {
|
public abstract class BaseDateTimeDt extends BaseElement implements IPrimitiveDatatype<Date> {
|
||||||
|
|
||||||
private static final FastDateFormat ourYearFormat = FastDateFormat.getInstance("yyyy");
|
private static final FastDateFormat ourYearFormat = FastDateFormat.getInstance("yyyy");
|
||||||
private static final FastDateFormat ourYearMonthDayFormat = FastDateFormat.getInstance("yyyy-MM-dd");
|
private static final FastDateFormat ourYearMonthDayFormat = FastDateFormat.getInstance("yyyy-MM-dd");
|
||||||
|
@ -135,7 +136,7 @@ public abstract class BaseDateTimeDt extends BasePrimitiveDatatype<Date> {
|
||||||
if (dotIndex == -1 && !isPrecisionAllowed(SECOND)) {
|
if (dotIndex == -1 && !isPrecisionAllowed(SECOND)) {
|
||||||
throw new DataFormatException("Invalid date/time string (data type does not support SECONDS precision)");
|
throw new DataFormatException("Invalid date/time string (data type does not support SECONDS precision)");
|
||||||
} else if (dotIndex > -1 && !isPrecisionAllowed(MILLI)) {
|
} else if (dotIndex > -1 && !isPrecisionAllowed(MILLI)) {
|
||||||
throw new DataFormatException("Invalid date/time string (data type does not support MILLIS precision)");
|
throw new DataFormatException("Invalid date/time string (data type " + getClass().getSimpleName() + " does not support MILLIS precision)");
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar cal;
|
Calendar cal;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "boolean")
|
@DatatypeDef(name = "boolean")
|
||||||
public class BooleanDt extends BasePrimitiveDatatype<Boolean> {
|
public class BooleanDt extends BaseElement implements IPrimitiveDatatype<Boolean> {
|
||||||
|
|
||||||
private Boolean myValue;
|
private Boolean myValue;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "code")
|
@DatatypeDef(name = "code")
|
||||||
public class CodeDt extends BasePrimitiveDatatype<String> implements ICodedDatatype, IPrimitiveDatatype<String> {
|
public class CodeDt extends BaseElement implements IPrimitiveDatatype<String>, ICodedDatatype {
|
||||||
|
|
||||||
private String myValue;
|
private String myValue;
|
||||||
|
|
||||||
|
@ -18,13 +18,8 @@ public class CodeDt extends BasePrimitiveDatatype<String> implements ICodedDatat
|
||||||
if (theValue == null) {
|
if (theValue == null) {
|
||||||
myValue = null;
|
myValue = null;
|
||||||
} else {
|
} else {
|
||||||
if (theValue.length() == 0) {
|
String newValue = theValue.trim();
|
||||||
throw new DataFormatException("Value can not be empty");
|
myValue = newValue;
|
||||||
}
|
|
||||||
if (Character.isWhitespace(theValue.charAt(0)) || Character.isWhitespace(theValue.charAt(theValue.length()-1))){
|
|
||||||
throw new DataFormatException("Value must not contain trailing or leading whitespace");
|
|
||||||
}
|
|
||||||
myValue = theValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
|
||||||
@DatatypeDef(name="CodeableConcept")
|
@DatatypeDef(name="CodeableConcept")
|
||||||
public class CodeableConceptDt extends BaseCompositeDatatype implements ICodedDatatype {
|
public class CodeableConceptDt extends BaseElement implements ICodedDatatype, ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="coding", order=0, min=0, max=Child.MAX_UNLIMITED)
|
@Child(name="coding", order=0, min=0, max=Child.MAX_UNLIMITED)
|
||||||
private List<CodingDt> myCoding;
|
private List<CodingDt> myCoding;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.ResourceReference;
|
import ca.uhn.fhir.model.api.ResourceReference;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.ChildResource;
|
import ca.uhn.fhir.model.api.annotation.ChildResource;
|
||||||
|
@ -9,7 +10,7 @@ import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
||||||
|
|
||||||
|
|
||||||
@DatatypeDef(name="Coding")
|
@DatatypeDef(name="Coding")
|
||||||
public class CodingDt extends BaseCompositeDatatype {
|
public class CodingDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="system", order=0)
|
@Child(name="system", order=0)
|
||||||
private UriDt mySystem;
|
private UriDt mySystem;
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class DateTimeDt extends BaseDateTimeDt {
|
||||||
case MONTH:
|
case MONTH:
|
||||||
case DAY:
|
case DAY:
|
||||||
case SECOND:
|
case SECOND:
|
||||||
|
case MILLI:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,12 +2,13 @@ package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "decimal")
|
@DatatypeDef(name = "decimal")
|
||||||
public class DecimalDt extends BasePrimitiveDatatype<BigDecimal> {
|
public class DecimalDt extends BaseElement implements IPrimitiveDatatype<BigDecimal> {
|
||||||
|
|
||||||
private BigDecimal myValue;
|
private BigDecimal myValue;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
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;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "id")
|
@DatatypeDef(name = "id")
|
||||||
public class IdDt extends BasePrimitiveDatatype<String> {
|
public class IdDt extends BaseElement implements IPrimitiveDatatype<String> {
|
||||||
|
|
||||||
private String myValue;
|
private String myValue;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
import ca.uhn.fhir.model.api.CodeableConceptElement;
|
import ca.uhn.fhir.model.api.CodeableConceptElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.ResourceReference;
|
import ca.uhn.fhir.model.api.ResourceReference;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.ChildResource;
|
import ca.uhn.fhir.model.api.annotation.ChildResource;
|
||||||
|
@ -10,7 +11,7 @@ import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||||
import ca.uhn.fhir.model.enm.IdentifierUseEnum;
|
import ca.uhn.fhir.model.enm.IdentifierUseEnum;
|
||||||
|
|
||||||
@DatatypeDef(name="identifier")
|
@DatatypeDef(name="identifier")
|
||||||
public class IdentifierDt extends BaseCompositeDatatype {
|
public class IdentifierDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="use", order=0)
|
@Child(name="use", order=0)
|
||||||
@CodeableConceptElement(type=IdentifierUseEnum.class)
|
@CodeableConceptElement(type=IdentifierUseEnum.class)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name="integer")
|
@DatatypeDef(name="integer")
|
||||||
public class IntegerDt extends BasePrimitiveDatatype<Integer> {
|
public class IntegerDt extends BaseElement implements IPrimitiveDatatype<Integer> {
|
||||||
|
|
||||||
private Integer myValue;
|
private Integer myValue;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
import ca.uhn.fhir.model.api.annotation.Constraint;
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Constraint;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
|
||||||
@DatatypeDef(name="Period")
|
@DatatypeDef(name="Period")
|
||||||
public class PeriodDt extends BaseCompositeDatatype {
|
public class PeriodDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="start", order=0)
|
@Child(name="start", order=0)
|
||||||
@Constraint(lessThan= {"end"})
|
@Constraint(lessThan= {"end"})
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Constraint;
|
import ca.uhn.fhir.model.api.annotation.Constraint;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||||
|
|
||||||
@DatatypeDef(name="Range")
|
@DatatypeDef(name="Range")
|
||||||
public class RangeDt extends BaseCompositeDatatype {
|
public class RangeDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="low", order=0)
|
@Child(name="low", order=0)
|
||||||
@Constraint(lessThan= {"high"})
|
@Constraint(lessThan= {"high"})
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Constraint;
|
import ca.uhn.fhir.model.api.annotation.Constraint;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||||
|
|
||||||
@DatatypeDef(name="Ratio")
|
@DatatypeDef(name="Ratio")
|
||||||
public class RatioDt extends BaseCompositeDatatype {
|
public class RatioDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="numerator", order=0)
|
@Child(name="numerator", order=0)
|
||||||
@Constraint(coRequirements= {"denominator"})
|
@Constraint(coRequirements= {"denominator"})
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
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.dstu.composite.QuantityDt;
|
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||||
|
|
||||||
@DatatypeDef(name="SampledData")
|
@DatatypeDef(name="SampledData")
|
||||||
public class SampledDataDt extends BaseCompositeDatatype {
|
public class SampledDataDt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
@Child(name="origin", order=0, min=1)
|
@Child(name="origin", order=0, min=1)
|
||||||
private QuantityDt myOrigin;
|
private QuantityDt myOrigin;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package ca.uhn.fhir.model.primitive;
|
package ca.uhn.fhir.model.primitive;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BasePrimitiveDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
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;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "string")
|
@DatatypeDef(name = "string")
|
||||||
public class StringDt extends BasePrimitiveDatatype<String> {
|
public class StringDt extends BaseElement implements IPrimitiveDatatype<String> {
|
||||||
|
|
||||||
private String myValue;
|
private String myValue;
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package ca.uhn.fhir.model.primitive;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.BaseDatatype;
|
import ca.uhn.fhir.model.api.BaseElement;
|
||||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
||||||
@DatatypeDef(name = "uri")
|
@DatatypeDef(name = "uri")
|
||||||
public class UriDt extends BaseDatatype implements IPrimitiveDatatype<URI> {
|
public class UriDt extends BaseElement implements IPrimitiveDatatype<URI> {
|
||||||
|
|
||||||
private URI myValue;
|
private URI myValue;
|
||||||
|
|
||||||
|
|
|
@ -342,12 +342,13 @@ class ParserState<T extends IElement> {
|
||||||
*/
|
*/
|
||||||
public void enteringNewElementExtension(@SuppressWarnings("unused") StartElement theElement, String theUrlAttr) {
|
public void enteringNewElementExtension(@SuppressWarnings("unused") StartElement theElement, String theUrlAttr) {
|
||||||
if (getCurrentElement() instanceof ISupportsUndeclaredExtensions) {
|
if (getCurrentElement() instanceof ISupportsUndeclaredExtensions) {
|
||||||
UndeclaredExtension newExtension = new UndeclaredExtension();
|
UndeclaredExtension newExtension = new UndeclaredExtension(theUrlAttr);
|
||||||
newExtension.setUrl(theUrlAttr);
|
|
||||||
// TODO: fail if we don't support undeclared extensions
|
// TODO: fail if we don't support undeclared extensions
|
||||||
((ISupportsUndeclaredExtensions) getCurrentElement()).getUndeclaredExtensions().add(newExtension);
|
((ISupportsUndeclaredExtensions) getCurrentElement()).getUndeclaredExtensions().add(newExtension);
|
||||||
ExtensionState newState = new ExtensionState(newExtension);
|
ExtensionState newState = new ExtensionState(newExtension);
|
||||||
push(newState);
|
push(newState);
|
||||||
|
} else {
|
||||||
|
throw new DataFormatException("Extension is not supported at this position");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,6 +720,15 @@ class ParserState<T extends IElement> {
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void enteringNewElementExtension(StartElement theElement, String theUrlAttr) {
|
||||||
|
// if (myInstance instanceof ISupportsUndeclaredExtensions) {
|
||||||
|
// UndeclaredExtension ext = new UndeclaredExtension(theUrlAttr);
|
||||||
|
// ((ISupportsUndeclaredExtensions) myInstance).getUndeclaredExtensions().add(ext);
|
||||||
|
// push(new ExtensionState(ext));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||||
throw new Error("?? can this happen?"); // TODO: can this happen?
|
throw new Error("?? can this happen?"); // TODO: can this happen?
|
||||||
|
|
|
@ -129,8 +129,7 @@ public class XmlParser {
|
||||||
return stringWriter.toString();
|
return stringWriter.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl)
|
private boolean encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl) throws XMLStreamException, DataFormatException {
|
||||||
throws XMLStreamException, DataFormatException {
|
|
||||||
switch (childDef.getChildType()) {
|
switch (childDef.getChildType()) {
|
||||||
case PRIMITIVE_DATATYPE: {
|
case PRIMITIVE_DATATYPE: {
|
||||||
IPrimitiveDatatype<?> pd = (IPrimitiveDatatype<?>) nextValue;
|
IPrimitiveDatatype<?> pd = (IPrimitiveDatatype<?>) nextValue;
|
||||||
|
@ -188,8 +187,7 @@ public class XmlParser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encodeCompositeElementChildrenToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children) throws XMLStreamException,
|
private void encodeCompositeElementChildrenToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children) throws XMLStreamException, DataFormatException {
|
||||||
DataFormatException {
|
|
||||||
for (BaseRuntimeChildDefinition nextChild : children) {
|
for (BaseRuntimeChildDefinition nextChild : children) {
|
||||||
List<? extends IElement> values = nextChild.getAccessor().getValues(theElement);
|
List<? extends IElement> values = nextChild.getAccessor().getValues(theElement);
|
||||||
if (values == null || values.isEmpty()) {
|
if (values == null || values.isEmpty()) {
|
||||||
|
@ -220,8 +218,7 @@ public class XmlParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encodeCompositeElementToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef) throws XMLStreamException,
|
private void encodeCompositeElementToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef) throws XMLStreamException, DataFormatException {
|
||||||
DataFormatException {
|
|
||||||
encodeExtensionsIfPresent(theEventWriter, theElement);
|
encodeExtensionsIfPresent(theEventWriter, theElement);
|
||||||
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getExtensions());
|
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getExtensions());
|
||||||
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getChildren());
|
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getChildren());
|
||||||
|
@ -402,6 +399,7 @@ public class XmlParser {
|
||||||
try {
|
try {
|
||||||
while (streamReader.hasNext()) {
|
while (streamReader.hasNext()) {
|
||||||
XMLEvent nextEvent = streamReader.nextEvent();
|
XMLEvent nextEvent = streamReader.nextEvent();
|
||||||
|
try {
|
||||||
if (nextEvent.isStartElement()) {
|
if (nextEvent.isStartElement()) {
|
||||||
StartElement elem = nextEvent.asStartElement();
|
StartElement elem = nextEvent.asStartElement();
|
||||||
|
|
||||||
|
@ -423,7 +421,8 @@ public class XmlParser {
|
||||||
for (@SuppressWarnings("unchecked")
|
for (@SuppressWarnings("unchecked")
|
||||||
Iterator<Attribute> iter = elem.getAttributes(); iter.hasNext();) {
|
Iterator<Attribute> iter = elem.getAttributes(); iter.hasNext();) {
|
||||||
Attribute next = iter.next();
|
Attribute next = iter.next();
|
||||||
// if (next.getName().getLocalPart().equals("value")) {
|
// if
|
||||||
|
// (next.getName().getLocalPart().equals("value")) {
|
||||||
parserState.attributeValue(next.getName().getLocalPart(), next.getValue());
|
parserState.attributeValue(next.getName().getLocalPart(), next.getValue());
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
@ -437,7 +436,8 @@ public class XmlParser {
|
||||||
|
|
||||||
String name = elem.getName().getLocalPart();
|
String name = elem.getName().getLocalPart();
|
||||||
String namespaceURI = elem.getName().getNamespaceURI();
|
String namespaceURI = elem.getName().getNamespaceURI();
|
||||||
// if (!FHIR_NS.equals(namespaceURI) && !XHTML_NS.equals(namespaceURI)) {
|
// if (!FHIR_NS.equals(namespaceURI) &&
|
||||||
|
// !XHTML_NS.equals(namespaceURI)) {
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -451,8 +451,10 @@ public class XmlParser {
|
||||||
|
|
||||||
parserState.xmlEvent(nextEvent);
|
parserState.xmlEvent(nextEvent);
|
||||||
|
|
||||||
|
} catch (DataFormatException e) {
|
||||||
|
throw new DataFormatException("DataFormatException at [" + nextEvent.getLocation().toString() + "]: "+e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (XMLStreamException e) {
|
} catch (XMLStreamException e) {
|
||||||
throw new DataFormatException(e);
|
throw new DataFormatException(e);
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||||
|
<classpathentry kind="src" path="target/generated/valuesets"/>
|
||||||
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
|
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
|
||||||
<classpathentry kind="src" path="src/main/resources"/>
|
<classpathentry kind="src" path="src/main/resources"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||||
<classpathentry kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0/cdi-api-1.0-sources.jar">
|
<classpathentry kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0/cdi-api-1.0-sources.jar">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="javadoc_location" value="jar:file:/Users/james/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0-javadoc.jar!/"/>
|
<attribute name="javadoc_location" value="jar:file:/Users/james/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0-javadoc.jar!/"/>
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
#Thu Feb 20 12:55:51 EST 2014
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class ResourceParser extends BaseParser {
|
||||||
|
|
||||||
p.setDirectory("src/test/resources/res");
|
p.setDirectory("src/test/resources/res");
|
||||||
p.setResourceName("valueset");
|
p.setResourceName("valueset");
|
||||||
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java");
|
p.setOutputFile("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSetTm.java");
|
||||||
p.parse();
|
p.parse();
|
||||||
|
|
||||||
p.setDirectory("src/test/resources/res");
|
p.setDirectory("src/test/resources/res");
|
||||||
|
|
|
@ -1,14 +1,30 @@
|
||||||
package ca.uhn.fhir.starter;
|
package ca.uhn.fhir.starter;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang.StringUtils.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
import org.apache.velocity.VelocityContext;
|
||||||
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
|
import ca.uhn.fhir.model.api.BundleEntry;
|
||||||
import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
||||||
import ca.uhn.fhir.model.dstu.resource.ValueSet.DefineConcept;
|
import ca.uhn.fhir.model.dstu.resource.ValueSet.DefineConcept;
|
||||||
|
import ca.uhn.fhir.starter.model.ValueSetTm;
|
||||||
|
import ca.uhn.fhir.starter.model.ValueSetTm.Code;
|
||||||
|
|
||||||
public class ValueSetParser {
|
public class ValueSetParser {
|
||||||
|
|
||||||
|
@ -20,22 +36,104 @@ public class ValueSetParser {
|
||||||
|
|
||||||
ValueSetParser p = new ValueSetParser();
|
ValueSetParser p = new ValueSetParser();
|
||||||
p.setDirectory("src/test/resources/vs/");
|
p.setDirectory("src/test/resources/vs/");
|
||||||
// p.setBundle()
|
// p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
|
||||||
// p.setValueSetName("administrative-gender");
|
p.setOutputDirectory("target/generated/valuesets/ca/uhn/fhir/model/dstu/valueset");
|
||||||
p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
|
|
||||||
p.parse();
|
p.parse();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parse() throws FileNotFoundException, IOException {
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValueSetParser.class);
|
||||||
String string = IOUtils.toString(new FileReader(myDirectory + "valueset-" + myValueSetName + ".xml"));
|
|
||||||
ValueSet input = (ValueSet) new FhirContext(ValueSet.class).newXmlParser().parseResource(string);
|
|
||||||
ca.uhn.fhir.starter.model.ValueSet output = new ca.uhn.fhir.starter.model.ValueSet();
|
|
||||||
|
|
||||||
for (DefineConcept next : input.getDefine().getConcept()) {
|
private void parse() throws FileNotFoundException, IOException {
|
||||||
// output.addConcept(next.getCode().getValue(), next.getDisplay().getValue(), next.getDefinition());
|
String string = IOUtils.toString(new FileReader(myDirectory + "valuesets.xml"));
|
||||||
|
Bundle bundle = new FhirContext(ValueSet.class).newXmlParser().parseBundle(string);
|
||||||
|
|
||||||
|
int vsCount = 0;
|
||||||
|
int conceptCount = 0;
|
||||||
|
List<ca.uhn.fhir.starter.model.ValueSetTm> valueSets = new ArrayList<>();
|
||||||
|
for (BundleEntry next : bundle.getEntries()) {
|
||||||
|
ValueSet nextVs = (ValueSet) next.getResource();
|
||||||
|
conceptCount += nextVs.getDefine().getConcept().size();
|
||||||
|
ourLog.info("Parsing ValueSetTm #{} - {} - {} concepts total", vsCount++, nextVs.getName().getValue(), conceptCount);
|
||||||
|
// output.addConcept(next.getCode().getValue(),
|
||||||
|
// next.getDisplay().getValue(), next.getDefinition());
|
||||||
|
|
||||||
|
ValueSetTm vs = new ValueSetTm();
|
||||||
|
valueSets.add(vs);
|
||||||
|
|
||||||
|
vs.setName(nextVs.getName().getValue());
|
||||||
|
vs.setDescription(nextVs.getDescription().getValue());
|
||||||
|
vs.setId(nextVs.getIdentifier().getValue());
|
||||||
|
vs.setClassName(toClassName(nextVs.getName().getValue()));
|
||||||
|
|
||||||
|
for (DefineConcept nextConcept : nextVs.getDefine().getConcept()) {
|
||||||
|
String nextCodeValue = nextConcept.getCode().getValue();
|
||||||
|
String nextCodeDisplay = StringUtils.defaultString(nextConcept.getDisplay().getValue());
|
||||||
|
String nextCodeDefinition = StringUtils.defaultString(nextConcept.getDefinition().getValue());
|
||||||
|
|
||||||
|
vs.getCodes().add(new Code(nextCodeValue, nextCodeDisplay, nextCodeDefinition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vsCount > 5) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
write(valueSets);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(List<ValueSetTm> theValueSets) throws IOException {
|
||||||
|
for (ValueSetTm nextValueSetTm : theValueSets) {
|
||||||
|
write(nextValueSetTm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void write(ValueSetTm theValueSetTm) throws IOException {
|
||||||
|
File targetDir = new File(myOutputDirectory);
|
||||||
|
if (!targetDir.exists()) {
|
||||||
|
targetDir.mkdirs();
|
||||||
|
}
|
||||||
|
if (!targetDir.isDirectory()) {
|
||||||
|
throw new IOException(myOutputDirectory + " is not a directory");
|
||||||
|
}
|
||||||
|
|
||||||
|
File f = new File(myOutputDirectory, theValueSetTm.getClassName() + ".java");
|
||||||
|
FileWriter w = new FileWriter(f, false);
|
||||||
|
|
||||||
|
ourLog.info("Writing file: {}", f.getAbsolutePath());
|
||||||
|
|
||||||
|
VelocityContext ctx = new VelocityContext();
|
||||||
|
ctx.put("valueSet", theValueSetTm);
|
||||||
|
|
||||||
|
VelocityEngine v = new VelocityEngine();
|
||||||
|
v.setProperty("resource.loader", "cp");
|
||||||
|
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
||||||
|
v.setProperty("runtime.references.strict", Boolean.TRUE);
|
||||||
|
|
||||||
|
InputStream templateIs = ResourceParser.class.getResourceAsStream("/valueset.vm");
|
||||||
|
InputStreamReader templateReader = new InputStreamReader(templateIs);
|
||||||
|
v.evaluate(ctx, w, "", templateReader);
|
||||||
|
|
||||||
|
w.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toClassName(String theValue) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
for (String next : theValue.split("\\s+")) {
|
||||||
|
next = next.trim();
|
||||||
|
if (StringUtils.isBlank(next)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (next.startsWith("(") && next.endsWith(")")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isAllUpperCase(next)) {
|
||||||
|
next = WordUtils.capitalize(next);
|
||||||
|
}
|
||||||
|
b.append(WordUtils.capitalize(next));
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOutputDirectory(String theString) {
|
private void setOutputDirectory(String theString) {
|
||||||
|
@ -50,5 +148,4 @@ public class ValueSetParser {
|
||||||
myDirectory = theString;
|
myDirectory = theString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package ca.uhn.fhir.starter.model;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ValueSet {
|
|
||||||
|
|
||||||
private List<Code> myCodes = new ArrayList<Code>();
|
|
||||||
|
|
||||||
public void addConcept(String theCode, String theText, String theDefinition) {
|
|
||||||
myCodes.add(new Code(theCode, theText, theDefinition));
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Code> getCodes() {
|
|
||||||
return myCodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Code
|
|
||||||
{
|
|
||||||
|
|
||||||
private String myCode;
|
|
||||||
private String myDefinition;
|
|
||||||
private String myText;
|
|
||||||
|
|
||||||
public Code(String theCode, String theText, String theDefinition) {
|
|
||||||
myCode =theCode;
|
|
||||||
myText = theText;
|
|
||||||
myDefinition = theDefinition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return myCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefinition() {
|
|
||||||
return myDefinition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return myText;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package ca.uhn.fhir.starter.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
|
public class ValueSetTm {
|
||||||
|
|
||||||
|
private String myClassName;
|
||||||
|
private List<Code> myCodes = new ArrayList<Code>();
|
||||||
|
private String myDescription;
|
||||||
|
private String myId;
|
||||||
|
private String myName;
|
||||||
|
|
||||||
|
public void addConcept(String theCode, String theText, String theDefinition) {
|
||||||
|
myCodes.add(new Code(theCode, theText, theDefinition));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return myClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Code> getCodes() {
|
||||||
|
return myCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return StringUtils.defaultString(myDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return myId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return StringUtils.defaultString(myName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassName(String theClassName) {
|
||||||
|
myClassName = theClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodes(List<Code> theCodes) {
|
||||||
|
myCodes = theCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String theDescription) {
|
||||||
|
myDescription = theDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String theId) {
|
||||||
|
myId = theId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String theName) {
|
||||||
|
myName = theName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Code
|
||||||
|
{
|
||||||
|
|
||||||
|
private String myCode;
|
||||||
|
private String myDefinition;
|
||||||
|
private String myDisplay;
|
||||||
|
|
||||||
|
public Code(String theCode, String theDisplay, String theDefinition) {
|
||||||
|
myCode =theCode.trim();
|
||||||
|
myDisplay = theDisplay;
|
||||||
|
myDefinition = theDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return myCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodeEnumValue() {
|
||||||
|
String retVal = myCode.toUpperCase().replace(' ', '_');
|
||||||
|
if (!Character.isJavaIdentifierStart(retVal.charAt(0))) {
|
||||||
|
retVal = '_' + retVal;
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefinition() {
|
||||||
|
return myDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplay() {
|
||||||
|
return myDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ import ca.uhn.fhir.model.primitive.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="${className}")
|
@DatatypeDef(name="${className}")
|
||||||
public class ${className}Dt extends BaseCompositeDatatype {
|
public class ${className}Dt extends BaseElement implements ICompositeDatatype {
|
||||||
|
|
||||||
#childExtensionFields( $childExtensionTypes )
|
#childExtensionFields( $childExtensionTypes )
|
||||||
#childVars( $children )
|
#childVars( $children )
|
||||||
|
|
|
@ -23,7 +23,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="${className}")
|
@ResourceDef(name="${className}")
|
||||||
public class ${className} implements IResource {
|
public class ${className} extends BaseElement implements IResource {
|
||||||
|
|
||||||
#childExtensionFields( $childExtensionTypes )
|
#childExtensionFields( $childExtensionTypes )
|
||||||
#childVars( $children )
|
#childVars( $children )
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Block(name="${blockChild.name}")
|
@Block(name="${blockChild.name}")
|
||||||
public static class ${blockChild.className} implements IResourceBlock {
|
public static class ${blockChild.className} extends BaseElement implements IResourceBlock {
|
||||||
|
|
||||||
#childVars( $blockChild.children )
|
#childVars( $blockChild.children )
|
||||||
#childAccessors( $blockChild.children )
|
#childAccessors( $blockChild.children )
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
package ca.uhn.fhir.model.dstu.valueset;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.*;
|
||||||
|
|
||||||
|
public class ${valueSet.className} extends ValueSetEnumeration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for this Value Set:
|
||||||
|
* ${valueSet.id}
|
||||||
|
*/
|
||||||
|
public static final String IDENTIFIER = "${valueSet.id}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor - should not be called directly
|
||||||
|
*/
|
||||||
|
protected ${valueSet.className}(String theCode) {
|
||||||
|
super(theCode, IDENTIFIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
#foreach ($code in $valueSet.codes)
|
||||||
|
/**
|
||||||
|
* ${code.code}
|
||||||
|
* ${code.display}
|
||||||
|
*
|
||||||
|
* ${code.definition}
|
||||||
|
*/
|
||||||
|
public static final ${valueSet.className} ${code.codeEnumValue} = new ${valueSet.className}("${code.code}");
|
||||||
|
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue