Enumerated types
This commit is contained in:
parent
42d8037a06
commit
1fab951815
|
@ -219,14 +219,14 @@ class ModelScanner {
|
|||
scanCompositeElementForChildren(next, theDefinition, elementNames, orderToElementDef, orderToExtensionDef);
|
||||
}
|
||||
|
||||
while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < 0) {
|
||||
BaseRuntimeDeclaredChildDefinition elementDef = orderToElementDef.remove(orderToElementDef.firstKey());
|
||||
if (elementDef.getElementName().equals("identifier")) {
|
||||
orderToElementDef.put(theIdentifierOrder, elementDef);
|
||||
} else {
|
||||
throw new ConfigurationException("Don't know how to handle element: " + elementDef.getElementName());
|
||||
}
|
||||
}
|
||||
// while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() < 0) {
|
||||
// BaseRuntimeDeclaredChildDefinition elementDef = orderToElementDef.remove(orderToElementDef.firstKey());
|
||||
// if (elementDef.getElementName().equals("identifier")) {
|
||||
// orderToElementDef.put(theIdentifierOrder, elementDef);
|
||||
// } else {
|
||||
// throw new ConfigurationException("Don't know how to handle element: " + elementDef.getElementName());
|
||||
// }
|
||||
// }
|
||||
|
||||
TreeSet<Integer> orders = new TreeSet<Integer>();
|
||||
orders.addAll(orderToElementDef.keySet());
|
||||
|
@ -247,6 +247,8 @@ class ModelScanner {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
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()) {
|
||||
|
||||
Narrative hasNarrative = next.getAnnotation(Narrative.class);
|
||||
|
@ -268,7 +270,7 @@ class ModelScanner {
|
|||
}
|
||||
|
||||
String elementName = element.name();
|
||||
int order = element.order();
|
||||
int order = element.order() + baseElementOrder;
|
||||
int min = element.min();
|
||||
int max = element.max();
|
||||
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderMap = theOrderToElementDef;
|
||||
|
@ -294,7 +296,7 @@ class ModelScanner {
|
|||
}
|
||||
|
||||
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)) {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -9,12 +9,10 @@ public abstract class BaseElement implements IElement, ISupportsUndeclaredExtens
|
|||
|
||||
@Override
|
||||
public List<UndeclaredExtension> getUndeclaredExtensions() {
|
||||
if (myUndeclaredExtensions==null) {
|
||||
myUndeclaredExtensions=new ArrayList<UndeclaredExtension>();
|
||||
if (myUndeclaredExtensions == null) {
|
||||
myUndeclaredExtensions = new ArrayList<UndeclaredExtension>();
|
||||
}
|
||||
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 IElement myValue;
|
||||
|
||||
public UndeclaredExtension() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UndeclaredExtension(String theUrl) {
|
||||
myUrl=theUrl;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
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>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myUse;
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt mySystem;
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myUse;
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myStatus;
|
||||
|
|
|
@ -36,7 +36,7 @@ import ca.uhn.fhir.model.primitive.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private DecimalDt myValue;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
@ -327,7 +327,7 @@ public class Group implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myCode;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
@ -472,7 +472,7 @@ public class Location implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private DecimalDt myLongitude;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myName;
|
||||
|
@ -293,7 +293,7 @@ public class Medication implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myForm;
|
||||
|
@ -373,7 +373,7 @@ public class Medication implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
@ChildResource(types= {
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myName;
|
||||
|
@ -600,7 +600,7 @@ public class Observation implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private QuantityDt myLow;
|
||||
|
@ -747,7 +747,7 @@ public class Observation implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myType;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
@ -362,7 +362,7 @@ public class Organization implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myPurpose;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
@ -624,7 +624,7 @@ public class Patient implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<CodeableConceptDt> myRelationship;
|
||||
|
@ -840,7 +840,7 @@ public class Patient implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt mySpecies;
|
||||
|
@ -954,7 +954,7 @@ public class Patient implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
@ChildResource(types= {
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
@ -527,7 +527,7 @@ public class Practitioner implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myCode;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myIdentifier;
|
||||
|
@ -664,7 +664,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdDt myIdentity;
|
||||
|
@ -844,7 +844,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myType;
|
||||
|
@ -1078,7 +1078,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myPath;
|
||||
|
@ -1279,7 +1279,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdDt myDiscriminator;
|
||||
|
@ -1404,7 +1404,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myShort;
|
||||
|
@ -2100,7 +2100,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myCode;
|
||||
|
@ -2214,7 +2214,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdDt myKey;
|
||||
|
@ -2438,7 +2438,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myName;
|
||||
|
@ -2640,7 +2640,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdDt myIdentity;
|
||||
|
@ -2745,7 +2745,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myName;
|
||||
|
@ -2959,7 +2959,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myCode;
|
||||
|
@ -3164,7 +3164,7 @@ public class Profile implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myName;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
@ -359,7 +359,7 @@ public class Specimen implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myRelationship;
|
||||
|
@ -443,7 +443,7 @@ public class Specimen implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
@ChildResource(types= {
|
||||
|
@ -673,7 +673,7 @@ public class Specimen implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myDescription;
|
||||
|
@ -801,7 +801,7 @@ public class Specimen implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<IdentifierDt> myIdentifier;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeableConceptDt myType;
|
||||
|
@ -191,7 +191,7 @@ public class Substance implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
@ -316,7 +316,7 @@ public class Substance implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private RatioDt myQuantity;
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private StringDt myIdentifier;
|
||||
|
@ -81,21 +81,6 @@ public class ValueSet implements IResource {
|
|||
@Child(name="expansion", order=13, min=0, max=1)
|
||||
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).
|
||||
* creating it if it does
|
||||
|
@ -604,7 +589,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private UriDt mySystem;
|
||||
|
@ -761,7 +746,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myCode;
|
||||
|
@ -964,7 +949,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private List<UriDt> myImport;
|
||||
|
@ -1077,7 +1062,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private UriDt mySystem;
|
||||
|
@ -1234,7 +1219,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private CodeDt myProperty;
|
||||
|
@ -1350,7 +1335,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private IdentifierDt myIdentifier;
|
||||
|
@ -1463,7 +1448,7 @@ public class ValueSet implements IResource {
|
|||
* </p>
|
||||
*/
|
||||
@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)
|
||||
private UriDt mySystem;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
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.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
||||
@DatatypeDef(name="Attachment")
|
||||
public class AttachmentDt extends BaseCompositeDatatype {
|
||||
public class AttachmentDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="contentType", order=0, min=1)
|
||||
private CodeDt myContentType;
|
||||
|
|
|
@ -2,11 +2,12 @@ package ca.uhn.fhir.model.primitive;
|
|||
|
||||
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;
|
||||
|
||||
@DatatypeDef(name = "base64Binary")
|
||||
public class Base64BinaryDt extends BasePrimitiveDatatype<byte[]> {
|
||||
public class Base64BinaryDt extends BaseElement implements IPrimitiveDatatype<byte[]> {
|
||||
|
||||
private byte[] myValue;
|
||||
|
||||
|
|
|
@ -12,11 +12,12 @@ import javax.xml.bind.DatatypeConverter;
|
|||
|
||||
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.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 ourYearMonthDayFormat = FastDateFormat.getInstance("yyyy-MM-dd");
|
||||
|
@ -135,7 +136,7 @@ public abstract class BaseDateTimeDt extends BasePrimitiveDatatype<Date> {
|
|||
if (dotIndex == -1 && !isPrecisionAllowed(SECOND)) {
|
||||
throw new DataFormatException("Invalid date/time string (data type does not support SECONDS precision)");
|
||||
} 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;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
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.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "boolean")
|
||||
public class BooleanDt extends BasePrimitiveDatatype<Boolean> {
|
||||
public class BooleanDt extends BaseElement implements IPrimitiveDatatype<Boolean> {
|
||||
|
||||
private Boolean myValue;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
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.parser.DataFormatException;
|
||||
|
||||
@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;
|
||||
|
||||
|
@ -18,13 +18,8 @@ public class CodeDt extends BasePrimitiveDatatype<String> implements ICodedDatat
|
|||
if (theValue == null) {
|
||||
myValue = null;
|
||||
} else {
|
||||
if (theValue.length() == 0) {
|
||||
throw new DataFormatException("Value can not be empty");
|
||||
}
|
||||
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;
|
||||
String newValue = theValue.trim();
|
||||
myValue = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@ package ca.uhn.fhir.model.primitive;
|
|||
|
||||
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.DatatypeDef;
|
||||
|
||||
@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)
|
||||
private List<CodingDt> myCoding;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.ChildResource;
|
||||
|
@ -9,7 +10,7 @@ import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
|||
|
||||
|
||||
@DatatypeDef(name="Coding")
|
||||
public class CodingDt extends BaseCompositeDatatype {
|
||||
public class CodingDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="system", order=0)
|
||||
private UriDt mySystem;
|
||||
|
|
|
@ -32,6 +32,7 @@ public class DateTimeDt extends BaseDateTimeDt {
|
|||
case MONTH:
|
||||
case DAY:
|
||||
case SECOND:
|
||||
case MILLI:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -2,12 +2,13 @@ package ca.uhn.fhir.model.primitive;
|
|||
|
||||
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.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "decimal")
|
||||
public class DecimalDt extends BasePrimitiveDatatype<BigDecimal> {
|
||||
public class DecimalDt extends BaseElement implements IPrimitiveDatatype<BigDecimal> {
|
||||
|
||||
private BigDecimal myValue;
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
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.SimpleSetter;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "id")
|
||||
public class IdDt extends BasePrimitiveDatatype<String> {
|
||||
public class IdDt extends BaseElement implements IPrimitiveDatatype<String> {
|
||||
|
||||
private String myValue;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
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.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.ResourceReference;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
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;
|
||||
|
||||
@DatatypeDef(name="identifier")
|
||||
public class IdentifierDt extends BaseCompositeDatatype {
|
||||
public class IdentifierDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="use", order=0)
|
||||
@CodeableConceptElement(type=IdentifierUseEnum.class)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
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.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name="integer")
|
||||
public class IntegerDt extends BasePrimitiveDatatype<Integer> {
|
||||
public class IntegerDt extends BaseElement implements IPrimitiveDatatype<Integer> {
|
||||
|
||||
private Integer myValue;
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import ca.uhn.fhir.model.api.BaseCompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.annotation.Constraint;
|
||||
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.Constraint;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
||||
@DatatypeDef(name="Period")
|
||||
public class PeriodDt extends BaseCompositeDatatype {
|
||||
public class PeriodDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="start", order=0)
|
||||
@Constraint(lessThan= {"end"})
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
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.Constraint;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||
|
||||
@DatatypeDef(name="Range")
|
||||
public class RangeDt extends BaseCompositeDatatype {
|
||||
public class RangeDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="low", order=0)
|
||||
@Constraint(lessThan= {"high"})
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
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.Constraint;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||
|
||||
@DatatypeDef(name="Ratio")
|
||||
public class RatioDt extends BaseCompositeDatatype {
|
||||
public class RatioDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="numerator", order=0)
|
||||
@Constraint(coRequirements= {"denominator"})
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
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.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||
|
||||
@DatatypeDef(name="SampledData")
|
||||
public class SampledDataDt extends BaseCompositeDatatype {
|
||||
public class SampledDataDt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
@Child(name="origin", order=0, min=1)
|
||||
private QuantityDt myOrigin;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
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.SimpleSetter;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "string")
|
||||
public class StringDt extends BasePrimitiveDatatype<String> {
|
||||
public class StringDt extends BaseElement implements IPrimitiveDatatype<String> {
|
||||
|
||||
private String myValue;
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ package ca.uhn.fhir.model.primitive;
|
|||
import java.net.URI;
|
||||
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.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "uri")
|
||||
public class UriDt extends BaseDatatype implements IPrimitiveDatatype<URI> {
|
||||
public class UriDt extends BaseElement implements IPrimitiveDatatype<URI> {
|
||||
|
||||
private URI myValue;
|
||||
|
||||
|
|
|
@ -342,12 +342,13 @@ class ParserState<T extends IElement> {
|
|||
*/
|
||||
public void enteringNewElementExtension(@SuppressWarnings("unused") StartElement theElement, String theUrlAttr) {
|
||||
if (getCurrentElement() instanceof ISupportsUndeclaredExtensions) {
|
||||
UndeclaredExtension newExtension = new UndeclaredExtension();
|
||||
newExtension.setUrl(theUrlAttr);
|
||||
UndeclaredExtension newExtension = new UndeclaredExtension(theUrlAttr);
|
||||
// TODO: fail if we don't support undeclared extensions
|
||||
((ISupportsUndeclaredExtensions) getCurrentElement()).getUndeclaredExtensions().add(newExtension);
|
||||
ExtensionState newState = new ExtensionState(newExtension);
|
||||
push(newState);
|
||||
} else {
|
||||
throw new DataFormatException("Extension is not supported at this position");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,6 +720,15 @@ class ParserState<T extends IElement> {
|
|||
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
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
throw new Error("?? can this happen?"); // TODO: can this happen?
|
||||
|
|
|
@ -129,8 +129,7 @@ public class XmlParser {
|
|||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
private boolean encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl)
|
||||
throws XMLStreamException, DataFormatException {
|
||||
private boolean encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl) throws XMLStreamException, DataFormatException {
|
||||
switch (childDef.getChildType()) {
|
||||
case PRIMITIVE_DATATYPE: {
|
||||
IPrimitiveDatatype<?> pd = (IPrimitiveDatatype<?>) nextValue;
|
||||
|
@ -184,12 +183,11 @@ public class XmlParser {
|
|||
throw new IllegalStateException("should not happen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void encodeCompositeElementChildrenToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children) throws XMLStreamException,
|
||||
DataFormatException {
|
||||
private void encodeCompositeElementChildrenToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children) throws XMLStreamException, DataFormatException {
|
||||
for (BaseRuntimeChildDefinition nextChild : children) {
|
||||
List<? extends IElement> values = nextChild.getAccessor().getValues(theElement);
|
||||
if (values == null || values.isEmpty()) {
|
||||
|
@ -220,8 +218,7 @@ public class XmlParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeCompositeElementToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef) throws XMLStreamException,
|
||||
DataFormatException {
|
||||
private void encodeCompositeElementToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef) throws XMLStreamException, DataFormatException {
|
||||
encodeExtensionsIfPresent(theEventWriter, theElement);
|
||||
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getExtensions());
|
||||
encodeCompositeElementChildrenToStreamWriter(theElement, theEventWriter, resDef.getChildren());
|
||||
|
@ -231,7 +228,7 @@ public class XmlParser {
|
|||
boolean retVal = false;
|
||||
if (theResource instanceof ISupportsUndeclaredExtensions) {
|
||||
for (UndeclaredExtension next : ((ISupportsUndeclaredExtensions) theResource).getUndeclaredExtensions()) {
|
||||
retVal =true;
|
||||
retVal = true;
|
||||
theWriter.writeStartElement("extension");
|
||||
theWriter.writeAttribute("url", next.getUrl());
|
||||
|
||||
|
@ -402,57 +399,62 @@ public class XmlParser {
|
|||
try {
|
||||
while (streamReader.hasNext()) {
|
||||
XMLEvent nextEvent = streamReader.nextEvent();
|
||||
if (nextEvent.isStartElement()) {
|
||||
StartElement elem = nextEvent.asStartElement();
|
||||
try {
|
||||
if (nextEvent.isStartElement()) {
|
||||
StartElement elem = nextEvent.asStartElement();
|
||||
|
||||
String namespaceURI = elem.getName().getNamespaceURI();
|
||||
String namespaceURI = elem.getName().getNamespaceURI();
|
||||
|
||||
if ("extension".equals(elem.getName().getLocalPart())) {
|
||||
Attribute urlAttr = elem.getAttributeByName(new QName("url"));
|
||||
if (urlAttr == null || isBlank(urlAttr.getValue())) {
|
||||
throw new DataFormatException("Extension element has no 'url' attribute");
|
||||
}
|
||||
parserState.enteringNewElementExtension(elem, urlAttr.getValue());
|
||||
} else {
|
||||
|
||||
String elementName = elem.getName().getLocalPart();
|
||||
parserState.enteringNewElement(namespaceURI, elementName);
|
||||
|
||||
if ("extension".equals(elem.getName().getLocalPart())) {
|
||||
Attribute urlAttr = elem.getAttributeByName(new QName("url"));
|
||||
if (urlAttr == null || isBlank(urlAttr.getValue())) {
|
||||
throw new DataFormatException("Extension element has no 'url' attribute");
|
||||
}
|
||||
parserState.enteringNewElementExtension(elem, urlAttr.getValue());
|
||||
} else {
|
||||
|
||||
String elementName = elem.getName().getLocalPart();
|
||||
parserState.enteringNewElement(namespaceURI, elementName);
|
||||
|
||||
}
|
||||
|
||||
for (@SuppressWarnings("unchecked")
|
||||
Iterator<Attribute> iter = elem.getAttributes(); iter.hasNext();) {
|
||||
Attribute next = iter.next();
|
||||
// if (next.getName().getLocalPart().equals("value")) {
|
||||
for (@SuppressWarnings("unchecked")
|
||||
Iterator<Attribute> iter = elem.getAttributes(); iter.hasNext();) {
|
||||
Attribute next = iter.next();
|
||||
// if
|
||||
// (next.getName().getLocalPart().equals("value")) {
|
||||
parserState.attributeValue(next.getName().getLocalPart(), next.getValue());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
} else if (nextEvent.isAttribute()) {
|
||||
Attribute elem = (Attribute) nextEvent;
|
||||
String name = (elem.getName().getLocalPart());
|
||||
parserState.attributeValue(name, elem.getValue());
|
||||
} else if (nextEvent.isEndElement()) {
|
||||
EndElement elem = nextEvent.asEndElement();
|
||||
|
||||
String name = elem.getName().getLocalPart();
|
||||
String namespaceURI = elem.getName().getNamespaceURI();
|
||||
// if (!FHIR_NS.equals(namespaceURI) &&
|
||||
// !XHTML_NS.equals(namespaceURI)) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
parserState.endingElement(elem);
|
||||
if (parserState.isComplete()) {
|
||||
return parserState.getObject();
|
||||
}
|
||||
} else if (nextEvent.isCharacters()) {
|
||||
parserState.string(nextEvent.asCharacters().getData());
|
||||
}
|
||||
|
||||
} else if (nextEvent.isAttribute()) {
|
||||
Attribute elem = (Attribute) nextEvent;
|
||||
String name = (elem.getName().getLocalPart());
|
||||
parserState.attributeValue(name, elem.getValue());
|
||||
} else if (nextEvent.isEndElement()) {
|
||||
EndElement elem = nextEvent.asEndElement();
|
||||
|
||||
String name = elem.getName().getLocalPart();
|
||||
String namespaceURI = elem.getName().getNamespaceURI();
|
||||
// if (!FHIR_NS.equals(namespaceURI) && !XHTML_NS.equals(namespaceURI)) {
|
||||
// continue;
|
||||
// }
|
||||
parserState.xmlEvent(nextEvent);
|
||||
|
||||
parserState.endingElement(elem);
|
||||
if (parserState.isComplete()) {
|
||||
return parserState.getObject();
|
||||
}
|
||||
} else if (nextEvent.isCharacters()) {
|
||||
parserState.string(nextEvent.asCharacters().getData());
|
||||
} catch (DataFormatException e) {
|
||||
throw new DataFormatException("DataFormatException at [" + nextEvent.getLocation().toString() + "]: "+e.getMessage(), e);
|
||||
}
|
||||
|
||||
parserState.xmlEvent(nextEvent);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (XMLStreamException e) {
|
||||
throw new DataFormatException(e);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<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 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">
|
||||
<attributes>
|
||||
<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
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
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.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.setDirectory("src/test/resources/res");
|
||||
|
|
|
@ -1,14 +1,30 @@
|
|||
package ca.uhn.fhir.starter;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
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.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.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.DefineConcept;
|
||||
import ca.uhn.fhir.starter.model.ValueSetTm;
|
||||
import ca.uhn.fhir.starter.model.ValueSetTm.Code;
|
||||
|
||||
public class ValueSetParser {
|
||||
|
||||
|
@ -17,38 +33,119 @@ public class ValueSetParser {
|
|||
private String myOutputDirectory;
|
||||
|
||||
public static void main(String[] args) throws FileNotFoundException, IOException {
|
||||
|
||||
|
||||
ValueSetParser p = new ValueSetParser();
|
||||
p.setDirectory("src/test/resources/vs/");
|
||||
// p.setBundle()
|
||||
// p.setValueSetName("administrative-gender");
|
||||
p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
|
||||
// p.setOutputDirectory("../hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/valueset/");
|
||||
p.setOutputDirectory("target/generated/valuesets/ca/uhn/fhir/model/dstu/valueset");
|
||||
p.parse();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValueSetParser.class);
|
||||
|
||||
private void parse() throws FileNotFoundException, IOException {
|
||||
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()) {
|
||||
// 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) {
|
||||
myOutputDirectory=theString;
|
||||
myOutputDirectory = theString;
|
||||
}
|
||||
|
||||
// private void setValueSetName(String theString) {
|
||||
// myValueSetName = theString;
|
||||
// }
|
||||
// private void setValueSetName(String theString) {
|
||||
// myValueSetName = theString;
|
||||
// }
|
||||
|
||||
public void setDirectory(String 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>
|
||||
*/
|
||||
@DatatypeDef(name="${className}")
|
||||
public class ${className}Dt extends BaseCompositeDatatype {
|
||||
public class ${className}Dt extends BaseElement implements ICompositeDatatype {
|
||||
|
||||
#childExtensionFields( $childExtensionTypes )
|
||||
#childVars( $children )
|
||||
|
|
|
@ -23,7 +23,7 @@ import ca.uhn.fhir.model.dstu.composite.*;
|
|||
* </p>
|
||||
*/
|
||||
@ResourceDef(name="${className}")
|
||||
public class ${className} implements IResource {
|
||||
public class ${className} extends BaseElement implements IResource {
|
||||
|
||||
#childExtensionFields( $childExtensionTypes )
|
||||
#childVars( $children )
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
* </p>
|
||||
*/
|
||||
@Block(name="${blockChild.name}")
|
||||
public static class ${blockChild.className} implements IResourceBlock {
|
||||
public static class ${blockChild.className} extends BaseElement implements IResourceBlock {
|
||||
|
||||
#childVars( $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